aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_lib.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-11 18:59:09 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-11 18:59:09 +0100
commit5c398db1b18a346cf2cb25acac07b068ccd7deee (patch)
tree301d6a7740771982eb1965e707d07cbc03adc597 /src/vhdl/vhdl-sem_lib.adb
parent35fbed730c692574c71de394cbec2c2b2dd9843b (diff)
downloadghdl-5c398db1b18a346cf2cb25acac07b068ccd7deee.tar.gz
ghdl-5c398db1b18a346cf2cb25acac07b068ccd7deee.tar.bz2
ghdl-5c398db1b18a346cf2cb25acac07b068ccd7deee.zip
vhdl-sem_lib: also disable warnings when parsing
Diffstat (limited to 'src/vhdl/vhdl-sem_lib.adb')
-rw-r--r--src/vhdl/vhdl-sem_lib.adb27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/vhdl/vhdl-sem_lib.adb b/src/vhdl/vhdl-sem_lib.adb
index 35e92f93d..2197c6b5e 100644
--- a/src/vhdl/vhdl-sem_lib.adb
+++ b/src/vhdl/vhdl-sem_lib.adb
@@ -337,6 +337,7 @@ package body Vhdl.Sem_Lib is
is
Prev_Nbr_Errors : Natural;
Warnings : Warnings_Setting;
+ Error : Boolean;
begin
if Get_Date (Design_Unit) = Date_Replacing then
Error_Msg_Sem (+Loc, "circular reference of %n", +Design_Unit);
@@ -348,10 +349,17 @@ package body Vhdl.Sem_Lib is
Prev_Nbr_Errors := Errorout.Nbr_Errors;
Errorout.Nbr_Errors := 0;
+ -- Disable all warnings. Warnings are emitted only when the unit
+ -- is analyzed.
+ Save_Warnings_Setting (Warnings);
+ Disable_All_Warnings;
+
if Get_Date_State (Design_Unit) = Date_Disk then
Load_Parse_Design_Unit (Design_Unit, Loc);
end if;
+ Error := False;
+
if Get_Date_State (Design_Unit) = Date_Parse then
-- Analyze the design unit.
@@ -364,31 +372,30 @@ package body Vhdl.Sem_Lib is
-- Avoid infinite recursion, if the unit is self-referenced.
Set_Date_State (Design_Unit, Date_Analyze);
- -- Disable all warnings. Warnings are emitted only when the unit
- -- is analyzed.
- Save_Warnings_Setting (Warnings);
- Disable_All_Warnings;
-
-- Analyze unit.
Finish_Compilation (Design_Unit);
- -- Restore warnings.
- Restore_Warnings_Setting (Warnings);
-
-- Check if one of its dependency makes this unit obsolete.
-- FIXME: to do when the dependency is added ?
if not Flags.Flag_Elaborate_With_Outdated
and then Check_Obsolete_Dependence (Design_Unit, Loc)
then
Set_Date (Design_Unit, Date_Obsolete);
- Errorout.Nbr_Errors := Prev_Nbr_Errors + Errorout.Nbr_Errors;
- return;
+ Error := True;
end if;
end if;
-- Restore nbr_errors (accumulate).
Errorout.Nbr_Errors := Prev_Nbr_Errors + Errorout.Nbr_Errors;
+ -- Restore warnings.
+ Restore_Warnings_Setting (Warnings);
+
+ if Error then
+ -- Return now in case of analyze error.
+ return;
+ end if;
+
case Get_Date (Design_Unit) is
when Date_Parsed =>
raise Internal_Error;