Patchwork [Ada] Allow the same library project in different project tree

login
register
mail settings
Submitter Arnaud Charlet
Date July 12, 2012, 10:37 a.m.
Message ID <20120712103730.GA7640@adacore.com>
Download mbox | patch
Permalink /patch/170634/
State New
Headers show

Comments

Arnaud Charlet - July 12, 2012, 10:37 a.m.
It is possible to have the same library project in different aggregated
projects, so in different project tree.

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

2012-07-12  Pascal Obry  <obry@adacore.com>

	* prj-nmsc.adb (Check_Library_Attributes): Allow the same library
	project in different project tree (different aggregated projects).

Patch

Index: prj-nmsc.adb
===================================================================
--- prj-nmsc.adb	(revision 189431)
+++ prj-nmsc.adb	(working copy)
@@ -165,6 +165,7 @@ 
    type Lib_Data is record
       Name : Name_Id;
       Proj : Project_Id;
+      Tree : Project_Tree_Ref;
    end record;
 
    package Lib_Data_Table is new GNAT.Table
@@ -3639,7 +3640,9 @@ 
          --  Check if the same library name is used in an other library project
 
          for J in 1 .. Lib_Data_Table.Last loop
-            if Lib_Data_Table.Table (J).Name = Project.Library_Name then
+            if Lib_Data_Table.Table (J).Name = Project.Library_Name
+              and then Lib_Data_Table.Table (J).Tree = Data.Tree
+            then
                Error_Msg_Name_1 := Lib_Data_Table.Table (J).Proj.Name;
                Error_Msg
                  (Data.Flags,
@@ -3656,7 +3659,9 @@ 
          --  Record the library name
 
          Lib_Data_Table.Append
-           ((Name => Project.Library_Name, Proj => Project));
+           ((Name => Project.Library_Name,
+             Proj => Project,
+             Tree => Data.Tree));
       end if;
    end Check_Library_Attributes;