diff mbox

[Ada] Set proper context for encapsulated aggregate libraries

Message ID 20120208093148.GA4517@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Feb. 8, 2012, 9:31 a.m. UTC
No change in behavior. This is for gprbuild.

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

2012-02-08  Pascal Obry  <obry@adacore.com>

	* prj.adb (Compute_All_Imported_Projects): Use new
	For_Project_And_Aggregated_Context to ensure proper context is
	used for encapsulated aggregate libraries.
	* prj-proc.adb (Recursive_Process): Call
	Process_Aggregated_Projects earlier to ensure that all dependent
	projects are set with the proper encapsulated status.
diff mbox

Patch

Index: prj.adb
===================================================================
--- prj.adb	(revision 183998)
+++ prj.adb	(working copy)
@@ -1476,7 +1476,8 @@ 
    is
       procedure Analyze_Tree
         (Local_Root : Project_Id;
-         Local_Tree : Project_Tree_Ref);
+         Local_Tree : Project_Tree_Ref;
+         Context    : Project_Context);
       --  Process Project and all its aggregated project to analyze their own
       --  imported projects.
 
@@ -1486,7 +1487,8 @@ 
 
       procedure Analyze_Tree
         (Local_Root : Project_Id;
-         Local_Tree : Project_Tree_Ref)
+         Local_Tree : Project_Tree_Ref;
+         Context    : Project_Context)
       is
          pragma Unreferenced (Local_Root);
 
@@ -1540,7 +1542,9 @@ 
                Project.All_Imported_Projects :=
                  new Project_List_Element'
                    (Project               => Prj2,
-                    From_Encapsulated_Lib => Context.From_Encapsulated_Lib,
+                    From_Encapsulated_Lib =>
+                      Context.From_Encapsulated_Lib
+                        or else Analyze_Tree.Context.From_Encapsulated_Lib,
                     Next                  => Project.All_Imported_Projects);
             end if;
          end Recursive_Add;
@@ -1564,7 +1568,7 @@ 
       end Analyze_Tree;
 
       procedure For_Aggregates is
-        new For_Project_And_Aggregated (Analyze_Tree);
+        new For_Project_And_Aggregated_Context (Analyze_Tree);
 
    --  Start of processing for Compute_All_Imported_Projects
 
Index: prj-proc.adb
===================================================================
--- prj-proc.adb	(revision 183996)
+++ prj-proc.adb	(working copy)
@@ -2908,6 +2908,10 @@ 
 
             Process_Imported_Projects (Imported, Limited_With => True);
 
+            if Err_Vars.Total_Errors_Detected = 0 then
+               Process_Aggregated_Projects;
+            end if;
+
             --  At this point (after Process_Declarative_Items) we have the
             --  attribute values set, we can backtrace In_Tree.Project and
             --  set the From_Encapsulated_Library status.
@@ -2935,7 +2939,6 @@ 
                end if;
 
                if Err_Vars.Total_Errors_Detected = 0 then
-                  Process_Aggregated_Projects;
 
                   --  For an aggregate library we add the aggregated projects
                   --  as imported ones. This is necessary to give visibility