From 0c48fe92b4ac3c29a4a8014d92440ee4564e4fdb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 17 Apr 2020 07:59:45 +0200 Subject: vhdl: reject top-level entities with a type generic. Fix #1236 --- src/vhdl/vhdl-configuration.adb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/vhdl/vhdl-configuration.adb b/src/vhdl/vhdl-configuration.adb index d2cdfb9ff..3394ae5ba 100644 --- a/src/vhdl/vhdl-configuration.adb +++ b/src/vhdl/vhdl-configuration.adb @@ -823,11 +823,22 @@ package body Vhdl.Configuration is -- Check generics. El := Get_Generic_Chain (Entity); while El /= Null_Iir loop - if Get_Default_Value (El) = Null_Iir then - if not (Enable_Override and Allow_Generic_Override (El)) then - Error (El, "(%n has no default value)", +El); - end if; - end if; + case Iir_Kinds_Interface_Declaration (Get_Kind (El)) is + when Iir_Kinds_Interface_Object_Declaration => + if Get_Default_Value (El) = Null_Iir then + if not (Enable_Override and Allow_Generic_Override (El)) then + Error (El, "(%n has no default value)", +El); + end if; + end if; + when Iir_Kinds_Interface_Subprogram_Declaration => + Error (El, "(%n is a subprogram generic)", +El); + when Iir_Kind_Interface_Type_Declaration => + Error (El, "(%n is a type generic)", +El); + when Iir_Kind_Interface_Package_Declaration => + Error (El, "(%n is a package generic)", +El); + when Iir_Kind_Interface_Terminal_Declaration => + null; + end case; El := Get_Chain (El); end loop; -- cgit v1.2.3