diff mbox

[Ada] gnatmake, aggregate and aggregate library projects

Message ID 20140129153654.GA5255@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 29, 2014, 3:36 p.m. UTC
gnatmake, gnatclean, gnatname and the gnat driver now fail immediately
if the main project is an aggregate project or if there is an aggregate
library project in the project tree.

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

2014-01-29  Vincent Celier  <celier@adacore.com>

	* clean.adb (Gnatclean): Fail if main project is an aggregate
	project or if there is an aggregate library project in the
	project tree.
	* gnatcmd.adb: Fail if the main project is an aggregate project
	or if there is an aggegate library project in the project tree.
	* make.adb (Initialize): : Fail if main project is an aggregate
	project or if there is an aggregate library project in the
	project tree.
	* makeutl.ads (Aggregate_Libraries_In): New Boolean function.
	* prj-makr.adb (Initialize): Fail if the main project is an
	aggregate project or an aggregate library project.
diff mbox

Patch

Index: gnatcmd.adb
===================================================================
--- gnatcmd.adb	(revision 207241)
+++ gnatcmd.adb	(working copy)
@@ -1939,6 +1939,12 @@ 
 
          if Project = Prj.No_Project then
             Fail ("""" & Project_File.all & """ processing failed");
+
+         elsif Project.Qualifier = Aggregate then
+            Fail ("aggregate projects are not supported");
+
+         elsif Aggregate_Libraries_In (Project_Tree) then
+            Fail ("aggregate library projects are not supported");
          end if;
 
          --  Check if a package with the name of the tool is in the project
Index: make.adb
===================================================================
--- make.adb	(revision 207241)
+++ make.adb	(working copy)
@@ -6617,6 +6617,13 @@ 
               ("""" & Project_File_Name.all & """ processing failed");
          end if;
 
+         if Main_Project.Qualifier = Aggregate then
+            Make_Failed ("aggregate projects are not supported");
+
+         elsif Aggregate_Libraries_In (Project_Tree) then
+            Make_Failed ("aggregate library projects are not supported");
+         end if;
+
          Create_Mapping_File := True;
 
          if Verbose_Mode then
Index: prj-makr.adb
===================================================================
--- prj-makr.adb	(revision 207241)
+++ prj-makr.adb	(working copy)
@@ -889,6 +889,14 @@ 
             if No (Project_Node) then
                Prj.Com.Fail ("parsing of existing project file failed");
 
+            elsif Project_Qualifier_Of (Project_Node, Tree) = Aggregate then
+               Prj.Com.Fail ("aggregate projects are not supported");
+
+            elsif Project_Qualifier_Of (Project_Node, Tree) =
+                                                    Aggregate_Library
+            then
+               Prj.Com.Fail ("aggregate library projects are not supported");
+
             else
                --  If parsing was successful, remove the components that are
                --  automatically generated, if any, so that they will be
Index: makeutl.adb
===================================================================
--- makeutl.adb	(revision 207252)
+++ makeutl.adb	(working copy)
@@ -171,6 +171,26 @@ 
       end;
    end Absolute_Path;
 
+   ----------------------------
+   -- Aggregate_Libraries_In --
+   ----------------------------
+
+   function Aggregate_Libraries_In (Tree : Project_Tree_Ref) return Boolean is
+      List : Project_List;
+
+   begin
+      List := Tree.Projects;
+      while List /= null loop
+         if List.Project.Qualifier = Aggregate_Library then
+            return True;
+         end if;
+
+         List := List.Next;
+      end loop;
+
+      return False;
+   end Aggregate_Libraries_In;
+
    -------------------------
    -- Base_Name_Index_For --
    -------------------------
Index: makeutl.ads
===================================================================
--- makeutl.ads	(revision 207241)
+++ makeutl.ads	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2004-2012, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2013, 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- --
@@ -216,6 +216,10 @@ 
    --  The source directories of imported projects are only included if one
    --  of the declared languages is in the list Languages.
 
+   function Aggregate_Libraries_In (Tree : Project_Tree_Ref) return Boolean;
+   --  Return True iff there is one or more aggregate library projects in
+   --  the project tree Tree.
+
    procedure Write_Path_File (FD : File_Descriptor);
    --  Write in the specified open path file the directories in table
    --  Directories, then closed the path file.
Index: clean.adb
===================================================================
--- clean.adb	(revision 207241)
+++ clean.adb	(working copy)
@@ -1416,6 +1416,12 @@ 
 
          if Main_Project = No_Project then
             Fail ("""" & Project_File_Name.all & """ processing failed");
+
+         elsif Main_Project.Qualifier = Aggregate then
+            Fail ("aggregate projects are not supported");
+
+         elsif Aggregate_Libraries_In (Project_Tree) then
+            Fail ("aggregate library projects are not supported");
          end if;
 
          if Opt.Verbose_Mode then