diff mbox

[Ada] Project in limited withed chain reported as duplicate

Message ID 20121002081931.GA5109@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 2, 2012, 8:19 a.m. UTC
This patch ensures that if a project is in a limited with import chain,
it is not reported as a duplicate project.

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

2012-10-02  Vincent Celier  <celier@adacore.com>

	* prj-part.adb (Post_Parse_Context_Clause): Resurrect Boolean
	parameter In_Limited.  Check for circularity also if In_Limited
	is True.
	(Parse_Single_Project): Call Post_Parse_Context_Clause with
	In_Limited parameter.
diff mbox

Patch

Index: prj-part.adb
===================================================================
--- prj-part.adb	(revision 191895)
+++ prj-part.adb	(working copy)
@@ -216,6 +216,7 @@ 
    procedure Post_Parse_Context_Clause
      (Context_Clause    : With_Id;
       In_Tree           : Project_Node_Tree_Ref;
+      In_Limited        : Boolean;
       Limited_Withs     : Boolean;
       Imported_Projects : in out Project_Node_Id;
       Project_Directory : Path_Name_Type;
@@ -827,6 +828,7 @@ 
    procedure Post_Parse_Context_Clause
      (Context_Clause    : With_Id;
       In_Tree           : Project_Node_Tree_Ref;
+      In_Limited        : Boolean;
       Limited_Withs     : Boolean;
       Imported_Projects : in out Project_Node_Id;
       Project_Directory : Path_Name_Type;
@@ -941,7 +943,9 @@ 
                   --  If we have one, get the project id of the limited
                   --  imported project file, and do not parse it.
 
-                  if Limited_Withs and then Project_Stack.Last > 1 then
+                  if (In_Limited or else Limited_Withs) and then
+                     Project_Stack.Last > 1
+                  then
                      declare
                         Canonical_Path_Name : Path_Name_Type;
 
@@ -975,7 +979,7 @@ 
                         Path_Name_Id      => Imported_Path_Name_Id,
                         Extended          => False,
                         From_Extended     => From_Extended,
-                        In_Limited        => Limited_Withs,
+                        In_Limited        => In_Limited or else Limited_Withs,
                         Packages_To_Check => Packages_To_Check,
                         Depth             => Depth,
                         Current_Dir       => Current_Dir,
@@ -1577,6 +1581,7 @@ 
             Post_Parse_Context_Clause
               (In_Tree           => In_Tree,
                Context_Clause    => First_With,
+               In_Limited        => In_Limited,
                Limited_Withs     => False,
                Imported_Projects => Imported_Projects,
                Project_Directory => Project_Directory,
@@ -1936,6 +1941,7 @@ 
          Post_Parse_Context_Clause
            (In_Tree           => In_Tree,
             Context_Clause    => First_With,
+            In_Limited        => In_Limited,
             Limited_Withs     => True,
             Imported_Projects => Imported_Projects,
             Project_Directory => Project_Directory,