A new attribute Object_Path_Switches is added to packag Compiler of
project files. A new switch -gnateO= is added to the compiler; its
goal is to pass an object path file name to the compiler.

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

2012-04-02  Vincent Celier  <cel...@adacore.com>

        * opt.ads (Object_Path_File_Name): New variable.
        * prj-attr.adb: New Compiler attribute Object_Path_Switches.
        * prj-nmsc.adb (Process_Compiler): Recognize new attribute
        Object_Path_Switches.
        * snames.ads-tmpl: New standard name Object_Path_Switches.
        * switch-c.adb (Scan_Front_End_Switches): Recognize new switch
        -gnateO= and put its value in Opt.Object_Path_File_Name.

Index: switch-c.adb
===================================================================
--- switch-c.adb        (revision 186067)
+++ switch-c.adb        (working copy)
@@ -516,6 +516,24 @@
                        new String'(Switch_Chars (Ptr .. Max));
                      return;
 
+                  --  -gnateO= (object path file)
+
+                  when 'O' =>
+                     Store_Switch := False;
+                     Ptr := Ptr + 1;
+
+                     --  Check for '='
+
+                     if Ptr >= Max or else Switch_Chars (Ptr) /= '=' then
+                        Bad_Switch ("-gnateO");
+
+                     else
+                        Object_Path_File_Name :=
+                          new String'(Switch_Chars (Ptr + 1 .. Max));
+                     end if;
+
+                     return;
+
                   --  -gnatep (preprocessing data file)
 
                   when 'p' =>
Index: prj-nmsc.adb
===================================================================
--- prj-nmsc.adb        (revision 186067)
+++ prj-nmsc.adb        (working copy)
@@ -1440,6 +1440,12 @@
                                 From_List => Element.Value.Values,
                                 In_Tree   => Data.Tree);
 
+                        when Name_Object_Path_Switches =>
+                           Put (Into_List =>
+                                  Lang_Index.Config.Object_Path_Switches,
+                                From_List => Element.Value.Values,
+                                In_Tree   => Data.Tree);
+
                         --  Attribute Compiler_Pic_Option (<language>)
 
                         when Name_Pic_Option =>
Index: opt.ads
===================================================================
--- opt.ads     (revision 186067)
+++ opt.ads     (working copy)
@@ -987,6 +987,11 @@
    --  GNATMAKE
    --  Set to True when an object directory is specified with option -D
 
+   Object_Path_File_Name : String_Ptr := null;
+   --  GNAT2WHY
+   --  Path of the temporary file that contains a list of object directories
+   --  passed by -gnateO=<obj_pat_file>.
+
    One_Compilation_Per_Obj_Dir : Boolean := False;
    --  GNATMAKE, GPRBUILD
    --  Set to True with switch --single-compile-per-obj-dir. When True, there
Index: prj-attr.adb
===================================================================
--- prj-attr.adb        (revision 186067)
+++ prj-attr.adb        (working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2012, 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- --
@@ -226,6 +226,7 @@
    "Lainclude_switches#" &
    "Sainclude_path#" &
    "Sainclude_path_file#" &
+   "Laobject_path_switches#" &
 
    --  package Builder
 
Index: snames.ads-tmpl
===================================================================
--- snames.ads-tmpl     (revision 186067)
+++ snames.ads-tmpl     (working copy)
@@ -1199,6 +1199,7 @@
    Name_Object_File_Switches               : constant Name_Id := N + $;
    Name_Object_Generated                   : constant Name_Id := N + $;
    Name_Object_List                        : constant Name_Id := N + $;
+   Name_Object_Path_Switches               : constant Name_Id := N + $;
    Name_Objects_Linked                     : constant Name_Id := N + $;
    Name_Objects_Path                       : constant Name_Id := N + $;
    Name_Objects_Path_File                  : constant Name_Id := N + $;

Reply via email to