diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-30 05:27:25 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-30 05:27:25 +0000 |
commit | 125da2199fbe37d73f566834eaf8528ee36f18e1 (patch) | |
tree | ff221cf3fd6ff96b14dcaf091dbf512b2752502b /gcc/ada/mlib-prj.adb | |
parent | 1d34abac81450ec8b2e2874b91318c6abdc4e5ac (diff) | |
download | gcc-125da2199fbe37d73f566834eaf8528ee36f18e1.tar.gz |
2009-06-29 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r149060
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@149081 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/mlib-prj.adb')
-rw-r--r-- | gcc/ada/mlib-prj.adb | 154 |
1 files changed, 73 insertions, 81 deletions
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb index 67d9330ae9e..c7f0f0b73f0 100644 --- a/gcc/ada/mlib-prj.adb +++ b/gcc/ada/mlib-prj.adb @@ -936,59 +936,53 @@ package body MLib.Prj is -- Bind is False, so that First_ALI is set. declare - Unit : Unit_Data; + Unit : Unit_Index; begin Library_ALIs.Reset; Interface_ALIs.Reset; Processed_ALIs.Reset; - for Source in Unit_Table.First .. - Unit_Table.Last (In_Tree.Units) - loop - Unit := In_Tree.Units.Table (Source); - - if Unit.File_Names (Body_Part).Name /= No_File - and then Unit.File_Names (Body_Part).Path.Name /= Slash + Unit := Units_Htable.Get_First (In_Tree.Units_HT); + while Unit /= No_Unit_Index loop + if Unit.File_Names (Impl) /= null + and then not Unit.File_Names (Impl).Locally_Removed then - if - Check_Project (Unit.File_Names (Body_Part).Project) - then - if Unit.File_Names (Specification).Name = No_File then + if Check_Project (Unit.File_Names (Impl).Project) then + if Unit.File_Names (Spec) = null then declare Src_Ind : Source_File_Index; begin Src_Ind := Sinput.P.Load_Project_File - (Get_Name_String - (Unit.File_Names - (Body_Part).Path.Name)); + (Get_Name_String + (Unit.File_Names (Impl).Path.Name)); -- Add the ALI file only if it is not a subunit if not Sinput.P.Source_File_Is_Subunit (Src_Ind) then - Add_ALI_For - (Unit.File_Names (Body_Part).Name); + Add_ALI_For (Unit.File_Names (Impl).File); exit when not Bind; end if; end; else - Add_ALI_For (Unit.File_Names (Body_Part).Name); + Add_ALI_For (Unit.File_Names (Impl).File); exit when not Bind; end if; end if; - elsif Unit.File_Names (Specification).Name /= No_File - and then Unit.File_Names (Specification).Path.Name /= Slash - and then Check_Project - (Unit.File_Names (Specification).Project) + elsif Unit.File_Names (Spec) /= null + and then not Unit.File_Names (Spec).Locally_Removed + and then Check_Project (Unit.File_Names (Spec).Project) then - Add_ALI_For (Unit.File_Names (Specification).Name); + Add_ALI_For (Unit.File_Names (Spec).File); exit when not Bind; end if; + + Unit := Units_Htable.Get_Next (In_Tree.Units_HT); end loop; end; @@ -1020,8 +1014,7 @@ package body MLib.Prj is ALI.Units.Table (ALI.ALIs.Table (A).First_Unit).Last_Arg loop - -- Look for --RTS. If found, add the switch to call - -- gnatbind. + -- If --RTS found, add switch to call gnatbind declare Arg : String_Ptr renames Args.Table (Index); @@ -1407,6 +1400,7 @@ package body MLib.Prj is B_Start.all); Fname : File_Name_Type; Proj : Project_Id; + Index : Unit_Index; begin if Is_Regular_File (ALI_Path) then @@ -1418,36 +1412,26 @@ package body MLib.Prj is -- the library. if not Add_It then - for Index in - 1 .. Unit_Table.Last - (In_Tree.Units) - loop - if In_Tree.Units.Table - (Index).File_Names - (Body_Part).Name /= No_File + Index := Units_Htable.Get_First + (In_Tree.Units_HT); + while Index /= null loop + if Index.File_Names (Impl) /= + null then Proj := - In_Tree.Units.Table (Index). - File_Names - (Body_Part).Project; + Index.File_Names (Impl) + .Project; Fname := - In_Tree.Units.Table (Index). - File_Names (Body_Part).Name; - - elsif - In_Tree.Units.Table - (Index).File_Names - (Specification).Name /= - No_File + Index.File_Names (Impl).File; + + elsif Index.File_Names (Spec) /= + null then Proj := - In_Tree.Units.Table - (Index).File_Names - (Specification).Project; + Index.File_Names (Spec) + .Project; Fname := - In_Tree.Units.Table - (Index).File_Names - (Specification).Name; + Index.File_Names (Spec).File; else Proj := No_Project; @@ -1480,6 +1464,9 @@ package body MLib.Prj is end if; exit when Add_It; + + Index := Units_Htable.Get_Next + (In_Tree.Units_HT); end loop; end if; @@ -1832,25 +1819,23 @@ package body MLib.Prj is and then Name (Last - 3 .. Last) = ".ali" then declare - Unit : Unit_Data; + Unit : Unit_Index; begin -- Compare with ALI file names of the project - for Index in - 1 .. Unit_Table.Last (In_Tree.Units) - loop - Unit := In_Tree.Units.Table (Index); - - if Unit.File_Names (Body_Part).Project /= + Unit := Units_Htable.Get_First (In_Tree.Units_HT); + while Unit /= No_Unit_Index loop + if Unit.File_Names (Impl) /= null + and then Unit.File_Names (Impl).Project /= No_Project then if Ultimate_Extending_Project_Of - (Unit.File_Names (Body_Part).Project) = + (Unit.File_Names (Impl).Project) = For_Project then Get_Name_String - (Unit.File_Names (Body_Part).Name); + (Unit.File_Names (Impl).File); Name_Len := Name_Len - File_Extension (Name (1 .. Name_Len))'Length; @@ -1862,12 +1847,13 @@ package body MLib.Prj is end if; end if; - elsif Ultimate_Extending_Project_Of - (Unit.File_Names (Specification).Project) = - For_Project + elsif Unit.File_Names (Spec) /= null + and then Ultimate_Extending_Project_Of + (Unit.File_Names (Spec).Project) = + For_Project then Get_Name_String - (Unit.File_Names (Specification).Name); + (Unit.File_Names (Spec).File); Name_Len := Name_Len - File_Extension @@ -1880,6 +1866,8 @@ package body MLib.Prj is exit; end if; end if; + + Unit := Units_Htable.Get_Next (In_Tree.Units_HT); end loop; end; end if; @@ -1959,7 +1947,7 @@ package body MLib.Prj is declare Dir : Dir_Type; Delete : Boolean := False; - Unit : Unit_Data; + Unit : Unit_Index; Name : String (1 .. 200); Last : Natural; @@ -1980,31 +1968,34 @@ package body MLib.Prj is -- Compare with source file names of the project - for Index in 1 .. Unit_Table.Last (In_Tree.Units) loop - Unit := In_Tree.Units.Table (Index); - - if Ultimate_Extending_Project_Of - (Unit.File_Names (Body_Part).Project) = For_Project + Unit := Units_Htable.Get_First (In_Tree.Units_HT); + while Unit /= No_Unit_Index loop + if Unit.File_Names (Impl) /= null + and then Ultimate_Extending_Project_Of + (Unit.File_Names (Impl).Project) = For_Project and then Get_Name_String - (Unit.File_Names (Body_Part).Name) = + (Unit.File_Names (Impl).File) = Name (1 .. Last) then Delete := True; exit; end if; - if Ultimate_Extending_Project_Of - (Unit.File_Names (Specification).Project) = + if Unit.File_Names (Spec) /= null + and then Ultimate_Extending_Project_Of + (Unit.File_Names (Spec).Project) = For_Project and then Get_Name_String - (Unit.File_Names (Specification).Name) = + (Unit.File_Names (Spec).File) = Name (1 .. Last) then Delete := True; exit; end if; + + Unit := Units_Htable.Get_Next (In_Tree.Units_HT); end loop; end if; @@ -2161,7 +2152,7 @@ package body MLib.Prj is First_Unit : ALI.Unit_Id; Second_Unit : ALI.Unit_Id; - Data : Unit_Data; + Data : Unit_Index; Copy_Subunits : Boolean := False; -- When True, indicates that subunits, if any, need to be copied too @@ -2184,18 +2175,17 @@ package body MLib.Prj is pragma Warnings (Off, Success); begin - Unit_Loop : - for Index in Unit_Table.First .. - Unit_Table.Last (In_Tree.Units) - loop - Data := In_Tree.Units.Table (Index); + Data := Units_Htable.Get_First (In_Tree.Units_HT); + Unit_Loop : + while Data /= No_Unit_Index loop -- Find and copy the immediate or inherited source for J in Data.File_Names'Range loop - if Is_Same_Or_Extension - (For_Project, Data.File_Names (J).Project) - and then Data.File_Names (J).Name = File_Name + if Data.File_Names (J) /= null + and then Is_Same_Or_Extension + (For_Project, Data.File_Names (J).Project) + and then Data.File_Names (J).File = File_Name then Copy_File (Get_Name_String (Data.File_Names (J).Path.Name), @@ -2206,6 +2196,8 @@ package body MLib.Prj is exit Unit_Loop; end if; end loop; + + Data := Units_Htable.Get_Next (In_Tree.Units_HT); end loop Unit_Loop; end Copy; |