Warnings_Treated_As_Errors := 0;
Warnings_Detected := 0;
Warnings_As_Errors_Count := 0;
+ Compile_Time_Pragma_Warnings := 0;
-- Initialize warnings tables
end if;
if Warning_Mode = Treat_As_Error then
- declare
- Compile_Time_Pragma_Warnings : constant Nat :=
- Count_Compile_Time_Pragma_Warnings;
- Total : constant Int := Total_Errors_Detected + Warnings_Detected
- - Compile_Time_Pragma_Warnings;
- -- We need to protect against a negative Total here, because
- -- if a pragma Compile_Time_Warning occurs in dead code, it
- -- gets counted in Compile_Time_Pragma_Warnings but not in
- -- Warnings_Detected.
- begin
- Total_Errors_Detected := Int'Max (Total, 0);
- Warnings_Detected := Compile_Time_Pragma_Warnings;
- end;
+ Total_Errors_Detected :=
+ Total_Errors_Detected
+ + Warnings_Detected
+ - Compile_Time_Pragma_Warnings;
+ Warnings_Detected := Compile_Time_Pragma_Warnings;
end if;
end Output_Messages;
-- Compile_Time_Warning pragma as an error. Warnings_Count is the sum
-- of both "normal" and Compile_Time_Warning warnings. This means that
-- there are only one or more non-Compile_Time_Warning warnings when
- -- Warnings_Count is greater than Count_Compile_Time_Pragma_Warnings.
+ -- Warnings_Count is greater than Compile_Time_Pragma_Warnings.
elsif Warning_Mode = Treat_As_Error
- and then Warnings_Count > Count_Compile_Time_Pragma_Warnings
+ and then Warnings_Count > Compile_Time_Pragma_Warnings
then
return True;
end if;
return False;
end Compilation_Errors;
- ----------------------------------------
- -- Count_Compile_Time_Pragma_Warnings --
- ----------------------------------------
-
- function Count_Compile_Time_Pragma_Warnings return Int is
- Result : Int := 0;
- begin
- for J in 1 .. Errors.Last loop
- begin
- if Errors.Table (J).Kind = Warning
- and then Errors.Table (J).Compile_Time_Pragma
- and then not Errors.Table (J).Deleted
- then
- Result := Result + 1;
- end if;
- end;
- end loop;
- return Result;
- end Count_Compile_Time_Pragma_Warnings;
-
------------------------------
-- Decrease_Error_Msg_Count --
------------------------------
Warnings_Treated_As_Errors := Warnings_Treated_As_Errors - 1;
end if;
+ if E.Compile_Time_Pragma then
+ Compile_Time_Pragma_Warnings :=
+ Compile_Time_Pragma_Warnings - 1;
+ end if;
+
when High_Check | Medium_Check | Low_Check =>
Check_Messages := Check_Messages - 1;
end loop;
end if;
+ if E.Compile_Time_Pragma then
+ Compile_Time_Pragma_Warnings :=
+ Compile_Time_Pragma_Warnings + 1;
+ end if;
+
when High_Check | Medium_Check | Low_Check =>
Check_Messages := Check_Messages + 1;
declare
Warnings_Count : constant Int := Warnings_Detected;
- Compile_Time_Warnings : Int;
- -- Number of warnings that come from a Compile_Time_Warning
- -- pragma.
-
Non_Compile_Time_Warnings : Int;
-- Number of warnings that do not come from a Compile_Time_Warning
-- pragmas.
Write_Char ('s');
end if;
- Compile_Time_Warnings := Count_Compile_Time_Pragma_Warnings;
Non_Compile_Time_Warnings :=
- Warnings_Count - Compile_Time_Warnings;
+ Warnings_Count - Compile_Time_Pragma_Warnings;
if Warning_Mode = Treat_As_Error
and then Non_Compile_Time_Warnings > 0
then
Write_Str (" (");
- if Compile_Time_Warnings > 0 then
+ if Compile_Time_Pragma_Warnings > 0 then
Write_Int (Non_Compile_Time_Warnings);
Write_Str (" ");
end if;
-- redundant. If so, the message to be deleted and all its continuations
-- are marked with the Deleted flag set to True.
- function Count_Compile_Time_Pragma_Warnings return Int;
- -- Returns the number of warnings in the Errors table that were triggered
- -- by a Compile_Time_Warning pragma.
-
function Get_Warning_Option (Id : Error_Msg_Id) return String;
-- Returns the warning switch causing this warning message or an empty
-- string is there is none..