===================================================================
@@ -488,6 +488,7 @@
Write_Line (" e treat all warnings (but not info) as errors");
Write_Line (" .e turn on every optional info/warning " &
"(no exceptions)");
+ Write_Line (" E treat all run time warnings as errors");
Write_Line (" f+ turn on warnings for unreferenced formal");
Write_Line (" F* turn off warnings for unreferenced formal");
Write_Line (" .f turn on warnings for suspicious Subp'Access");
===================================================================
@@ -532,6 +532,9 @@
when 'e' =>
Warning_Mode := Treat_As_Error;
+ when 'E' =>
+ Warning_Mode := Treat_Run_Time_As_Error;
+
when 'f' =>
Check_Unreferenced_Formals := True;
===================================================================
@@ -3097,6 +3097,17 @@
-- '[' (will be/would have been raised at run time)
when '[' =>
+
+ -- Switch the message from a warning to an error if the flag
+ -- -gnatwE is specified to treat run-time exception warnings
+ -- as errors.
+
+ if Is_Warning_Msg
+ and then Warning_Mode = Treat_Run_Time_As_Error
+ then
+ Is_Warning_Msg := False;
+ end if;
+
if Is_Warning_Msg then
Set_Msg_Str ("will be raised at run time");
else
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2001-2017, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -490,6 +490,9 @@
when 'e' =>
Warning_Mode := Treat_As_Error;
+ when 'E' =>
+ Warning_Mode := Treat_Run_Time_As_Error;
+
when 's' =>
Warning_Mode := Suppress;
===================================================================
@@ -1860,16 +1860,19 @@
-- or where no warning has been suppressed by the use of the pragma.
-- Modified by use of -gnatw.w/.W.
- type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
+ type Warning_Mode_Type is
+ (Suppress, Normal, Treat_As_Error, Treat_Run_Time_As_Error);
Warning_Mode : Warning_Mode_Type := Normal;
-- GNAT, GNATBIND
-- Controls treatment of warning messages. If set to Suppress, warning
-- messages are not generated at all. In Normal mode, they are generated
-- but do not count as errors. In Treat_As_Error mode, warning messages are
- -- generated and are treated as errors. Note that Warning_Mode = Suppress
- -- causes pragma Warnings to be ignored (except for legality checks),
- -- unless we are in GNATprove_Mode, which requires pragma Warnings to
- -- be stored for the formal verification backend.
+ -- generated and are treated as errors. In Treat_Run_Time_As_Error, warning
+ -- messages regarding errors raised at run time are treated as errors. Note
+ -- that Warning_Mode = Suppress causes pragma Warnings to be ignored
+ -- (except for legality checks), unless we are in GNATprove_Mode, which
+ -- requires pragma Warnings to be stored for the formal verification
+ -- backend.
Warnings_As_Errors_Count : Natural;
-- GNAT