aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-10-07 18:34:39 +0200
committerTristan Gingold <tgingold@free.fr>2020-10-07 18:50:10 +0200
commitfce4a3afbd3495ec70af9182ef5c63e61901e179 (patch)
tree386b733af8f287915cb0a4d655000a7b0c0e4bbe
parentc43f0a9519038e85fa8706f15bd2243e77ad7fca (diff)
downloadghdl-fce4a3afbd3495ec70af9182ef5c63e61901e179.tar.gz
ghdl-fce4a3afbd3495ec70af9182ef5c63e61901e179.tar.bz2
ghdl-fce4a3afbd3495ec70af9182ef5c63e61901e179.zip
vhdl-sem_specs: avoid noisy error message
for attribute specification with invalid entity class.
-rw-r--r--src/vhdl/vhdl-sem_specs.adb9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vhdl/vhdl-sem_specs.adb b/src/vhdl/vhdl-sem_specs.adb
index 22f8977b2..47db19ff7 100644
--- a/src/vhdl/vhdl-sem_specs.adb
+++ b/src/vhdl/vhdl-sem_specs.adb
@@ -234,6 +234,7 @@ package body Vhdl.Sem_Specs is
is
use Vhdl.Tokens;
Attr_Expr : constant Iir := Get_Expression (Attr);
+ Attr_Class : constant Token_Type := Get_Entity_Class (Attr);
El : Iir_Attribute_Value;
@@ -247,10 +248,12 @@ package body Vhdl.Sem_Specs is
-- LRM93 5.1
-- It is an error if the class of those names is not the same as that
-- denoted by the entity class.
- if Get_Entity_Class_Kind (Decl) /= Get_Entity_Class (Attr) then
+ if Attr_Class /= Tok_Invalid
+ and then Get_Entity_Class_Kind (Decl) /= Attr_Class
+ then
if Check_Class then
- Error_Msg_Sem (+Attr, "%n is not of class %t",
- (+Decl, +Get_Entity_Class (Attr)));
+ Error_Msg_Sem
+ (+Attr, "%n is not of class %t", (+Decl, +Attr_Class));
if Get_Kind (Decl) = Iir_Kind_Subtype_Declaration
and then Get_Entity_Class (Attr) = Tok_Type
and then Get_Type (Decl) /= Null_Iir