diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-04-06 09:05:59 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-04-06 11:22:02 +0200 |
commit | 002e468075bd861ba129171620e69a238a3fcab7 (patch) | |
tree | ead60dd849f78614b01e5a759037979dcf73717f /src/vhdl | |
parent | b4d7798fe8e8edccb72d1b4e8541923aa1d94ef3 (diff) | |
download | ghdl-002e468075bd861ba129171620e69a238a3fcab7.tar.gz ghdl-002e468075bd861ba129171620e69a238a3fcab7.tar.bz2 ghdl-002e468075bd861ba129171620e69a238a3fcab7.zip |
vhdl: adjust missing port association check. Fix #792
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/configuration.adb | 4 | ||||
-rw-r--r-- | src/vhdl/sem.adb | 8 | ||||
-rw-r--r-- | src/vhdl/sem_assocs.adb | 71 |
3 files changed, 41 insertions, 42 deletions
diff --git a/src/vhdl/configuration.adb b/src/vhdl/configuration.adb index f0a04897d..54cbfef22 100644 --- a/src/vhdl/configuration.adb +++ b/src/vhdl/configuration.adb @@ -412,8 +412,8 @@ package body Configuration is end if; return True; end if; - when others => - Error_Kind ("check_open_port", Port); + when Iir_Unknown_Mode => + raise Internal_Error; end case; return False; end Check_Open_Port; diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb index 7cecd3d6b..45899f368 100644 --- a/src/vhdl/sem.adb +++ b/src/vhdl/sem.adb @@ -490,13 +490,7 @@ package body Sem is -- GHDL: for a direct instantiation, follow rules of -- LRM 1.1.1.1 Generic and LRM 1.1.1.2 Ports. - if Flags.Vhdl_Std = Vhdl_87 - or else Get_Kind (Inter_Parent) = Iir_Kind_Entity_Declaration - then - Miss := Missing_Port; - else - Miss := Missing_Allowed; - end if; + Miss := Missing_Port; when Iir_Kind_Binding_Indication => -- LRM 5.2.1.2 Generic map and port map aspects Miss := Missing_Allowed; diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb index 04b8c8807..fe7f9542b 100644 --- a/src/vhdl/sem_assocs.adb +++ b/src/vhdl/sem_assocs.adb @@ -2488,8 +2488,8 @@ package body Sem_Assocs is -- LRM93 1.1.1.2 / LRM08 6.5.6.3 Port clauses -- A port of mode IN may be unconnected or unassociated only if its -- declaration includes a default expression. - -- It is an error if a port of any mode other than IN is unconnected - -- or unassociated and its type is an unconstrained array type. + -- A port of any mode other than IN may be unconnected or unassociated + -- as long as its type is not an unconstrained array type. -- LRM08 6.5.6.2 Generic clauses -- It is an error if no such actual [instantiated package] is specified @@ -2500,50 +2500,55 @@ package body Sem_Assocs is Pos := 0; while Inter /= Null_Iir loop if Inter_Matched (Pos) <= Open then + -- Interface is unassociated (none or open). case Get_Kind (Inter) is when Iir_Kinds_Interface_Object_Declaration => - if Get_Default_Value (Inter) = Null_Iir then - case Missing is - when Missing_Parameter - | Missing_Generic => + case Missing is + when Missing_Parameter + | Missing_Generic => + if Get_Mode (Inter) /= Iir_In_Mode + or else Get_Default_Value (Inter) = Null_Iir + then if Finish then Error_Msg_Sem (+Loc, "no actual for %n", +Inter); end if; Match := Not_Compatible; return; - when Missing_Port => - case Get_Mode (Inter) is - when Iir_In_Mode => - -- No overloading for components/entities. - pragma Assert (Finish); + end if; + when Missing_Port => + case Get_Mode (Inter) is + when Iir_In_Mode => + -- No overloading for components/entities. + pragma Assert (Finish); + if Get_Default_Value (Inter) = Null_Iir then Error_Msg_Sem (+Loc, "%n of mode IN must be connected", +Inter); Match := Not_Compatible; return; - when Iir_Out_Mode - | Iir_Linkage_Mode - | Iir_Inout_Mode - | Iir_Buffer_Mode => - -- No overloading for components/entities. - pragma Assert (Finish); - if not Is_Fully_Constrained_Type - (Get_Type (Inter)) - then - Error_Msg_Sem - (+Loc, - "unconstrained %n must be connected", - +Inter); - Match := Not_Compatible; - return; - end if; - when Iir_Unknown_Mode => - raise Internal_Error; + end if; + when Iir_Out_Mode + | Iir_Linkage_Mode + | Iir_Inout_Mode + | Iir_Buffer_Mode => + -- No overloading for components/entities. + pragma Assert (Finish); + if not (Is_Fully_Constrained_Type + (Get_Type (Inter))) + then + Error_Msg_Sem + (+Loc, + "unconstrained %n must be connected", + +Inter); + Match := Not_Compatible; + return; + end if; + when Iir_Unknown_Mode => + raise Internal_Error; end case; - when Missing_Allowed => - null; - end case; - end if; + when Missing_Allowed => + null; + end case; when Iir_Kind_Interface_Package_Declaration | Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration => |