diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-09-17 06:38:52 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-09-17 06:38:52 +0200 |
commit | 8f89cb2f9fa48b70ac29f38dadc82e6527755700 (patch) | |
tree | 320869237ae3859f2ea28edcb3c5d4a895b36f3e /src/vhdl | |
parent | cd8247bb0241fe057b90e8c2daca358b2e59b154 (diff) | |
download | ghdl-8f89cb2f9fa48b70ac29f38dadc82e6527755700.tar.gz ghdl-8f89cb2f9fa48b70ac29f38dadc82e6527755700.tar.bz2 ghdl-8f89cb2f9fa48b70ac29f38dadc82e6527755700.zip |
Add --warn-hide when a declaration hides a previous one.
For #652
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/errorout.ads | 3 | ||||
-rw-r--r-- | src/vhdl/sem_scopes.adb | 15 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/vhdl/errorout.ads b/src/vhdl/errorout.ads index 224f18cb9..ff7c54ada 100644 --- a/src/vhdl/errorout.ads +++ b/src/vhdl/errorout.ads @@ -103,6 +103,9 @@ package Errorout is -- Declaration of a shared variable with a non-protected type. Warnid_Shared, + -- A declaration hides a previous one. + Warnid_Hide, + -- Emit a warning when a declaration is never used. -- FIXME: currently only subprograms are handled. Warnid_Unused, diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb index e0589dc3f..17e3847ed 100644 --- a/src/vhdl/sem_scopes.adb +++ b/src/vhdl/sem_scopes.adb @@ -913,12 +913,15 @@ package body Sem_Scopes is end if; end if; - -- Homograph, not in the same scope. - -- LRM §10.3: - -- A declaration is said to be hidden within (part of) an inner - -- declarative region if the inner region contains an homograph - -- of this declaration; the outer declaration is the hidden - -- within the immediate scope of the inner homograph. + -- Homograph, not in the same scope. + -- LRM §10.3: + -- A declaration is said to be hidden within (part of) an inner + -- declarative region if the inner region contains an homograph + -- of this declaration; the outer declaration is the hidden + -- within the immediate scope of the inner homograph. + Warning_Msg_Sem (Warnid_Hide, +Decl, + "declaration of %i hides %n", (+Decl, +Current_Decl)); + Add_New_Interpretation (True); end Add_Name; |