diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-06-04 09:25:48 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-06-04 16:27:52 +0200 |
commit | edadae250a40a542af0c850b57d08f1d00067c25 (patch) | |
tree | 87937342e5d6ee988ebf3bd008d314a26ce8b81f /src/vhdl | |
parent | 7ece912432d462bf361d90a05df84c34724771e1 (diff) | |
download | ghdl-edadae250a40a542af0c850b57d08f1d00067c25.tar.gz ghdl-edadae250a40a542af0c850b57d08f1d00067c25.tar.bz2 ghdl-edadae250a40a542af0c850b57d08f1d00067c25.zip |
vhdl: add a warning for unassociated ports
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/vhdl-sem_assocs.adb | 19 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_assocs.ads | 8 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_specs.adb | 4 |
3 files changed, 22 insertions, 9 deletions
diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb index a667345a2..7af5ecca6 100644 --- a/src/vhdl/vhdl-sem_assocs.adb +++ b/src/vhdl/vhdl-sem_assocs.adb @@ -2724,7 +2724,8 @@ package body Vhdl.Sem_Assocs is Pos := 0; while Inter /= Null_Iir loop if Inter_Matched (Pos) <= Open then - if Sem_Check_Missing_Association (Inter, Missing, Finish, Loc) + if Sem_Check_Missing_Association + (Inter, Missing, Finish, Inter_Matched (Pos) = Open, Loc) then Match := Not_Compatible; if not Finish then @@ -2738,9 +2739,11 @@ package body Vhdl.Sem_Assocs is end loop; end Sem_Association_Chain; - function Sem_Check_Missing_Association - (Inter : Iir; Missing : Missing_Type; Finish : Boolean; Loc : Iir) - return Boolean + function Sem_Check_Missing_Association (Inter : Iir; + Missing : Missing_Type; + Finish : Boolean; + Is_Open : Boolean; + Loc : Iir) return Boolean is Err : Boolean; begin @@ -2770,6 +2773,10 @@ package body Vhdl.Sem_Assocs is Error_Msg_Sem (+Loc, "%n of mode IN must be connected", +Inter); Err := True; + elsif not Is_Open then + Warning_Msg_Sem + (Warnid_No_Assoc, +Loc, + "%n of mode IN is not connected", +Inter); end if; when Iir_Out_Mode | Iir_Linkage_Mode @@ -2783,6 +2790,10 @@ package body Vhdl.Sem_Assocs is (+Loc, "unconstrained %n must be connected", +Inter); Err := True; + elsif not Is_Open then + Warning_Msg_Sem + (Warnid_No_Assoc, +Loc, + "%n of mode OUT is not connected", +Inter); end if; when Iir_Unknown_Mode => raise Internal_Error; diff --git a/src/vhdl/vhdl-sem_assocs.ads b/src/vhdl/vhdl-sem_assocs.ads index f59ecb3d3..fc334d828 100644 --- a/src/vhdl/vhdl-sem_assocs.ads +++ b/src/vhdl/vhdl-sem_assocs.ads @@ -98,7 +98,9 @@ package Vhdl.Sem_Assocs is -- INTER is an interface that is known not to be associated. -- Report an error according to MISSING iff FINISH is true. -- Return True iff not associating INTER is an error. - function Sem_Check_Missing_Association - (Inter : Iir; Missing : Missing_Type; Finish : Boolean; Loc : Iir) - return Boolean; + function Sem_Check_Missing_Association (Inter : Iir; + Missing : Missing_Type; + Finish : Boolean; + Is_Open : Boolean; + Loc : Iir) return Boolean; end Vhdl.Sem_Assocs; diff --git a/src/vhdl/vhdl-sem_specs.adb b/src/vhdl/vhdl-sem_specs.adb index 38a808440..9418fb9de 100644 --- a/src/vhdl/vhdl-sem_specs.adb +++ b/src/vhdl/vhdl-sem_specs.adb @@ -1350,7 +1350,7 @@ package body Vhdl.Sem_Specs is end Sem_Entity_Aspect; procedure Sem_Check_Missing_Generic_Association - (Inter_Chain : Iir; Assoc1 : Iir; Assoc2 : Iir; Loc : Iir) + (Inter_Chain : Iir; Assoc1 : Iir; Assoc2 : Iir; Loc : Iir) is Inter : Iir; Inter_Iter : Iir; @@ -1389,7 +1389,7 @@ package body Vhdl.Sem_Specs is if Get_Open_Flag (Inter) then Set_Open_Flag (Inter, False); Err := Sem_Check_Missing_Association - (Inter, Missing_Generic, True, Loc); + (Inter, Missing_Generic, True, False, Loc); end if; Inter := Get_Chain (Inter); end loop; |