aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/vhdl-sem.adb29
-rw-r--r--src/vhdl/vhdl-sem_assocs.adb9
-rw-r--r--src/vhdl/vhdl-sem_decls.adb11
-rw-r--r--src/vhdl/vhdl-sem_expr.adb13
-rw-r--r--src/vhdl/vhdl-sem_expr.ads3
-rw-r--r--src/vhdl/vhdl-sem_stmts.adb3
6 files changed, 42 insertions, 26 deletions
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,
diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb
index ee965d0a0..09ed67a85 100644
--- a/src/vhdl/vhdl-sem_assocs.adb
+++ b/src/vhdl/vhdl-sem_assocs.adb
@@ -402,6 +402,15 @@ package body Vhdl.Sem_Assocs is
Error_Kind
("check_subprogram_association(3)", Formal_Inter);
end case;
+
+ case Get_Kind (Prefix) is
+ when Iir_Kind_Signal_Declaration
+ | Iir_Kind_Variable_Declaration =>
+ Set_Use_Flag (Prefix, True);
+ when others =>
+ null;
+ end case;
+
when Iir_Kind_Association_Element_By_Individual =>
null;
when others =>
diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb
index 2f29562bf..9e98c26a3 100644
--- a/src/vhdl/vhdl-sem_decls.adb
+++ b/src/vhdl/vhdl-sem_decls.adb
@@ -2227,11 +2227,10 @@ package body Vhdl.Sem_Decls is
when Iir_Kind_Architecture_Body
| Iir_Kind_Block_Statement =>
-- Might be used in a configuration.
- -- FIXME: create a second level of warning.
- null;
+ Check_Unused := True;
when Iir_Kind_Generate_Statement_Body =>
-- Might be used in a configuration.
- null;
+ Check_Unused := True;
when Iir_Kind_Package_Body
| Iir_Kind_Protected_Type_Body =>
-- Check only for declarations of the body.
@@ -2311,6 +2310,12 @@ package body Vhdl.Sem_Decls is
Warning_Msg_Sem (Warnid_Unused, +El,
"%n is never referenced", +El);
end if;
+ when Iir_Kind_Signal_Declaration
+ | Iir_Kind_Variable_Declaration =>
+ if not Get_Use_Flag (El) then
+ Warning_Msg_Sem (Warnid_Unused, +El,
+ "%n is never referenced", +El);
+ end if;
when others =>
null;
end case;
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb
index 31c105c19..da499d449 100644
--- a/src/vhdl/vhdl-sem_expr.adb
+++ b/src/vhdl/vhdl-sem_expr.adb
@@ -4242,9 +4242,11 @@ package body Vhdl.Sem_Expr is
loop
case Get_Kind (Obj) is
when Iir_Kind_Signal_Declaration
- | Iir_Kind_Constant_Declaration
+ | Iir_Kind_Variable_Declaration =>
+ Set_Use_Flag (Obj, True);
+ return;
+ when Iir_Kind_Constant_Declaration
| Iir_Kind_Interface_Constant_Declaration
- | Iir_Kind_Variable_Declaration
| Iir_Kind_Attribute_Value
| Iir_Kind_Iterator_Declaration
| Iir_Kind_Guard_Signal_Declaration =>
@@ -4326,13 +4328,6 @@ package body Vhdl.Sem_Expr is
end loop;
end Check_Read;
- procedure Check_Update (Expr : Iir)
- is
- pragma Unreferenced (Expr);
- begin
- null;
- end Check_Update;
-
-- Emit an error if the constant EXPR is deferred and cannot be used in
-- the current context.
procedure Check_Constant_Restriction (Expr : Iir; Loc : Iir)
diff --git a/src/vhdl/vhdl-sem_expr.ads b/src/vhdl/vhdl-sem_expr.ads
index c58a26e86..9e6531530 100644
--- a/src/vhdl/vhdl-sem_expr.ads
+++ b/src/vhdl/vhdl-sem_expr.ads
@@ -90,9 +90,6 @@ package Vhdl.Sem_Expr is
-- Check EXPR can be read.
procedure Check_Read (Expr : Iir);
- -- Check EXPR can be updated.
- procedure Check_Update (Expr : Iir);
-
-- For a procedure call, A_TYPE must be null.
function Sem_Subprogram_Call (Expr: Iir; A_Type: Iir) return Iir;
diff --git a/src/vhdl/vhdl-sem_stmts.adb b/src/vhdl/vhdl-sem_stmts.adb
index e5993cd5c..f8a42f182 100644
--- a/src/vhdl/vhdl-sem_stmts.adb
+++ b/src/vhdl/vhdl-sem_stmts.adb
@@ -332,6 +332,7 @@ package body Vhdl.Sem_Stmts is
end if;
when Iir_Kind_Signal_Declaration =>
Sem_Add_Driver (Target_Object, Stmt);
+ Set_Use_Flag (Target_Prefix, True);
when Iir_Kind_Guard_Signal_Declaration =>
Error_Msg_Sem (+Stmt, "implicit GUARD signal cannot be assigned");
return;
@@ -399,7 +400,7 @@ package body Vhdl.Sem_Stmts is
return;
end if;
when Iir_Kind_Variable_Declaration =>
- null;
+ Set_Use_Flag (Target_Prefix, True);
when Iir_Kind_Implicit_Dereference
| Iir_Kind_Dereference =>
-- LRM 3.3