]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
prj-attr.adb: New attributes in package Clean: Artifacts_In_Exec_Dir, Artifacts_In_Ob...
authorVincent Celier <celier@adacore.com>
Mon, 14 Oct 2013 12:47:59 +0000 (12:47 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 14 Oct 2013 12:47:59 +0000 (14:47 +0200)
2013-10-14  Vincent Celier  <celier@adacore.com>

* prj-attr.adb: New attributes in package Clean:
Artifacts_In_Exec_Dir, Artifacts_In_Object_Dir.
* prj-nmsc.adb (Process_Clean (Attributes)): New
procedure to process attributes Artifacts_In_Exec_Dir and
Artifacts_In_Object_Dir in package Clean.
* prj.ads (Project_Configuration): New components
Artifacts_In_Exec_Dir and Artifacts_In_Object_Dir.
* snames.ads-tmpl: New standard names Artifacts_In_Exec_Dir and
Artifacts_In_Object_Dir used only by gprclean.

From-SVN: r203529

gcc/ada/ChangeLog
gcc/ada/prj-attr.adb
gcc/ada/prj-nmsc.adb
gcc/ada/prj.ads
gcc/ada/snames.ads-tmpl

index 6c33943548623d52b4e86306871c566da1f28ac6..ce4507636471b719414ac0a002b34ade23cb44da 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-14  Vincent Celier  <celier@adacore.com>
+
+       * prj-attr.adb: New attributes in package Clean:
+       Artifacts_In_Exec_Dir, Artifacts_In_Object_Dir.
+       * prj-nmsc.adb (Process_Clean (Attributes)): New
+       procedure to process attributes Artifacts_In_Exec_Dir and
+       Artifacts_In_Object_Dir in package Clean.
+       * prj.ads (Project_Configuration): New components
+       Artifacts_In_Exec_Dir and Artifacts_In_Object_Dir.
+       * snames.ads-tmpl: New standard names Artifacts_In_Exec_Dir and
+       Artifacts_In_Object_Dir used only by gprclean.
+
 2013-10-14  Robert Dewar  <dewar@adacore.com>
 
        * exp_attr.adb (Expand_N_Attribute_Reference): Add error
index a69281130ddfd2837b2f37af9909eecedbe4a700..586fc4f424565092137498dfa41c2e5612ccf791 100644 (file)
@@ -288,6 +288,8 @@ package body Prj.Attr is
    "LVswitches#" &
    "Lasource_artifact_extensions#" &
    "Laobject_artifact_extensions#" &
+   "LVartifacts_in_exec_dir#" &
+   "LVartifacts_in_object_dir#" &
 
    --  package Cross_Reference
 
index f1538de9922a2ecc4d89b0357a32af2613a8e195..12a84e555128bc35252b6b0d53ecaa7a08562537 100644 (file)
@@ -1127,6 +1127,9 @@ package body Prj.Nmsc is
          procedure Process_Builder (Attributes : Variable_Id);
          --  Process the simple attributes of package Builder
 
+         procedure Process_Clean (Attributes : Variable_Id);
+         --  Process the simple attributes of package Clean
+
          procedure Process_Clean  (Arrays : Array_Id);
          --  Process the associated array attributes of package Clean
 
@@ -1256,6 +1259,55 @@ package body Prj.Nmsc is
          -- Process_Clean --
          -------------------
 
+         procedure Process_Clean (Attributes : Variable_Id) is
+            Attribute_Id : Variable_Id;
+            Attribute    : Variable;
+            List         : String_List_Id;
+
+         begin
+            --  Process non associated array attributes from package Clean
+
+            Attribute_Id := Attributes;
+            while Attribute_Id /= No_Variable loop
+               Attribute := Shared.Variable_Elements.Table (Attribute_Id);
+
+               if not Attribute.Value.Default then
+                  if Attribute.Name = Name_Artifacts_In_Exec_Dir then
+
+                     --  Attribute Artifacts_In_Exec_Dir: the list of file
+                     --  names to be cleaned in the exec dir of the main
+                     --  project.
+
+                     List := Attribute.Value.Values;
+
+                     if List /= Nil_String then
+                        Put (Into_List =>
+                               Project.Config.Artifacts_In_Exec_Dir,
+                             From_List => List,
+                             In_Tree   => Data.Tree);
+                     end if;
+
+                  elsif Attribute.Name = Name_Artifacts_In_Object_Dir then
+
+                     --  Attribute Artifacts_In_Exec_Dir: the list of file
+                     --  names to be cleaned in the object dir of every
+                     --  project.
+
+                     List := Attribute.Value.Values;
+
+                     if List /= Nil_String then
+                        Put (Into_List =>
+                               Project.Config.Artifacts_In_Object_Dir,
+                             From_List => List,
+                             In_Tree   => Data.Tree);
+                     end if;
+                  end if;
+               end if;
+
+               Attribute_Id := Attribute.Next;
+            end loop;
+         end Process_Clean;
+
          procedure Process_Clean  (Arrays : Array_Id) is
             Current_Array_Id : Array_Id;
             Current_Array    : Array_Data;
@@ -1932,6 +1984,7 @@ package body Prj.Nmsc is
 
                   --  Process attributes of package Clean
 
+                  Process_Clean (Element.Decl.Attributes);
                   Process_Clean (Element.Decl.Arrays);
 
                when Name_Compiler =>
index 66f878688d0ace59361b3f70a6e799ba06698046..a1da52bdff74c12afaa1f17f5d2c0b9b94bacd8c 100644 (file)
@@ -1133,6 +1133,17 @@ package Prj is
       Auto_Init_Supported : Boolean := False;
       --  True if automatic initialisation is supported for shared stand-alone
       --  libraries.
+
+      --  Cleaning
+
+      Artifacts_In_Exec_Dir : Name_List_Index := No_Name_List;
+      --  List of regexp file names to be cleaned in the exec directory of the
+      --  main project.
+
+      Artifacts_In_Object_Dir : Name_List_Index := No_Name_List;
+      --  List of regexp file names to be cleaned in the object directory of
+      --  all projects.
+
    end record;
 
    Default_Project_Config : constant Project_Configuration :=
@@ -1167,7 +1178,9 @@ package Prj is
                                Lib_Version_Options            => No_Name_List,
                                Symbolic_Link_Supported        => False,
                                Lib_Maj_Min_Id_Supported       => False,
-                               Auto_Init_Supported            => False);
+                               Auto_Init_Supported            => False,
+                               Artifacts_In_Exec_Dir          => No_Name_List,
+                               Artifacts_In_Object_Dir        => No_Name_List);
 
    -------------------------
    -- Aggregated projects --
index c5c4cdab7d293a1ac5e659a0b69c17ec9504293e..69eb42e4fb149da86b52f45d8e34263754c686cc 100644 (file)
@@ -1221,7 +1221,7 @@ package Snames is
    --  Additional reserved words and identifiers used in GNAT Project Files
    --  Note that Name_External is already previously declared.
 
-   --  The names with the -- GB annotation are only used in gprbuild.
+   --  Names with a -- GB annotation are only used in gprbuild or gprclean
 
    Name_Active                             : constant Name_Id := N + $;
    Name_Aggregate                          : constant Name_Id := N + $;
@@ -1229,6 +1229,8 @@ package Snames is
    Name_Archive_Builder_Append_Option      : constant Name_Id := N + $;
    Name_Archive_Indexer                    : constant Name_Id := N + $;
    Name_Archive_Suffix                     : constant Name_Id := N + $;
+   Name_Artifacts_In_Exec_Dir              : constant Name_Id := N + $; -- GB
+   Name_Artifacts_In_Object_Dir            : constant Name_Id := N + $; -- GB
    Name_Binder                             : constant Name_Id := N + $;
    Name_Body_Suffix                        : constant Name_Id := N + $;
    Name_Builder                            : constant Name_Id := N + $;