OSDN Git Service

2006-10-31 Arnaud Charlet <charlet@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 Oct 2006 17:59:45 +0000 (17:59 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 Oct 2006 17:59:45 +0000 (17:59 +0000)
    Robert Dewar  <dewar@adacore.com>

* gnatcmd.adb (Process_Link): Use Osint.Executable_Name instead of
handling executable extension manually and duplicating code.

* make.adb: Implement new -S switch
(Gnatmake): Use new function Osint.Executable_Name instead
of handling executable extension manually.

* prj-util.adb (Executable_Of): Make sure that if an Executable_Suffix
is specified, the executable name ends with this suffix.
Take advantage of Osint.Executable_Name instead of duplicating code.

* switch-m.adb: Recognize new gnatmake -S switch

* targparm.ads, targparm.adb (Executable_Extension_On_Target): New
variable.
(Get_Target_Parameters): Set Executable_Extension_On_Target if
available.

* makeusg.adb: Add line for gnatmake -S switch

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118276 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/gnatcmd.adb
gcc/ada/make.adb
gcc/ada/makeusg.adb
gcc/ada/prj-util.adb
gcc/ada/switch-m.adb
gcc/ada/targparm.adb
gcc/ada/targparm.ads

index 628a11a..8eb1563 100644 (file)
@@ -871,8 +871,8 @@ procedure GNATCmd is
                   Last_Switches.Table (Last_Switches.Last) :=
                     new String'(Name_Buffer (1 .. Name_Len) &
                                 Directory_Separator &
-                                Base_Name (Arg (Arg'First .. Last)) &
-                                Get_Executable_Suffix.all);
+                                Executable_Name
+                                  (Base_Name (Arg (Arg'First .. Last))));
                   exit;
                end if;
             end if;
index 341a7af..d24cc9f 100644 (file)
@@ -88,20 +88,20 @@ package body Make is
    -- Note on terminology --
    -------------------------
 
-   --  In this program, we use the phrase "termination" of a file name to
-   --  refer to the suffix that appears after the unit name portion. Very
-   --  often this is simply the extension, but in some cases, the sequence
-   --  may be more complex, for example in main.1.ada, the termination in
-   --  this name is ".1.ada" and in main_.ada the termination is "_.ada".
+   --  In this program, we use the phrase "termination" of a file name to refer
+   --  to the suffix that appears after the unit name portion. Very often this
+   --  is simply the extension, but in some cases, the sequence may be more
+   --  complex, for example in main.1.ada, the termination in this name is
+   --  ".1.ada" and in main_.ada the termination is "_.ada".
 
    -------------------------------------
    -- Queue (Q) Manipulation Routines --
    -------------------------------------
 
-   --  The Q is used in Compile_Sources below. Its implementation uses the
-   --  GNAT generic package Table (basically an extensible array). Q_Front
-   --  points to the first valid element in the Q, whereas Q.First is the first
-   --  element ever enqueued, while Q.Last - 1 is the last element in the Q.
+   --  The Q is used in Compile_Sources below. Its implementation uses the GNAT
+   --  generic package Table (basically an extensible array). Q_Front points to
+   --  the first valid element in the Q, whereas Q.First is the first element
+   --  ever enqueued, while Q.Last - 1 is the last element in the Q.
    --
    --        +---+--------------+---+---+---+-----------+---+--------
    --    Q   |   |  ........    |   |   |   | .......   |   |
@@ -109,14 +109,14 @@ package body Make is
    --          ^                  ^                       ^
    --       Q.First             Q_Front               Q.Last - 1
    --
-   --  The elements comprised between Q.First and Q_Front - 1 are the
-   --  elements that have been enqueued and then dequeued, while the
-   --  elements between Q_Front and Q.Last - 1 are the elements currently
-   --  in the Q. When the Q is initialized Q_Front = Q.First = Q.Last.
-   --  After Compile_Sources has terminated its execution, Q_Front = Q.Last
-   --  and the elements contained between Q.Front and Q.Last-1 are those that
-   --  were explored and thus marked by Compile_Sources. Whenever the Q is
-   --  reinitialized, the elements between Q.First and Q.Last - 1 are unmarked.
+   --  The elements comprised between Q.First and Q_Front - 1 are the elements
+   --  that have been enqueued and then dequeued, while the elements between
+   --  Q_Front and Q.Last - 1 are the elements currently in the Q. When the Q
+   --  is initialized Q_Front = Q.First = Q.Last. After Compile_Sources has
+   --  terminated its execution, Q_Front = Q.Last and the elements contained
+   --  between Q.Front and Q.Last-1 are those that were explored and thus
+   --  marked by Compile_Sources. Whenever the Q is reinitialized, the elements
+   --  between Q.First and Q.Last - 1 are unmarked.
 
    procedure Init_Q;
    --  Must be called to (re)initialize the Q
@@ -305,9 +305,9 @@ package body Make is
    procedure Add_Library_Search_Dir
      (Path            : String;
       On_Command_Line : Boolean);
-   --  Call Add_Lib_Search_Dir with an absolute directory path. If Path is a
+   --  Call Add_Lib_Search_Dir with an absolute directory path. If Path is
    --  relative path, when On_Command_Line is True, it is relative to the
-   --  current working directory; when On_Command_Line is False, it is relative
+   --  current working directory. When On_Command_Line is False, it is relative
    --  to the project directory of the main project.
 
    procedure Add_Source_Search_Dir
@@ -315,7 +315,7 @@ package body Make is
       On_Command_Line : Boolean);
    --  Call Add_Src_Search_Dir with an absolute directory path. If Path is a
    --  relative path, when On_Command_Line is True, it is relative to the
-   --  current working directory; when On_Command_Line is False, it is relative
+   --  current working directory. When On_Command_Line is False, it is relative
    --  to the project directory of the main project.
 
    procedure Add_Source_Dir (N : String);
@@ -356,9 +356,9 @@ package body Make is
    Do_Compile_Step : Boolean := True;
    Do_Bind_Step    : Boolean := True;
    Do_Link_Step    : Boolean := True;
-   --  Flags to indicate what step should be executed.
-   --  Can be set to False with the switches -c, -b and -l.
-   --  These flags are reset to True for each invokation of procedure Gnatmake.
+   --  Flags to indicate what step should be executed. Can be set to False
+   --  with the switches -c, -b and -l. These flags are reset to True for
+   --  each invokation of procedure Gnatmake.
 
    Shared_String           : aliased String := "-shared";
    Force_Elab_Flags_String : aliased String := "-F";
@@ -628,14 +628,14 @@ package body Make is
    GNAT_Flag         : constant String_Access := new String'("-gnatpg");
    Do_Not_Check_Flag : constant String_Access := new String'("-x");
 
-   Object_Suffix     : constant String := Get_Target_Object_Suffix.all;
-   Executable_Suffix : constant String := Get_Target_Executable_Suffix.all;
+   Object_Suffix : constant String := Get_Target_Object_Suffix.all;
 
    Syntax_Only : Boolean := False;
    --  Set to True when compiling with -gnats
 
    Display_Executed_Programs : Boolean := True;
-   --  Set to True if name of commands should be output on stderr
+   --  Set to True if name of commands should be output on stderr (or on stdout
+   --  if the Commands_To_Stdout flag was set by use of the -S switch).
 
    Output_File_Name_Seen : Boolean := False;
    --  Set to True after having scanned the file_name for
@@ -1457,11 +1457,10 @@ package body Make is
 
                --  Comparing switches is delicate because gcc reorders a number
                --  of switches, according to lang-specs.h, but gnatmake doesn't
-               --  have the sufficient knowledge to perform the same
-               --  reordering. Instead, we ignore orders between different
-               --  "first letter" switches, but keep orders between same
-               --  switches, e.g -O -O2 is different than -O2 -O, but -g -O is
-               --  equivalent to -O -g.
+               --  have sufficient knowledge to perform the same reordering.
+               --  Instead, we ignore orders between different "first letter"
+               --  switches, but keep orders between same switches, e.g -O -O2
+               --  is different than -O2 -O, but -g -O is equivalent to -O -g.
 
                if Switches_To_Check.Table (J) (2) /= Prev_Switch (2) or else
                    (Prev_Switch'Length >= 6 and then
@@ -3482,6 +3481,10 @@ package body Make is
       pragma Assert (Args'First = 1);
 
       if Display_Executed_Programs then
+         if Commands_To_Stdout then
+            Set_Standard_Output;
+         end if;
+
          Write_Str (Program);
 
          for J in Args'Range loop
@@ -3529,6 +3532,7 @@ package body Make is
          end loop;
 
          Write_Eol;
+         Set_Standard_Error;
       end if;
    end Display;
 
@@ -4326,6 +4330,17 @@ package body Make is
 
             Osint.Add_Default_Search_Dirs;
 
+            --  Get the target parameters, so that the correct binder generated
+            --  files are generated if OpenVMS is the target.
+
+            begin
+               Targparm.Get_Target_Parameters;
+
+            exception
+               when Unrecoverable_Error =>
+                  Make_Failed ("*** make failed.");
+            end;
+
             --  And bind and or link the library
 
             MLib.Prj.Build_Library
@@ -4875,7 +4890,8 @@ package body Make is
 
          Executable          := No_File;
          Executable_Obsolete := False;
-         Non_Std_Executable  := False;
+         Non_Std_Executable  :=
+           Targparm.Executable_Extension_On_Target /= No_Name;
 
          --  Look inside the linker switches to see if the name
          --  of the final executable program was specified.
@@ -6212,8 +6228,7 @@ package body Make is
             Project_Tree.Projects.Table (Proj).Depth := 0;
          end loop;
 
-         Recursive_Compute_Depth
-           (Main_Project, Depth => 1);
+         Recursive_Compute_Depth (Main_Project, Depth => 1);
 
          --  For each project compute the list of the projects it imports
          --  directly or indirectly.
@@ -6228,10 +6243,10 @@ package body Make is
 
          Osint.Add_Default_Search_Dirs;
 
-         --  Source file lookups should be cached for efficiency.
-         --  Source files are not supposed to change. However, we do that now
-         --  only if no project file is used; if a project file is used, we
-         --  do it just after changing the directory to the object directory.
+         --  Source file lookups should be cached for efficiency. Source files
+         --  are not supposed to change. However, we do that now only if no
+         --  project file is used; if a project file is used, we do it just
+         --  after changing the directory to the object directory.
 
          Osint.Source_File_Data (Cache => True);
 
@@ -6272,8 +6287,7 @@ package body Make is
                       (The_Project).Extends /= No_Project;
 
       function Check_Project (P : Project_Id) return Boolean;
-      --  Returns True if P is The_Project or a project extended by
-      --  The_Project.
+      --  Returns True if P is The_Project or a project extended by The_Project
 
       -------------------
       -- Check_Project --
@@ -6283,6 +6297,7 @@ package body Make is
       begin
          if All_Projects or P = The_Project then
             return True;
+
          elsif Extending then
             declare
                Data : Project_Data :=
@@ -6333,8 +6348,9 @@ package body Make is
 
                      --  Here we are cheating a little bit: we don't want to
                      --  use Sinput.L, because it depends on the GNAT tree
-                     --  (Atree, Sinfo, ...). So, we pretend that it is
-                     --  a project file, and we use Sinput.P.
+                     --  (Atree, Sinfo, ...). So, we pretend that it is a
+                     --  project file, and we use Sinput.P.
+
                      --  Source_File_Is_Subunit is just scanning through
                      --  the file until it finds one of the reserved words
                      --  separate, procedure, function, generic or package.
@@ -6350,7 +6366,6 @@ package body Make is
 
                      if Sinput.P.Source_File_Is_Subunit (Src_Ind) then
                         Sfile := No_Name;
-
                      else
                         Sfile := Unit.File_Names (Body_Part).Name;
                      end if;
@@ -6376,15 +6391,15 @@ package body Make is
 
          if Put_In_Q then
 
-            --  For the first source inserted into the Q, we need
-            --  to initialize the Q, but not for the subsequent sources.
+            --  For the first source inserted into the Q, we need to initialize
+            --  the Q, but not for the subsequent sources.
 
             if First_Q_Initialization then
                Init_Q;
             end if;
 
-            --  And of course, we only insert in the Q if the source
-            --  is not marked.
+            --  And of course, we only insert in the Q if the source is not
+            --  marked.
 
             if Sfile /= No_Name and then not Is_Marked (Sfile) then
                if Verbose_Mode then
@@ -6399,11 +6414,10 @@ package body Make is
 
          elsif Sfile /= No_Name then
 
-            --  If Put_In_Q is False, we add the source as it it were
-            --  specified on the command line, and we set Put_In_Q to True,
-            --  so that the following sources will be put directly in the
-            --  queue. This will allow parallel compilation processes if -jx
-            --  switch is used.
+            --  If Put_In_Q is False, we add the source as it it were specified
+            --  on the command line, and we set Put_In_Q to True, so that the
+            --  following sources will be put directly in the queue. This will
+            --  allow parallel compilation processes if -jx switch is used.
 
             if Verbose_Mode then
                Write_Str ("Adding """);
@@ -6786,8 +6800,7 @@ package body Make is
 
       Project_Tree.Projects.Table (Project).Depth := Depth;
 
-      --  Mark the project as Seen to avoid endless loop caused by limited
-      --  withs.
+      --  Mark project as Seen to avoid endless loop caused by limited withs
 
       Project_Tree.Projects.Table (Project).Seen := True;
 
@@ -6837,9 +6850,9 @@ package body Make is
          return;
       end if;
 
-      --  If the previous switch has set the Project_File_Name_Present
-      --  flag (that is we have seen a -P alone), then the next argument is
-      --  the name of the project file.
+      --  If the previous switch has set the Project_File_Name_Present flag
+      --  (that is we have seen a -P alone), then the next argument is the name
+      --  of the project file.
 
       if Project_File_Name_Present and then Project_File_Name = null then
          if Argv (1) = '-' then
@@ -6850,9 +6863,9 @@ package body Make is
             Project_File_Name := new String'(Argv);
          end if;
 
-      --  If the previous switch has set the Output_File_Name_Present
-      --  flag (that is we have seen a -o), then the next argument is
-      --  the name of the output executable.
+      --  If the previous switch has set the Output_File_Name_Present flag
+      --  (that is we have seen a -o), then the next argument is the name of
+      --  the output executable.
 
       elsif Output_File_Name_Present
         and then not Output_File_Name_Seen
@@ -6864,39 +6877,12 @@ package body Make is
 
          else
             Add_Switch ("-o", Linker, And_Save => And_Save);
-
-            --  Automatically add the executable suffix if it has not been
-            --  specified explicitly.
-
-            declare
-               Canonical_Argv : String := Argv;
-            begin
-               --  Get the file name in canonical case to accept as is
-               --  names ending with ".EXE" on VMS and Windows.
-
-               Canonical_Case_File_Name (Canonical_Argv);
-
-               if Executable_Suffix'Length /= 0
-                 and then (Canonical_Argv'Length <= Executable_Suffix'Length
-                        or else Canonical_Argv
-                                  (Canonical_Argv'Last -
-                                   Executable_Suffix'Length + 1
-                                   .. Canonical_Argv'Last)
-                                /= Executable_Suffix)
-               then
-                  Add_Switch
-                    (Argv & Executable_Suffix,
-                     Linker,
-                     And_Save => And_Save);
-               else
-                  Add_Switch (Argv, Linker, And_Save => And_Save);
-               end if;
-            end;
+            Add_Switch (Executable_Name (Argv), Linker, And_Save => And_Save);
          end if;
 
       --  If the previous switch has set the Object_Directory_Present flag
-      --  (that is we have seen a -D), then the next argument is
-      --  the path name of the object directory..
+      --  (that is we have seen a -D), then the next argument is the path name
+      --  of the object directory..
 
       elsif Object_Directory_Present
         and then not Object_Directory_Seen
@@ -6920,8 +6906,8 @@ package body Make is
             --  separator.
 
             if Argv (Argv'Last) = Directory_Separator then
-               Object_Directory_Path := new String'(Argv);
-
+               Object_Directory_Path :=
+                 new String'(Argv);
             else
                Object_Directory_Path :=
                  new String'(Argv & Directory_Separator);
@@ -7084,18 +7070,19 @@ package body Make is
                                       (Argv (7 .. Argv'Last), Objects);
 
                begin
-                  if Src_Path_Name /= null and then
-                    Lib_Path_Name /= null
+                  if Src_Path_Name /= null
+                    and then Lib_Path_Name /= null
                   then
-                     --  Set the RTS_*_Path_Name variables, so that the correct
-                     --  directories will be set when
-                     --  Osint.Add_Default_Search_Dirs will be called later.
+                     --  Set RTS_*_Path_Name variables, so that correct direct-
+                     --  ories will be set when Osint.Add_Default_Search_Dirs
+                     --  is called later.
 
                      RTS_Src_Path_Name := Src_Path_Name;
                      RTS_Lib_Path_Name := Lib_Path_Name;
 
                   elsif  Src_Path_Name = null
-                    and Lib_Path_Name = null then
+                    and Lib_Path_Name = null
+                  then
                      Make_Failed ("RTS path not valid: missing " &
                                   "adainclude and adalib directories");
 
@@ -7378,18 +7365,18 @@ package body Make is
             Add_Switch (Argv, Compiler, And_Save => And_Save);
             Add_Switch (Argv, Binder, And_Save => And_Save);
 
-            --  By default all switches with more than one character
-            --  or one character switches which are not in 'a' .. 'z'
-            --  (except 'C', 'F', 'M' and 'B') are passed to the compiler,
-            --  unless we are dealing with a debug switch (starts with 'd')
-            --  or an extended gnatmake switch (starts with 'e').
+            --  By default all switches with more than one character or one
+            --  character switches are passed to the compiler with the
+            --  exception of those tested below, which belong to make.
 
          elsif Argv (2) /= 'd'
            and then Argv (2) /= 'e'
+           and then Argv (2 .. Argv'Last) /= "B"
            and then Argv (2 .. Argv'Last) /= "C"
            and then Argv (2 .. Argv'Last) /= "F"
            and then Argv (2 .. Argv'Last) /= "M"
-           and then Argv (2 .. Argv'Last) /= "B"
+           and then Argv (2 .. Argv'Last) /= "R"
+           and then Argv (2 .. Argv'Last) /= "S"
            and then Argv (2 .. Argv'Last) /= "vl"
            and then Argv (2 .. Argv'Last) /= "vm"
            and then Argv (2 .. Argv'Last) /= "vh"
index e01272d..5dc0604 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2006, 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- --
@@ -171,9 +171,13 @@ begin
    Write_Str ("  -s       Recompile if compiler switches have changed");
    Write_Eol;
 
+   --  Line for -S
+
+   Write_Str ("  -S       Echo commands to stdout instead of stderr");
+
    --  Line for -u
 
-   Write_Str ("  -u       Unique compilation. Only compile the given files.");
+   Write_Str ("  -u       Unique compilation, only compile the given files");
    Write_Eol;
 
    --  Line for -U
index efc0a68..845b546 100644 (file)
@@ -33,6 +33,7 @@ with Osint;    use Osint;
 with Output;   use Output;
 with Prj.Com;
 with Snames;   use Snames;
+with Targparm; use Targparm;
 
 package body Prj.Util is
 
@@ -99,14 +100,7 @@ package body Prj.Util is
                         In_Package              => Builder_Package,
                         In_Tree                 => In_Tree);
 
-      Executable_Suffix : constant Variable_Value :=
-                            Prj.Util.Value_Of
-                              (Name                    => Main,
-                               Index                   => 0,
-                               Attribute_Or_Array_Name =>
-                                 Name_Executable_Suffix,
-                               In_Package              => Builder_Package,
-                               In_Tree                 => In_Tree);
+      Executable_Suffix : Variable_Value := Nil_Variable_Value;
 
       Body_Append : constant String := Get_Name_String
                                           (In_Tree.Projects.Table
@@ -120,6 +114,12 @@ package body Prj.Util is
 
    begin
       if Builder_Package /= No_Package then
+         Executable_Suffix := Prj.Util.Value_Of
+           (Variable_Name => Name_Executable_Suffix,
+            In_Variables  => In_Tree.Packages.Table
+              (Builder_Package).Decl.Attributes,
+            In_Tree       => In_Tree);
+
          if Executable = Nil_Variable_Value and Ada_Main then
             Get_Name_String (Main);
 
@@ -179,39 +179,22 @@ package body Prj.Util is
          if Executable /= Nil_Variable_Value
            and then Executable.Value /= Empty_Name
          then
+            --  Get the executable name. If Executable_Suffix is defined,
+            --  make sure that it will be the extension of the executable.
+
             declare
-               Exec_Suffix : String_Access := Get_Executable_Suffix;
-               Result      : Name_Id := Executable.Value;
+               Saved_EEOT : constant Name_Id := Executable_Extension_On_Target;
+               Result     : Name_Id;
 
             begin
-               if Exec_Suffix'Length /= 0 then
-                  Get_Name_String (Executable.Value);
-                  Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
-
-                  --  If the Executable does not end with the executable
-                  --  suffix, add it.
-
-                  if Name_Len <= Exec_Suffix'Length
-                    or else
-                      Name_Buffer
-                        (Name_Len - Exec_Suffix'Length + 1 .. Name_Len) /=
-                                                               Exec_Suffix.all
-                  then
-                     --  Get the original Executable to keep the correct
-                     --  case for systems where file names are case
-                     --  insensitive (Windows).
-
-                     Get_Name_String (Executable.Value);
-                     Name_Buffer
-                       (Name_Len + 1 .. Name_Len + Exec_Suffix'Length) :=
-                       Exec_Suffix.all;
-                     Name_Len := Name_Len + Exec_Suffix'Length;
-                     Result := Name_Find;
-                  end if;
-
-                  Free (Exec_Suffix);
+               if Executable_Suffix /= Nil_Variable_Value
+                 and then not Executable_Suffix.Default
+               then
+                  Executable_Extension_On_Target := Executable_Suffix.Value;
                end if;
 
+               Result := Executable_Name (Executable.Value);
+               Executable_Extension_On_Target := Saved_EEOT;
                return Result;
             end;
          end if;
index b193a11..dc3fe56 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2005 Free Software Foundation, Inc.          --
+--          Copyright (C) 2001-2006, 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- --
@@ -471,7 +471,6 @@ package body Switch.M is
 
       if Last = 0 then
          return (1 .. 0 => null);
-
       else
          return Global_Switches (Global_Switches'First .. Last);
       end if;
@@ -594,13 +593,13 @@ package body Switch.M is
 
             case Switch_Chars (Ptr) is
 
-               --  processing for eI switch
+               --  Processing for eI switch
 
                when 'I' =>
                   Ptr := Ptr + 1;
                   Scan_Pos (Switch_Chars, Max, Ptr, Main_Index, C);
 
-               --  processing for eL switch
+               --  Processing for eL switch
 
                when 'L' =>
                   Ptr := Ptr + 1;
@@ -702,6 +701,12 @@ package body Switch.M is
             Ptr := Ptr + 1;
             Check_Switches := True;
 
+         --  Processing for S switch
+
+         when 'S' =>
+            Ptr := Ptr + 1;
+            Commands_To_Stdout := True;
+
          --  Processing for v switch
 
          when 'v' =>
index 829535d..3aa3cc3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1999-2005, Free Software Foundation, Inc.         --
+--          Copyright (C) 1999-2006, 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- --
@@ -147,25 +147,6 @@ package body Targparm is
    procedure Set_Profile_Restrictions (P : Profile_Name);
    --  Set Restrictions_On_Target for the given profile
 
-   ------------------------------
-   -- Set_Profile_Restrictions --
-   ------------------------------
-
-   procedure Set_Profile_Restrictions (P : Profile_Name) is
-      R : Restriction_Flags  renames Profile_Info (P).Set;
-      V : Restriction_Values renames Profile_Info (P).Value;
-   begin
-      for J in R'Range loop
-         if R (J) then
-            Restrictions_On_Target.Set (J) := True;
-
-            if J in All_Parameter_Restrictions then
-               Restrictions_On_Target.Value (J) := V (J);
-            end if;
-         end if;
-      end loop;
-   end Set_Profile_Restrictions;
-
    ---------------------------
    -- Get_Target_Parameters --
    ---------------------------
@@ -497,6 +478,34 @@ package body Targparm is
 
             goto Line_Loop_Continue;
 
+         --  See if we have an Executable_Extension
+
+         elsif System_Text (P .. P + 45) =
+                  "   Executable_Extension : constant String := """
+         then
+            P := P + 46;
+
+            Name_Len := 0;
+            while System_Text (P) /= '"'
+              and then System_Text (P) /= ASCII.LF
+            loop
+               Add_Char_To_Name_Buffer (System_Text (P));
+               P := P + 1;
+            end loop;
+
+            if System_Text (P) /= '"' or else System_Text (P + 1) /= ';' then
+               Set_Standard_Error;
+               Write_Line
+                 ("incorrectly formatted Executable_Extension in system.ads");
+               Set_Standard_Output;
+               Fatal := True;
+
+            else
+               Executable_Extension_On_Target := Name_Enter;
+            end if;
+
+            goto Line_Loop_Continue;
+
          --  Next See if we have a configuration parameter
 
          else
@@ -635,4 +644,23 @@ package body Targparm is
       end if;
    end Get_Target_Parameters;
 
+   ------------------------------
+   -- Set_Profile_Restrictions --
+   ------------------------------
+
+   procedure Set_Profile_Restrictions (P : Profile_Name) is
+      R : Restriction_Flags  renames Profile_Info (P).Set;
+      V : Restriction_Values renames Profile_Info (P).Value;
+   begin
+      for J in R'Range loop
+         if R (J) then
+            Restrictions_On_Target.Set (J) := True;
+
+            if J in All_Parameter_Restrictions then
+               Restrictions_On_Target.Value (J) := V (J);
+            end if;
+         end if;
+      end loop;
+   end Set_Profile_Restrictions;
+
 end Targparm;
index 8325e8c..f7406e8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1999-2005, Free Software Foundation, Inc.         --
+--          Copyright (C) 1999-2006, 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- --
@@ -129,7 +129,7 @@ package Targparm is
    --  then the flag Opt.Address_Is_Private is set True, otherwise this flag
    --  is set False.
 
-   Restrictions_On_Target : Restrictions_Info;
+   Restrictions_On_Target : Restrictions_Info := No_Restrictions;
    --  Records restrictions specified by system.ads. Only the Set and Value
    --  members are modified. The Violated and Count fields are never modified.
    --  Note that entries can be set either by a pragma Restrictions or by
@@ -161,6 +161,17 @@ package Targparm is
    --  The name should contain only letters A-Z, digits 1-9, spaces,
    --  and underscores.
 
+   --------------------------
+   -- Executable Extension --
+   --------------------------
+
+   Executable_Extension_On_Target : Name_Id := No_Name;
+   --  Executable extension on the target.
+   --  This name is useful for setting the executable extension in a
+   --  dynamic way, e.g. depending on the run-time used, rather than
+   --  using a configure-time macro as done by Get_Target_Executable_Suffix.
+   --  If not set (No_Name), use GNAT.OS_Lib.Get_Target_Executable_Suffix.
+
    -----------------------
    -- Target Parameters --
    -----------------------