aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-06-07 04:03:56 +0200
committerTristan Gingold <tgingold@free.fr>2022-06-07 04:03:56 +0200
commit177546b2cbb41f4a835025631187fb4dcf0c896e (patch)
tree39c937f65d5156c4d9ee7ba542a4ba108548f81c
parent65544a635f3588dfdeed8d0ffc4a7ea4d65511cd (diff)
downloadghdl-177546b2cbb41f4a835025631187fb4dcf0c896e.tar.gz
ghdl-177546b2cbb41f4a835025631187fb4dcf0c896e.tar.bz2
ghdl-177546b2cbb41f4a835025631187fb4dcf0c896e.zip
errorout: add nowrite warning. Fix #2081
During synthesis, emit a specific warning if a net is not assigned
-rw-r--r--src/errorout.ads5
-rw-r--r--src/synth/synth-errors.adb6
-rw-r--r--src/synth/synth-errors.ads3
-rw-r--r--src/synth/synth-vhdl_decls.adb8
-rw-r--r--src/synth/synth-vhdl_environment.adb2
5 files changed, 16 insertions, 8 deletions
diff --git a/src/errorout.ads b/src/errorout.ads
index 8cda8e69d..16515d8af 100644
--- a/src/errorout.ads
+++ b/src/errorout.ads
@@ -106,6 +106,10 @@ package Errorout is
-- FIXME: currently only subprograms are handled.
Warnid_Unused,
+ -- A variable or signal is never written.
+ -- (only for synthesis)
+ Warnid_Nowrite,
+
-- Others choice is not needed, all values are already covered.
Warnid_Others,
@@ -320,6 +324,7 @@ private
| Warnid_Runtime_Error | Warnid_Pure | Warnid_Specs | Warnid_Hide
| Warnid_Pragma | Warnid_Analyze_Assert | Warnid_Attribute
| Warnid_Deprecated_Option | Warnid_Unexpected_Option
+ | Warnid_Nowrite
| Warnid_No_Wait | Warnid_Useless
| Msgid_Warning => (Enabled => True, Error => False),
Warnid_Delta_Cycle | Warnid_Body | Warnid_Static | Warnid_Nested_Comment
diff --git a/src/synth/synth-errors.adb b/src/synth/synth-errors.adb
index e8d693d0b..a0b672770 100644
--- a/src/synth/synth-errors.adb
+++ b/src/synth/synth-errors.adb
@@ -33,12 +33,12 @@ package body Synth.Errors is
+Loc, Msg, Args);
end Error_Msg_Synth;
- procedure Warning_Msg_Synth (Loc : Location_Type;
+ procedure Warning_Msg_Synth (Warnid : Msgid_Warnings;
+ Loc : Location_Type;
Msg : String;
Arg1 : Earg_Type) is
begin
- Report_Msg (Msgid_Warning, Errorout.Elaboration,
- +Loc, Msg, (1 => Arg1));
+ Report_Msg (Warnid, Errorout.Elaboration, +Loc, Msg, (1 => Arg1));
end Warning_Msg_Synth;
procedure Warning_Msg_Synth (Loc : Location_Type;
diff --git a/src/synth/synth-errors.ads b/src/synth/synth-errors.ads
index 800f3232e..448ab6be1 100644
--- a/src/synth/synth-errors.ads
+++ b/src/synth/synth-errors.ads
@@ -26,7 +26,8 @@ package Synth.Errors is
procedure Error_Msg_Synth (Loc : Location_Type;
Msg : String;
Args : Earg_Arr := No_Eargs);
- procedure Warning_Msg_Synth (Loc : Location_Type;
+ procedure Warning_Msg_Synth (Warnid : Msgid_Warnings;
+ Loc : Location_Type;
Msg : String;
Arg1 : Earg_Type);
procedure Warning_Msg_Synth (Loc : Location_Type;
diff --git a/src/synth/synth-vhdl_decls.adb b/src/synth/synth-vhdl_decls.adb
index 96339dfcd..b6b00270e 100644
--- a/src/synth/synth-vhdl_decls.adb
+++ b/src/synth/synth-vhdl_decls.adb
@@ -18,6 +18,7 @@
with Types; use Types;
with Std_Names;
+with Errorout; use Errorout;
with Netlists.Builders; use Netlists.Builders;
with Netlists.Folds; use Netlists.Folds;
@@ -697,10 +698,11 @@ package body Synth.Vhdl_Decls is
-- TODO: maybe simply remove it.
if Def_Val = No_Net then
Warning_Msg_Synth
- (+Decl, "%n is never assigned and has no default value",
- (1 => +Decl));
+ (Warnid_Nowrite, +Decl,
+ "%n is never assigned and has no default value", +Decl);
else
- Warning_Msg_Synth (+Decl, "%n is never assigned", (1 => +Decl));
+ Warning_Msg_Synth
+ (Warnid_Nowrite, +Decl, "%n is never assigned", +Decl);
end if;
end if;
if Def_Val = No_Net then
diff --git a/src/synth/synth-vhdl_environment.adb b/src/synth/synth-vhdl_environment.adb
index e86cd7a7c..7e726993c 100644
--- a/src/synth/synth-vhdl_environment.adb
+++ b/src/synth/synth-vhdl_environment.adb
@@ -50,7 +50,7 @@ package body Synth.Vhdl_Environment is
begin
if Last_Off < First_Off then
Warning_Msg_Synth
- (+Decl.Obj, "no assignment for %n", +Decl.Obj);
+ (Warnid_Nowrite, +Decl.Obj, "no assignment for %n", +Decl.Obj);
elsif Last_Off = First_Off then
Warning_Msg_Synth (+Decl.Obj, "no assignment for offset %v of %n",
(1 => +First_Off, 2 => +Decl.Obj));