aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-03-21 06:22:42 +0100
committerTristan Gingold <tgingold@free.fr>2018-03-21 06:22:42 +0100
commit047de40c7799e4186b16bd1ad2c6eb17a7cf0098 (patch)
tree8c2e267979ed2db60dcea017275fe76a211108f5 /src
parent628582294c3695f271c738d1459d57b239e04487 (diff)
downloadghdl-047de40c7799e4186b16bd1ad2c6eb17a7cf0098.tar.gz
ghdl-047de40c7799e4186b16bd1ad2c6eb17a7cf0098.tar.bz2
ghdl-047de40c7799e4186b16bd1ad2c6eb17a7cf0098.zip
Improve handling of cascaded error.
Fir #543
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/sem_decls.adb45
-rw-r--r--src/vhdl/sem_expr.adb2
-rw-r--r--src/vhdl/sem_names.adb2
3 files changed, 28 insertions, 21 deletions
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index 0e0240809..ab0566753 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -159,27 +159,32 @@ package body Sem_Decls is
is
Decl_Type : constant Iir := Get_Type (Decl);
begin
- if Get_Signal_Type_Flag (Decl_Type) = False then
- Error_Msg_Sem (+Decl, "type of %n cannot be %n", (+Decl, +Decl_Type));
- case Get_Kind (Decl_Type) is
- when Iir_Kind_File_Type_Definition =>
- null;
- when Iir_Kind_Protected_Type_Declaration =>
- null;
- when Iir_Kind_Interface_Type_Definition =>
- null;
- when Iir_Kind_Access_Type_Definition
- | Iir_Kind_Access_Subtype_Definition =>
- null;
- when Iir_Kinds_Array_Type_Definition
- | Iir_Kind_Record_Type_Definition
- | Iir_Kind_Record_Subtype_Definition =>
- Error_Msg_Sem
- (+Decl, "(%n has an access subelement)", +Decl_Type);
- when others =>
- Error_Kind ("check_signal_type", Decl_Type);
- end case;
+ if Get_Signal_Type_Flag (Decl_Type) then
+ return;
+ end if;
+
+ if Is_Error (Decl_Type) then
+ return;
end if;
+
+ Error_Msg_Sem (+Decl, "type of %n cannot be %n", (+Decl, +Decl_Type));
+ case Get_Kind (Decl_Type) is
+ when Iir_Kind_File_Type_Definition =>
+ null;
+ when Iir_Kind_Protected_Type_Declaration =>
+ null;
+ when Iir_Kind_Interface_Type_Definition =>
+ null;
+ when Iir_Kind_Access_Type_Definition
+ | Iir_Kind_Access_Subtype_Definition =>
+ null;
+ when Iir_Kinds_Array_Type_Definition
+ | Iir_Kind_Record_Type_Definition
+ | Iir_Kind_Record_Subtype_Definition =>
+ Error_Msg_Sem (+Decl, "(%n has an access subelement)", +Decl_Type);
+ when others =>
+ Error_Kind ("check_signal_type", Decl_Type);
+ end case;
end Check_Signal_Type;
procedure Sem_Interface_Object_Declaration
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index 4e27eb1ce..ec73f37b6 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -3585,6 +3585,8 @@ package body Sem_Expr is
return Null_Iir;
end if;
return Expr;
+ when Iir_Kind_Error =>
+ return Null_Iir;
when others =>
Error_Msg_Sem (+Expr, "type %n is not composite", +A_Type);
return Null_Iir;
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 6ec51ed3a..bdf1235b9 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -2419,7 +2419,7 @@ package body Sem_Names is
end if;
if Get_Kind (Base_Type) /= Iir_Kind_Array_Type_Definition then
- if Finish then
+ if Finish and then not Is_Error (Base_Type) then
Error_Msg_Sem (+Name, "type of prefix is not an array");
end if;
return Null_Iir;