Hi
If I understand well, with vhdl 93 (but not with vhdl 87), it is allowed to have
generics that are not associated. But I think that it is good that there is at
least a warning because a generic can be unwillingly forgotten to be associated
and this will help to find such a mistake.
So the following patch make a warning when there is unassociated generics.
Bye Jonas
diff -rupN ghdl_orig//vhdl/sem.adb ghdl//vhdl/sem.adb
--- ghdl_orig//vhdl/sem.adb 2010-01-25 00:04:30.000000000 +0100
+++ ghdl//vhdl/sem.adb 2010-03-20 23:35:47.869452299 +0100
@@ -370,7 +370,7 @@ package body Sem is
Miss_Generic := Missing_Generic;
Miss_Port := Missing_Port;
else
- Miss_Generic := Missing_Allowed;
+ Miss_Generic := Missing_Generic_Warned;
if Get_Kind (Inter_Parent) = Iir_Kind_Entity_Declaration then
-- FIXME: to be checked.
-- Ghdl: for a direct instantiation, follow rules of
diff -rupN ghdl_orig//vhdl/sem_assocs.adb ghdl//vhdl/sem_assocs.adb
--- ghdl_orig//vhdl/sem_assocs.adb 2010-01-25 00:04:30.000000000 +0100
+++ ghdl//vhdl/sem_assocs.adb 2010-03-20 23:46:32.690461083 +0100
@@ -1652,6 +1652,12 @@ package body Sem_Assocs is
end if;
Match := False;
return;
+ when Missing_Generic_Warned =>
+ if Finish then
+ Warning_Msg_Sem ("no actual for " & Disp_Node (Inter), Loc);
+ end if;
+ Match := False;
+ return;
when Missing_Port =>
case Get_Mode (Inter) is
when Iir_In_Mode =>
diff -rupN ghdl_orig//vhdl/sem_assocs.ads ghdl//vhdl/sem_assocs.ads
--- ghdl_orig//vhdl/sem_assocs.ads 2010-01-25 00:04:30.000000000 +0100
+++ ghdl//vhdl/sem_assocs.ads 2010-03-20 18:13:13.000000000 +0100
@@ -32,7 +32,7 @@ package Sem_Assocs is
-- LOC is the association.
-- Sem_Actual_Of_Association_Chain must have been called before.
type Missing_Type is (Missing_Parameter, Missing_Port, Missing_Generic,
- Missing_Allowed);
+ Missing_Generic_Warned, Missing_Allowed);
procedure Sem_Association_Chain
(Interface_Chain : Iir;
Assoc_Chain: in out Iir;