diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-04-30 04:47:42 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-04-30 04:47:42 +0200 |
commit | 0c017a0e4f0ae6fc88b5297e4379510737bfa5a2 (patch) | |
tree | 038dc0f72f548ebdd844bf4886ea487469e39f67 /src/vhdl | |
parent | b6d79c2362746b35bf276a610afaa7b9218bf183 (diff) | |
download | ghdl-0c017a0e4f0ae6fc88b5297e4379510737bfa5a2.tar.gz ghdl-0c017a0e4f0ae6fc88b5297e4379510737bfa5a2.tar.bz2 ghdl-0c017a0e4f0ae6fc88b5297e4379510737bfa5a2.zip |
Avoid crash on empty parentheses.
Fix #563
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/parse.adb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 87f65b003..02df6e458 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -4807,7 +4807,9 @@ package body Parse is -- Skip ')'. Scan; - if Get_Kind (Expr) = Iir_Kind_Aggregate then + if Expr /= Null_Iir + and then Get_Kind (Expr) = Iir_Kind_Aggregate + then -- Parenthesis around aggregate is useless and change the -- context for array aggregate. Warning_Msg_Sem @@ -9355,6 +9357,12 @@ package body Parse is -- design_unit ::= context_clause library_unit function Parse_Design_Unit return Iir_Design_Unit is + procedure Error_Empty is + begin + Error_Msg_Parse + ("missing entity, architecture, package or configuration"); + end Error_Empty; + Res: Iir_Design_Unit; Unit: Iir; begin @@ -9385,10 +9393,16 @@ package body Parse is Set_Library_Unit (Res, Parse_Package (Res)); when Tok_Configuration => Parse_Configuration_Declaration (Res); + when Tok_Identifier => + if Current_Identifier = Name_Context then + Error_Msg_Parse + ("context clause not allowed before vhdl 08"); + else + Error_Empty; + end if; + return Null_Iir; when others => - Error_Msg_Parse - ("entity, architecture, package or configuration " - & "keyword expected"); + Error_Empty; return Null_Iir; end case; end if; |