]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 4 Aug 2011 12:18:16 +0000 (14:18 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 4 Aug 2011 12:18:16 +0000 (14:18 +0200)
2011-08-04  Arnaud Charlet  <charlet@adacore.com>

* make.adb (Do_Codepeer_Globalize_Step): Removed. Use CodePeer_Mode
instead.
(CodePeer_Mode_String): New.
(Linking_Phase, Binding_Phase): Call gnatlink with -P switch in
CodePeer mode.
(Scan_Make_Arg): Do not disable binding/linking phase in CodePeer mode.
* bindgen.adb (Gen_Elab_Calls_Ada): Ignore subprograms in CodePeer
mode, since no useful elaboration subprogram is needed by CodePeer.
* gnatlink.adb (Gnatlink): Add support for -P switch (CodePeer mode).
In this mode, compile binder file with -gnatC and do stop after this
step.

2011-08-04  Vincent Celier  <celier@adacore.com>

* exp_ch7.adb: Minor comment fix.

From-SVN: r177366

gcc/ada/ChangeLog
gcc/ada/bindgen.adb
gcc/ada/exp_ch7.adb
gcc/ada/gnatlink.adb
gcc/ada/make.adb

index 93cd8d660baa4f1e9b0036cb33028ab3c4b6b30b..62e4eaa7d7e8bd25b6e3b87d3ec624f40e3a3693 100644 (file)
@@ -1,3 +1,21 @@
+2011-08-04  Arnaud Charlet  <charlet@adacore.com>
+
+       * make.adb (Do_Codepeer_Globalize_Step): Removed. Use CodePeer_Mode
+       instead.
+       (CodePeer_Mode_String): New.
+       (Linking_Phase, Binding_Phase): Call gnatlink with -P switch in
+       CodePeer mode.
+       (Scan_Make_Arg): Do not disable binding/linking phase in CodePeer mode.
+       * bindgen.adb (Gen_Elab_Calls_Ada): Ignore subprograms in CodePeer
+       mode, since no useful elaboration subprogram is needed by CodePeer.
+       * gnatlink.adb (Gnatlink): Add support for -P switch (CodePeer mode).
+       In this mode, compile binder file with -gnatC and do stop after this
+       step.
+
+2011-08-04  Vincent Celier  <celier@adacore.com>
+
+       * exp_ch7.adb: Minor comment fix.
+
 2011-08-04  Robert Dewar  <dewar@adacore.com>
 
        * exp_ch7.adb, make.adb, sem_ch10.adb, bindgen.adb, sem_res.adb,
index aee3bddcd2c3f6fe651d04fb6995e01bbba66011..0da8a3a41ad044a52910b550f63a55f3bc8eb226 100644 (file)
@@ -1423,7 +1423,10 @@ package body Bindgen is
             --  The uname_E increment is skipped if this is a separate spec,
             --  since it will be done when we process the body.
 
-            else
+            --  Ignore subprograms in CodePeer mode, since no useful
+            --  elaboration subprogram is needed by CodePeer.
+
+            elsif U.Unit_Kind /= 's' or else not CodePeer_Mode then
                if Force_Checking_Of_Elaboration_Flags
                  or Interface_Library_Unit
                  or not Bind_Main_Program
index 0c570f61b77fcc260a58aa8c4de1d685ba43ba97..5dad689c1f0a2f4d35a075c5ef13388b05476fe9 100644 (file)
@@ -4079,7 +4079,7 @@ package body Exp_Ch7 is
    function Get_Global_Pool_For_Access_Type (T : Entity_Id) return Entity_Id is
    begin
       --  Access types whose size is smaller than System.Address size can
-      --  exit only on VMS. We can't use the usual global pool which returns
+      --  exist only on VMS. We can't use the usual global pool which returns
       --  an object of type Address as truncation will make it invalid.
       --  To handle this case, VMS has a dedicated global pool that returns
       --  addresses that fit into 32 bit accesses.
index 0b5d681b376cdb8b9b80e00ed13d0376f9494256..6a0a34e78ffaa4c84f944e1e433caef3e5efe3a5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1996-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1996-2011, 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- --
@@ -479,6 +479,9 @@ procedure Gnatlink is
                                         (Argument (Next_Arg),
                                          Only_If_No_Suffix => True));
 
+                     when 'P' =>
+                        Opt.CodePeer_Mode := True;
+
                      when 'R' =>
                         Opt.Run_Path_Option := False;
 
@@ -1441,12 +1444,13 @@ procedure Gnatlink is
       Write_Eol;
       Write_Line ("  mainprog.ali   the ALI file of the main program");
       Write_Eol;
-      Write_Line ("  -f    force object file list to be generated");
+      Write_Line ("  -f    Force object file list to be generated");
       Write_Line ("  -g    Compile binder source file with debug information");
       Write_Line ("  -n    Do not compile the binder source file");
