aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-17 07:59:45 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-17 07:59:45 +0200
commit0c48fe92b4ac3c29a4a8014d92440ee4564e4fdb (patch)
tree61226f58e1b74f96dc2797a9a98907e284a7350d /src/vhdl
parent45158bdc5443993ecb28b135ffe1a1b77032277d (diff)
downloadghdl-0c48fe92b4ac3c29a4a8014d92440ee4564e4fdb.tar.gz
ghdl-0c48fe92b4ac3c29a4a8014d92440ee4564e4fdb.tar.bz2
ghdl-0c48fe92b4ac3c29a4a8014d92440ee4564e4fdb.zip
vhdl: reject top-level entities with a type generic. Fix #1236
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-configuration.adb21
1 files 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;