diff options
author | Pascal Obry <obry@adacore.com> | 2012-02-08 09:29:11 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-02-08 10:29:11 +0100 |
commit | 8364925760fe4705c121c975fca117d26ac81aea (patch) | |
tree | c45d8f19e5e043dd66ac3253929647948d5cab81 | |
parent | a8551b5f9cf959cc54c8277f3ddbd7df1842d154 (diff) | |
download | gcc-8364925760fe4705c121c975fca117d26ac81aea.zip gcc-8364925760fe4705c121c975fca117d26ac81aea.tar.gz gcc-8364925760fe4705c121c975fca117d26ac81aea.tar.bz2 |
prj.ads, prj.adb (For_Project_And_Aggregated_Context): New generic routine with a context parameter.
2012-02-08 Pascal Obry <obry@adacore.com>
* prj.ads, prj.adb (For_Project_And_Aggregated_Context): New
generic routine with a context parameter.
From-SVN: r183998
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/prj.adb | 50 | ||||
-rw-r--r-- | gcc/ada/prj.ads | 11 |
3 files changed, 66 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 16cd2e9..76ff4fb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2012-02-08 Pascal Obry <obry@adacore.com> + + * prj.ads, prj.adb (For_Project_And_Aggregated_Context): New + generic routine with a context parameter. + 2012-02-08 Robert Dewar <dewar@adacore.com> * a-coinve.adb, sem_util.adb, sem_ch8.adb, a-cobove.adb, diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb index 1327b58..15cb808 100644 --- a/gcc/ada/prj.adb +++ b/gcc/ada/prj.adb @@ -1863,6 +1863,56 @@ package body Prj is end if; end For_Project_And_Aggregated; + ---------------------------------------- + -- For_Project_And_Aggregated_Context -- + ---------------------------------------- + + procedure For_Project_And_Aggregated_Context + (Root_Project : Project_Id; + Root_Tree : Project_Tree_Ref) + is + + procedure Recursive_Process + (Project : Project_Id; + Tree : Project_Tree_Ref; + Context : Project_Context); + -- Process Project and all aggregated projects recursively + + ----------------------- + -- Recursive_Process -- + ----------------------- + + procedure Recursive_Process + (Project : Project_Id; + Tree : Project_Tree_Ref; + Context : Project_Context) + is + Agg : Aggregated_Project_List; + Ctx : Project_Context; + begin + Action (Project, Tree, Context); + + if Project.Qualifier in Aggregate_Project then + Ctx := + (In_Aggregate_Lib => True, + From_Encapsulated_Lib => + Context.From_Encapsulated_Lib + or else + Project.Standalone_Library = Encapsulated); + + Agg := Project.Aggregated_Projects; + while Agg /= null loop + Recursive_Process (Agg.Project, Agg.Tree, Ctx); + Agg := Agg.Next; + end loop; + end if; + end Recursive_Process; + + begin + Recursive_Process + (Root_Project, Root_Tree, Project_Context'(False, False)); + end For_Project_And_Aggregated_Context; + -- Package initialization for Prj begin diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index fa36d85..44aa94d 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -1621,6 +1621,17 @@ package Prj is With_State : in out State; Include_Aggregated : Boolean := True; Imported_First : Boolean := False); + -- As above but with an associated context + + generic + with procedure Action + (Project : Project_Id; + Tree : Project_Tree_Ref; + Context : Project_Context); + procedure For_Project_And_Aggregated_Context + (Root_Project : Project_Id; + Root_Tree : Project_Tree_Ref); + -- As above but with an associated context function Extend_Name (File : File_Name_Type; |