+      Write_Line ("  -P    Process files for use by CodePeer");
       Write_Line ("  -R    Do not use a run_path_option");
-      Write_Line ("  -v    verbose mode");
-      Write_Line ("  -v -v very verbose mode");
+      Write_Line ("  -v    Verbose mode");
+      Write_Line ("  -v -v Very verbose mode");
       Write_Eol;
       Write_Line ("  -o nam     Use 'nam' as the name of the executable");
       Write_Line ("  -b target  Compile the binder source to run on target");
@@ -1675,6 +1679,8 @@ begin
    --             because bindgen uses brackets encoding for all upper
    --             half and wide characters in identifier names.
 
+   --  In addition, in CodePeer mode compile with -gnatC
+
    if Ada_Bind_File then
       Binder_Options_From_ALI.Increment_Last;
       Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
@@ -1685,6 +1691,12 @@ begin
       Binder_Options_From_ALI.Increment_Last;
       Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
         new String'("-gnatiw");
+
+      if Opt.CodePeer_Mode then
+         Binder_Options_From_ALI.Increment_Last;
+         Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
+           new String'("-gnatC");
+      end if;
    end if;
 
    --  Locate all the necessary programs and verify required files are present
@@ -1888,6 +1900,13 @@ begin
       end Bind_Step;
    end if;
 
+   --  In CodePeer mode, there's nothing left to do after the binder file has
+   --  been compiled.
+
+   if Opt.CodePeer_Mode then
+      return;
+   end if;
+
    --  Now, actually link the program
 
    --  Skip this step for now on JVM since the Java interpreter will do
index 29e06b5467a91fc38dfb2b9f4b433c0474131d56..a86846b7d4e093925bdcb2502ec2945c49c422fc 100644 (file)
@@ -386,11 +386,9 @@ package body Make is
    --  with the switches -c, -b and -l. These flags are reset to True for
    --  each invocation of procedure Gnatmake.
 
-   Do_Codepeer_Globalize_Step : Boolean := False;
-   --  Flag to indicate whether the CodePeer globalizer should be called
-
    Shared_String           : aliased String := "-shared";
    Force_Elab_Flags_String : aliased String := "-F";
+   CodePeer_Mode_String    : aliased String := "-P";
 
    No_Shared_Switch : aliased Argument_List := (1 .. 0 => null);
    Shared_Switch    : aliased Argument_List := (1 => Shared_String'Access);
@@ -2927,7 +2925,7 @@ package body Make is
             then
                --  If we compile with -gnatC, enable CodePeer globalize step
 
-               Do_Codepeer_Globalize_Step := True;
+               CodePeer_Mode := True;
             end if;
          end loop;
 
@@ -2968,7 +2966,7 @@ package body Make is
                declare
                   Str : String renames Args (Arg_Index).all;
                begin
-                  if Do_Codepeer_Globalize_Step
+                  if CodePeer_Mode
                     and then Str'Length > 2
                     and then Str (Str'First .. Str'First + 1) = "-m"
                   then
@@ -4399,7 +4397,13 @@ package body Make is
          end;
       end if;
 
-      --  Add switch -M to gnatlink if buider switch --create-map-file
+      if CodePeer_Mode then
+         Linker_Switches.Increment_Last;
+         Linker_Switches.Table (Linker_Switches.Last) :=
+           new String'(CodePeer_Mode_String);
+      end if;
+
+      --  Add switch -M to gnatlink if builder switch --create-map-file
       --  has been specified.
 
       if Map_File /= null then
@@ -4560,6 +4564,11 @@ package body Make is
          Args (Last_Arg) := Force_Elab_Flags_String'Access;
       end if;
 
+      if CodePeer_Mode then
+         Last_Arg := Last_Arg + 1;
+         Args (Last_Arg) := CodePeer_Mode_String'Access;
+      end if;
+
       if Main_Project /= No_Project then
 
          --  Put all the source directories in ADA_INCLUDE_PATH,
@@ -6313,10 +6322,9 @@ package body Make is
          end if;
       end loop Multiple_Main_Loop;
 
-      if Do_Codepeer_Globalize_Step then
+      if CodePeer_Mode then
          declare
             Success : Boolean := False;
-
          begin
             Globalize (Success);
 
@@ -7962,9 +7970,14 @@ package body Make is
             Add_Switch (Argv, Compiler, And_Save => And_Save);
             Operating_Mode           := Check_Semantics;
             Check_Object_Consistency := False;
-            Compile_Only             := True;
-            Do_Bind_Step             := False;
-            Do_Link_Step             := False;
+
+            if not CodePeer_Mode
+              and then (Argv'Last < 7 or else Argv (7) /= 'C')
+            then
+               Compile_Only := True;
+               Do_Bind_Step := False;
+               Do_Link_Step := False;
+            end if;
 
          elsif Argv (2 .. Argv'Last) = "nostdlib" then