From 7da8782857a299f95e2cf1c348cd7f67f62cd2eb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 5 Jun 2019 20:32:28 +0200 Subject: vhdl: detect unused signals and variables. --- src/vhdl/vhdl-sem.adb | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/vhdl/vhdl-sem.adb') diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb index 53a61ca3b..503d43293 100644 --- a/src/vhdl/vhdl-sem.adb +++ b/src/vhdl/vhdl-sem.adb @@ -545,16 +545,21 @@ package body Vhdl.Sem is Check_Port_Association_Bounds_Restrictions (Formal, Actual, Assoc); Prefix := Get_Object_Prefix (Object); - if Get_Kind (Prefix) = Iir_Kind_Interface_Signal_Declaration - then - declare - P : Boolean; - pragma Unreferenced (P); - begin - P := Check_Port_Association_Mode_Restrictions - (Formal_Base, Prefix, Assoc); - end; - end if; + case Get_Kind (Prefix) is + when Iir_Kind_Interface_Signal_Declaration => + declare + P : Boolean; + pragma Unreferenced (P); + begin + P := Check_Port_Association_Mode_Restrictions + (Formal_Base, Prefix, Assoc); + end; + when Iir_Kind_Signal_Declaration => + Set_Use_Flag (Prefix, True); + when others => + -- FIXME: attributes ? + null; + end case; else -- Expression. Set_Collapse_Signal_Flag (Assoc, False); @@ -580,6 +585,10 @@ package body Vhdl.Sem is (+Actual, "actual expression must be globally static"); end if; + + -- Is it possible to have a globally static name that is + -- not readable ? + Check_Read (Actual); else Error_Msg_Sem (+Assoc, -- cgit v1.2.3