diff mbox

[Ada] Warn if -gnateE specified and cannot be supported

Message ID 20130910151529.GA25819@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Sept. 10, 2013, 3:15 p.m. UTC
This implements a warning that is output if the switch -gnateE (Extra
Exception Information) is specified on the command line, and the
configuration in use does not support it (true of configurable
run-times with the restriction No_Exception_Handlers or
No_Exception_Propagation. If a trivial program like

     1. package q is
     2. end;

is compiled using the switch -gnateE in the presence of a system.ads
file that specifies Configurable_Run_Time to be True, and has the
restriction No_Exception_Handlers set, then the following lines
will be output:

warning: extra exception information (-gnateE) was specified
warning: this capability is not available in this configuration

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-09-10  Robert Dewar  <dewar@adacore.com>

	* gnat1drv.adb (Adjust_Global_Switches): Output warning if
	-gnateE specified for a target that does not support it.
diff mbox

Patch

Index: gnat1drv.adb
===================================================================
--- gnat1drv.adb	(revision 202451)
+++ gnat1drv.adb	(working copy)
@@ -242,7 +242,7 @@ 
 
          --  Enable assertions, since they give CodePeer valuable extra info
 
-         Assertions_Enabled    := True;
+         Assertions_Enabled := True;
 
          --  Disable all simple value propagation. This is an optimization
          --  which is valuable for code optimization, and also for generation
@@ -413,10 +413,10 @@ 
          --  which is more complex to formally verify than the original source.
 
          Tagged_Type_Expansion := False;
-
       end if;
 
-      --  Set Configurable_Run_Time mode if system.ads flag set
+      --  Set Configurable_Run_Time mode if system.ads flag set or if the
+      --  special debug flag -gnatdY is set.
 
       if Targparm.Configurable_Run_Time_On_Target or Debug_Flag_YY then
          Configurable_Run_Time_Mode := True;
@@ -571,6 +571,21 @@ 
          end if;
       end if;
 
+      --  Output warning if -gnateE specified and cannot be supported
+
+      if Exception_Extra_Info
+        and then Restrict.No_Exception_Handlers_Set
+      then
+         Set_Standard_Error;
+         Write_Str
+           ("warning: extra exception information (-gnateE) was specified");
+         Write_Eol;
+         Write_Str
+           ("warning: this capability is not available in this configuration");
+         Write_Eol;
+         Set_Standard_Output;
+      end if;
+
       --  Finally capture adjusted value of Suppress_Options as the initial
       --  value for Scope_Suppress, which will be modified as we move from
       --  scope to scope (by Suppress/Unsuppress/Overflow_Checks pragmas).