aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libraries.adb13
-rw-r--r--src/vhdl/errorout.adb31
-rw-r--r--src/vhdl/errorout.ads23
3 files changed, 53 insertions, 14 deletions
diff --git a/src/libraries.adb b/src/libraries.adb
index 7359b1bc6..1dfd8dea9 100644
--- a/src/libraries.adb
+++ b/src/libraries.adb
@@ -1693,7 +1693,9 @@ package body Libraries is
end Load_Parse_Design_Unit;
-- Load, parse, analyze, back-end a design_unit if necessary.
- procedure Load_Design_Unit (Design_Unit: Iir_Design_Unit; Loc : Iir) is
+ procedure Load_Design_Unit (Design_Unit: Iir_Design_Unit; Loc : Iir)
+ is
+ Warnings : Warnings_Setting;
begin
if Get_Date_State (Design_Unit) = Date_Disk then
Load_Parse_Design_Unit (Design_Unit, Loc);
@@ -1711,7 +1713,16 @@ package body Libraries 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);
end if;
case Get_Date (Design_Unit) is
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb
index a0b279752..f65cb555f 100644
--- a/src/vhdl/errorout.adb
+++ b/src/vhdl/errorout.adb
@@ -85,19 +85,7 @@ package body Errorout is
-- Warnings.
- type Warning_Control_Type is record
- Enabled : Boolean;
- Error : Boolean;
- end record;
-
- type Warnings_Array is array (Msgid_Warnings) of Warning_Control_Type;
-
- Warnings_Control : Warnings_Array :=
- (Warnid_Binding
- | Warnid_Library => (Enabled => True, Error => False),
- Warnid_Shared
- | Warnid_Pure => (Enabled => True, Error => False),
- others => (Enabled => False, Error => False));
+ Warnings_Control : Warnings_Setting := Default_Warnings;
procedure Enable_Warning (Id : Msgid_Warnings; Enable : Boolean) is
begin
@@ -137,6 +125,23 @@ package body Errorout is
return Res;
end Warning_Image;
+ procedure Save_Warnings_Setting (Res : out Warnings_Setting) is
+ begin
+ Res := Warnings_Control;
+ end Save_Warnings_Setting;
+
+ procedure Disable_All_Warnings is
+ begin
+ Warnings_Control := (others => (Enabled => False, Error => False));
+ end Disable_All_Warnings;
+
+ procedure Restore_Warnings_Setting (Res : Warnings_Setting) is
+ begin
+ Warnings_Control := Res;
+ end Restore_Warnings_Setting;
+
+ -- Error arguments
+
function "+" (V : Iir) return Earg_Type is
begin
return (Kind => Earg_Iir, Val_Iir => V);
diff --git a/src/vhdl/errorout.ads b/src/vhdl/errorout.ads
index 417ea9077..09260a876 100644
--- a/src/vhdl/errorout.ads
+++ b/src/vhdl/errorout.ads
@@ -125,6 +125,15 @@ package Errorout is
-- Get enable status of a warning.
function Is_Warning_Enabled (Id : Msgid_Warnings) return Boolean;
+ -- State of warnings.
+ type Warnings_Setting is private;
+
+ -- Global control of warnings.
+ -- Used to disable warnings while a referenced unit is analyzed.
+ procedure Save_Warnings_Setting (Res : out Warnings_Setting);
+ procedure Disable_All_Warnings;
+ procedure Restore_Warnings_Setting (Res : Warnings_Setting);
+
type Earg_Type is private;
type Earg_Arr is array (Natural range <>) of Earg_Type;
@@ -310,4 +319,18 @@ private
end record;
No_Eargs : constant Earg_Arr := (1 .. 0 => (Kind => Earg_None));
+
+ type Warning_Control_Type is record
+ Enabled : Boolean;
+ Error : Boolean;
+ end record;
+
+ type Warnings_Setting is array (Msgid_Warnings) of Warning_Control_Type;
+
+ Default_Warnings : constant Warnings_Setting :=
+ (Warnid_Binding
+ | Warnid_Library => (Enabled => True, Error => False),
+ Warnid_Shared
+ | Warnid_Pure => (Enabled => True, Error => False),
+ others => (Enabled => False, Error => False));
end Errorout;