From fb6930072c61baa1dd5d64af2b5c37c7b53347bf Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 28 Nov 2017 06:12:11 +0100 Subject: Avoid crash on non-allowed declarations in protected types. Fix #470. --- src/vhdl/sem_names.adb | 4 +++- src/vhdl/sem_types.adb | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb index 0190ee1a4..b96e357c7 100644 --- a/src/vhdl/sem_names.adb +++ b/src/vhdl/sem_names.adb @@ -2017,7 +2017,9 @@ package body Sem_Names is | Iir_Kind_Use_Clause => null; when others => - Error_Kind ("sem_as_protected_item", Method); + -- Declarations not allowed in protected types. + -- Just ignore them. + null; end case; Method := Get_Chain (Method); end loop; diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb index 45f67be51..528a672ed 100644 --- a/src/vhdl/sem_types.adb +++ b/src/vhdl/sem_types.adb @@ -597,9 +597,14 @@ package body Sem_Types is end if; end if; end; + when Iir_Kind_Anonymous_Type_Declaration => + -- This is an error, but an anonynmous type declaration is + -- followed by a subtype declaration, which is also an error. + -- Avoid duplicate messages. + null; when others => Error_Msg_Sem - (+El, "%n are not allowed in protected type declaration", + (+El, "%n is not allowed in protected type declaration", +El); end case; El := Get_Chain (El); -- cgit v1.2.3