aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-06 08:01:53 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-06 08:01:53 +0100
commit0e4a4280f05604821c1c7719b3d9486bf11af5ce (patch)
treed9b95d80c15b7181bb4b8b3d99256bccb5566366
parent8aa863512adaba4d6394f7bfd1f37198d0d96f1b (diff)
downloadghdl-0e4a4280f05604821c1c7719b3d9486bf11af5ce.tar.gz
ghdl-0e4a4280f05604821c1c7719b3d9486bf11af5ce.tar.bz2
ghdl-0e4a4280f05604821c1c7719b3d9486bf11af5ce.zip
vhdl-errors: give an hint for -frelaxed. Fix #1152
-rw-r--r--doc/using/InvokingGHDL.rst1
-rw-r--r--src/vhdl/vhdl-errors.adb10
2 files changed, 11 insertions, 0 deletions
diff --git a/doc/using/InvokingGHDL.rst b/doc/using/InvokingGHDL.rst
index 6846b1b3e..4deb96b7f 100644
--- a/doc/using/InvokingGHDL.rst
+++ b/doc/using/InvokingGHDL.rst
@@ -344,6 +344,7 @@ Options
.. WARNING:: This option is not set by default. I don't think this option is a good feature, because it breaks the encapsulation rule. When set, an operator can be silently overridden in another package. You'd do better to fix your design and use the ``numeric_std`` package.
+.. option:: -frelaxed
.. option:: -frelaxed-rules
Within an object declaration, allow references to the name (which references the hidden declaration). This ignores the error in the following code:
diff --git a/src/vhdl/vhdl-errors.adb b/src/vhdl/vhdl-errors.adb
index c05fa3265..313326c0f 100644
--- a/src/vhdl/vhdl-errors.adb
+++ b/src/vhdl/vhdl-errors.adb
@@ -110,6 +110,8 @@ package body Vhdl.Errors is
Report_Msg (Msgid_Error, Semantic, +Loc, Msg, (1 => Arg1));
end Error_Msg_Sem;
+ Relaxed_Hint_Done : Boolean := False;
+
procedure Error_Msg_Relaxed (Origin : Report_Origin;
Id : Msgid_Warnings;
Msg : String;
@@ -127,6 +129,14 @@ package body Vhdl.Errors is
Level := Msgid_Error;
end if;
Report_Msg (Level, Origin, +Loc, Msg, Args);
+ if not Relaxed_Hint_Done and then Level = Msgid_Error then
+ Report_Msg
+ (Msgid_Note, Origin, +Loc,
+ "(you can use -frelaxed to turn this error into a warning)");
+ -- Emit the message only once, although it applies for many error.
+ -- Maybe do it once per Id ?
+ Relaxed_Hint_Done := True;
+ end if;
end Error_Msg_Relaxed;
procedure Error_Msg_Sem_Relaxed (Loc : Iir;