]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 9 Jul 2012 13:29:10 +0000 (15:29 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 9 Jul 2012 13:29:10 +0000 (15:29 +0200)
2012-07-09  Pascal Obry  <obry@adacore.com>

* prj.adb (For_Every_Project_Imported_Context): Make sure we
callback with the project having sources.
Minor reformatting.

2012-07-09  Eric Botcazou  <ebotcazou@adacore.com>

* make.adb: Fix typo.

From-SVN: r189385

gcc/ada/ChangeLog
gcc/ada/make.adb
gcc/ada/prj.adb

index 59432bfcf2aaf65bbd0e48d8c7561a5609444e5f..38b62351cf36304a0e150daa442046dba7b9cf1e 100644 (file)
@@ -1,3 +1,13 @@
+2012-07-09  Pascal Obry  <obry@adacore.com>
+
+       * prj.adb (For_Every_Project_Imported_Context): Make sure we
+       callback with the project having sources.
+       Minor reformatting.
+
+2012-07-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * make.adb: Fix typo.
+
 2012-07-09  Vincent Pucci  <pucci@adacore.com>
 
        * sem_ch9.adb (Check_Node): Allow attributes
index 5c35a4ebb39dbcec16699a16957a0bb1171261f7..91d64b514372d88c5a445d67ac677a75fefd9a4c 100644 (file)
@@ -4811,7 +4811,7 @@ package body Make is
       --  have been regenerated.
 
       if Main_Project /= No_Project
-        and then not Codepeer_Mode
+        and then not CodePeer_Mode
         and then MLib.Tgt.Support_For_Libraries /= Prj.None
         and then (Do_Bind_Step
                    or Unique_Compile_All_Projects
index 9a5e2607aa1e8cf97e6b5b1d9b9d38f282617add..d70315bbbbc684ca73b720061540b2e4d5e2cb6c 100644 (file)
@@ -584,8 +584,55 @@ package body Prj is
             In_Aggregate_Lib      : Boolean;
             From_Encapsulated_Lib : Boolean)
          is
+
+            function Has_Sources (P : Project_Id) return Boolean;
+            --  Returns True if P has sources
+
+            function Get_From_Tree (P : Project_Id) return Project_Id;
+            --  Get project P from Tree. If P has no sources get another
+            --  instance of this project with sources. If P has sources,
+            --  returns it.
+
+            -----------------
+            -- Has_Sources --
+            -----------------
+
+            function Has_Sources (P : Project_Id) return Boolean is
+               Lang : Language_Ptr;
+            begin
+               Lang := P.Languages;
+               while Lang /= No_Language_Index loop
+                  if Lang.First_Source /= No_Source then
+                     return True;
+                  end if;
+                  Lang := Lang.Next;
+               end loop;
+
+               return False;
+            end Has_Sources;
+
+            -------------------
+            -- Get_From_Tree --
+            -------------------
+
+            function Get_From_Tree (P : Project_Id) return Project_Id is
+               List : Project_List := Tree.Projects;
+            begin
+               if not Has_Sources (P) then
+                  while List /= null loop
+                     if List.Project.Name = P.Name
+                       and then Has_Sources (List.Project)
+                     then
+                        return List.Project;
+                     end if;
+                     List := List.Next;
+                  end loop;
+               end if;
+
+               return P;
+            end Get_From_Tree;
+
             List : Project_List;
-            T    : Project_Tree_Ref;
 
          begin
             if not Seen_Name.Contains (Project.Name) then
@@ -597,7 +644,7 @@ package body Prj is
 
                if not Imported_First then
                   Action
-                    (Project,
+                    (Get_From_Tree (Project),
                      Tree,
                      Project_Context'(In_Aggregate_Lib, From_Encapsulated_Lib),
                      With_State);
@@ -640,23 +687,20 @@ package body Prj is
                         --  of the aggregate library.
 
                         if Project.Qualifier = Aggregate_Library then
-                           T := Tree;
                            Recursive_Check
-                             (Agg.Project, T,
+                             (Agg.Project, Tree,
                               True,
                               From_Encapsulated_Lib
                                 or else
                                   Project.Standalone_Library = Encapsulated);
 
                         else
-                           T := Agg.Tree;
-
                            --  Use a new context as we want to returns the same
                            --  project in different project tree for aggregated
                            --  projects.
 
                            Recursive_Check_Context
-                             (Agg.Project, T, False, False);
+                             (Agg.Project, Agg.Tree, False, False);
                         end if;
 
                         Agg := Agg.Next;
@@ -666,7 +710,7 @@ package body Prj is
 
                if Imported_First then
                   Action
-                    (Project,
+                    (Get_From_Tree (Project),
                      Tree,
                      Project_Context'(In_Aggregate_Lib, From_Encapsulated_Lib),
                      With_State);