re PR ada/34289 (gnatmake -s doesn't work)
authorBechir Zalila <bechir.zalila@gmail.com>
Fri, 7 Nov 2008 10:46:18 +0000 (10:46 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 7 Nov 2008 10:46:18 +0000 (10:46 +0000)
PR ada/34289
* lib.ads: (Enable_Switch_Storing): Declare.
* lib.adb: (Enable_Switch_Storing): New procedure.
* switch-c.adb (Scan_Front_End_Switches): Add support for -gnatea.
* make.adb: (Compile_Sources.Compile): Add -gnatea as first option.
(Display): Never display -gnatea
* gcc-interface/lang-specs.h: If -gnatea is present, pass -gnatez.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
From-SVN: r141673

gcc/ada/ChangeLog
gcc/ada/gcc-interface/lang-specs.h
gcc/ada/lib.adb
gcc/ada/lib.ads
gcc/ada/make.adb
gcc/ada/switch-c.adb

index 8dadc3d..8c340c1 100644 (file)
@@ -1,3 +1,14 @@
+2008-11-07  Bechir Zalila  <bechir.zalila@gmail.com>
+            Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR ada/34289
+       * lib.ads: (Enable_Switch_Storing): Declare.
+       * lib.adb: (Enable_Switch_Storing): New procedure.
+       * switch-c.adb (Scan_Front_End_Switches): Add support for -gnatea.
+       * make.adb: (Compile_Sources.Compile): Add -gnatea as first option.
+       (Display): Never display -gnatea
+       * gcc-interface/lang-specs.h: If -gnatea is present, pass -gnatez.
+
 2008-11-07  Thomas Quinot  <quinot@adacore.com>
 
        * gcc-interface/trans.c (Attribute_to_gnu, case Attr_Length): Check
index 65326d4..8e839a3 100644 (file)
@@ -35,7 +35,8 @@
  gnat1 %{I*} %{k8:-gnatk8} %{Wall:-gnatwa} %{w:-gnatws} %{!Q:-quiet}\
     %{nostdinc*} %{nostdlib*}\
     -dumpbase %{.adb:%b.adb}%{.ads:%b.ads}%{!.adb:%{!.ads:%b.ada}}\
-    %{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{f*} %{d*} %{g*&m*} "
+    %{O*} %{W*} %{w} %{p} %{pg:-p} %{a} %{f*} %{d*}\
+    %{gnatea:-gnatez} %{g*&m*} "
 #if defined(TARGET_VXWORKS_RTP)
    "%{fRTS=rtp:-mrtp} "
 #endif
index dd0e245..5271a45 100644 (file)
@@ -49,7 +49,7 @@ with Uname;   use Uname;
 package body Lib is
 
    Switch_Storing_Enabled : Boolean := True;
-   --  Set to False by Disable_Switch_Storing
+   --  Controlled by Enable_Switch_Storing/Disable_Switch_Storing
 
    -----------------------
    -- Local Subprograms --
@@ -433,6 +433,19 @@ package body Lib is
       return Compilation_Switches.Last;
    end Compilation_Switches_Last;
 
+   ---------------------------
+   -- Enable_Switch_Storing --
+   ---------------------------
+
+   procedure Enable_Switch_Storing is
+   begin
+      Switch_Storing_Enabled := True;
+   end Enable_Switch_Storing;
+
+   ----------------------------
+   -- Disable_Switch_Storing --
+   ----------------------------
+
    procedure Disable_Switch_Storing is
    begin
       Switch_Storing_Enabled := False;
index 672396e..0b2eefb 100644 (file)
@@ -562,9 +562,15 @@ package Lib is
    --  which may influence the generated output file(s). Switch is the text of
    --  the switch to store (except that -fRTS gets changed back to --RTS).
 
+   procedure Enable_Switch_Storing;
+   --  Enable registration of switches by Store_Compilation_Switch. Used to
+   --  avoid registering switches added automatically by the gcc driver at the
+   --  beginning of the command line.
+
    procedure Disable_Switch_Storing;
    --  Disable registration of switches by Store_Compilation_Switch. Used to
-   --  avoid registering switches added automatically by the gcc driver.
+   --  avoid registering switches added automatically by the gcc driver at the
+   --  end of the command line.
 
    procedure Store_Linker_Option_String (S : String_Id);
    --  This procedure is called to register the string from a pragma
index 20813c0..f79cbe5 100644 (file)
@@ -2947,7 +2947,7 @@ package body Make is
          Source_Index : Int;
          Args         : Argument_List) return Process_Id
       is
-         Comp_Args : Argument_List (Args'First .. Args'Last + 9);
+         Comp_Args : Argument_List (Args'First .. Args'Last + 10);
          Comp_Next : Integer := Args'First;
          Comp_Last : Integer;
          Arg_Index : Integer;
@@ -3004,6 +3004,9 @@ package body Make is
             end if;
          end loop;
 
+         Comp_Args (Comp_Next) := new String'("-gnatea");
+         Comp_Next := Comp_Next + 1;
+
          Comp_Args (Comp_Next) := Comp_Flag;
          Comp_Next := Comp_Next + 1;
 
@@ -4109,9 +4112,11 @@ package body Make is
 
          for J in Args'Range loop
 
-            --  Never display -gnatez
+            --  Never display -gnatea nor -gnatez
 
-            if Args (J).all /= "-gnatez" then
+            if Args (J).all /= "-gnatea" and then
+              Args (J).all /= "-gnatez"
+            then
 
                --  Do not display the mapping file argument automatically
                --  created when using a project file.
index 98f70f9..0da8f66 100644 (file)
@@ -301,6 +301,11 @@ package body Switch.C is
 
                case Switch_Chars (Ptr) is
 
+                  when 'a' =>
+                     Store_Switch := False;
+                     Enable_Switch_Storing;
+                     Ptr := Ptr + 1;
+
                   --  -gnatec (configuration pragmas)
 
                   when 'c' =>