diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-14 18:50:22 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-15 09:47:13 +0100 |
commit | 5b59dda84a7eb8a48e94a75b9b3ad008514089ce (patch) | |
tree | 7d8bcf6addec0f6ebb6bb68b50650d03607128c8 /src/vhdl/vhdl-sem_expr.adb | |
parent | 1fe5958609b57e7d134e0cc75713c530339a86dd (diff) | |
download | ghdl-5b59dda84a7eb8a48e94a75b9b3ad008514089ce.tar.gz ghdl-5b59dda84a7eb8a48e94a75b9b3ad008514089ce.tar.bz2 ghdl-5b59dda84a7eb8a48e94a75b9b3ad008514089ce.zip |
vhdl: add a warning to detect use before elaboration
Diffstat (limited to 'src/vhdl/vhdl-sem_expr.adb')
-rw-r--r-- | src/vhdl/vhdl-sem_expr.adb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 5fbb6cd34..d605d3b46 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -1262,6 +1262,15 @@ package body Vhdl.Sem_Expr is Set_Function_Call_Staticness (Expr, Imp); Sem_Decls.Mark_Subprogram_Used (Imp); + -- Check the subprogram is not called before its elaboration. + if not Unelaborated_Use_Allowed + and then Get_Kind (Imp) in Iir_Kinds_Subprogram_Declaration + and then not Get_Elaborated_Flag (Imp) + then + Warning_Msg_Sem (Warnid_Elaboration, +Expr, + "%n is called before elaborated of its body", +Imp); + end if; + -- Check purity/wait/passive. if Subprg = Null_Iir then |