This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ada: Avoid Systematic recompilation of up-to-date objects under Darwin


Hi,

The patchfile below solves the problem of systematic recompilation of
Ada files when
giving "-s" to gnatmake under darwin (ppc and x86). More details on
this problem are
described in bug report 34289.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34289

---------------------------------------------------------------
2007-12-03  Bechir Zalila  <bechir.zalila@gmail.com>

        * switch-c.adb (Scan_Front_End_Switches): New switch -gnatea. Should
	always be the first switch to the gcc driver. Enable switch storing so
	that switches automatically added by the gcc driver at the beginning
	of the switch list are not put in the ALI file.

	* make.adb: (Compile_Sources.Compile): Add switch -gnatea as the first
	option.
	(Display): Never display -gnatea

	* lib.adb: (Switch_Storing_Enabled): initialized to False
	(Enable_Switch_Storing): New procedure. Set Switch_Storing_Enabled
	to True.

	* lib.ads: (Enable_Switch_Storing): New procedure.

	* lang-specs.h: surround the non-(g*&m*) switches we want to register
	by -gnatea and -gnatez

=============================================================================
Index: ada/lib.adb
===================================================================
--- ada/lib.adb	(revision 130534)
+++ ada/lib.adb	(working copy)
@@ -48,8 +48,8 @@

 package body Lib is

-   Switch_Storing_Enabled : Boolean := True;
-   --  Set to False by Disable_Switch_Storing
+   Switch_Storing_Enabled : Boolean := False;
+   --  Controlled by Enable_Switch_Storing/Disable_Switch_Storing

    -----------------------
    -- Local Subprograms --
@@ -423,6 +423,19 @@
       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: ada/lib.ads
===================================================================
--- ada/lib.ads	(revision 130534)
+++ ada/lib.ads	(working copy)
@@ -556,9 +556,15 @@
    --  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: ada/switch-c.adb
===================================================================
--- ada/switch-c.adb	(revision 130534)
+++ ada/switch-c.adb	(working copy)
@@ -295,6 +295,11 @@

                case Switch_Chars (Ptr) is

+                  when 'a' =>
+                     Store_Switch := False;
+                     Enable_Switch_Storing;
+                     Ptr := Ptr + 1;
+
                   --  -gnatec (configuration pragmas)

                   when 'c' =>
Index: ada/make.adb
===================================================================
--- ada/make.adb	(revision 130534)
+++ ada/make.adb	(working copy)
@@ -2885,7 +2885,7 @@
          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;
@@ -2942,6 +2942,9 @@
             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;

@@ -4022,9 +4025,11 @@

          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: ada/lang-specs.h
===================================================================
--- ada/lang-specs.h	(revision 130534)
+++ ada/lang-specs.h	(working copy)
@@ -32,10 +32,10 @@
    "\
  %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  %{!S:%{!c:%e-c or -S required for Ada}}\
- gnat1 %{I*} %{k8:-gnatk8} %{w:-gnatws} %{!Q:-quiet} %{nostdinc*}\
+ gnat1 -gnatea %{I*} %{k8:-gnatk8} %{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*} -gnatez %{g*&m*} "
 #if defined(TARGET_VXWORKS_RTP)
    "%{fRTS=rtp:-mrtp} "
 #endif

-- 
Bechir Zalila


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]