aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-04-24 18:52:53 +0200
committerTristan Gingold <tgingold@free.fr>2018-04-24 18:52:53 +0200
commit0c5810f8f576f59a92a2863c4e6408b04590e863 (patch)
treeb6d0d650e04e4f0f5e233e001bc6d47053d60ce1 /src
parent08b56bd39ce2cb2bf0641e8fb5eb58d6a1b25b8c (diff)
downloadghdl-0c5810f8f576f59a92a2863c4e6408b04590e863.tar.gz
ghdl-0c5810f8f576f59a92a2863c4e6408b04590e863.tar.bz2
ghdl-0c5810f8f576f59a92a2863c4e6408b04590e863.zip
Improve error message for #560.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/sem_names.adb10
-rw-r--r--src/vhdl/sem_scopes.ads10
2 files changed, 19 insertions, 1 deletions
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index d8d7dea6e..141563292 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -1830,7 +1830,15 @@ package body Sem_Names is
if not Valid_Interpretation (Interpretation) then
-- Unknown name.
if not Soft then
- Error_Msg_Sem (+Name, "no declaration for %i", +Name);
+ Interpretation := Get_Interpretation_Raw (Id);
+ if Valid_Interpretation (Interpretation)
+ and then Is_Conflict_Declaration (Interpretation)
+ then
+ Error_Msg_Sem
+ (+Name, "no declaration for %i (due to conflicts)", +Name);
+ else
+ Error_Msg_Sem (+Name, "no declaration for %i", +Name);
+ end if;
end if;
Res := Error_Mark;
elsif not Valid_Interpretation (Get_Next_Interpretation (Interpretation))
diff --git a/src/vhdl/sem_scopes.ads b/src/vhdl/sem_scopes.ads
index 6942c5430..3503d4fb6 100644
--- a/src/vhdl/sem_scopes.ads
+++ b/src/vhdl/sem_scopes.ads
@@ -105,6 +105,16 @@ package Sem_Scopes is
return Boolean;
pragma Inline (Is_In_Current_Declarative_Region);
+ -- Return the raw interpretation of ID. To be used only in case of
+ -- invalid interpretation to clarify the issue: this may be due to
+ -- conflicting declarations.
+ function Get_Interpretation_Raw (Id : Name_Id)
+ return Name_Interpretation_Type;
+
+ -- Return True iff NI is a conflicting declaration.
+ function Is_Conflict_Declaration (Ni : Name_Interpretation_Type)
+ return Boolean;
+
-- Push and pop all interpretations.
-- This can be used to suspend name interpretation, in case of recursive
-- semantics.