diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-13 10:06:51 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-07-13 10:06:51 +0200 |
commit | fb2e11eeb0b993815c38a01b595e1d6678896578 (patch) | |
tree | 941b05ed8a1c04dc4eeb07191f531dec44e7459c /gcc/ada/prj-nmsc.adb | |
parent | ffa61a5ee88bced356a16485bdf5702d7ee04b1a (diff) | |
download | gcc-fb2e11eeb0b993815c38a01b595e1d6678896578.zip gcc-fb2e11eeb0b993815c38a01b595e1d6678896578.tar.gz gcc-fb2e11eeb0b993815c38a01b595e1d6678896578.tar.bz2 |
[multiple changes]
2009-07-13 Emmanuel Briot <briot@adacore.com>
* prj-nmsc.adb: Avoid traversing the list of source files if
we have already processed all locally removed files.
2009-07-13 Jose Ruiz <ruiz@adacore.com>
* gnat_ugn.texi: Fix typo.
2009-07-13 Robert Dewar <dewar@adacore.com>
* freeze.adb: Minor reformatting
Minor code reorganization (use Nkind_In)
* exp_ch6.adb: Minor reformatting
From-SVN: r149546
Diffstat (limited to 'gcc/ada/prj-nmsc.adb')
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 90 |
1 files changed, 51 insertions, 39 deletions
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 8ba7981..03acdb0 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -7796,60 +7796,72 @@ package body Prj.Nmsc is Excluded : File_Found; Proj : Project_Id; begin - Proj := Project; - while Proj /= No_Project loop - Iter := For_Each_Source (In_Tree, Proj); - while Prj.Element (Iter) /= No_Source loop - Source := Prj.Element (Iter); - Excluded := Excluded_Sources_Htable.Get - (Excluded_Sources, Source.File); - - if Excluded /= No_File_Found then - Source.Locally_Removed := True; - Source.In_Interfaces := False; + -- Minor optimization: if there are no excluded files, no need to + -- traverse the list of sources. We cannot however also check whether + -- the existing exceptions have ".Found" set to True (indicating we + -- found them before) because we need to do some final processing on + -- them in any case. - if Current_Verbosity = High then - Write_Str ("Removing file "); - Write_Line - (Get_Name_String (Excluded.File) - & " " & Get_Name_String (Source.Project.Name)); + if Excluded_Sources_Htable.Get_First (Excluded_Sources) /= + No_File_Found + then + Proj := Project; + while Proj /= No_Project loop + Iter := For_Each_Source (In_Tree, Proj); + while Prj.Element (Iter) /= No_Source loop + Source := Prj.Element (Iter); + Excluded := Excluded_Sources_Htable.Get + (Excluded_Sources, Source.File); + + if Excluded /= No_File_Found then + Source.Locally_Removed := True; + Source.In_Interfaces := False; + + if Current_Verbosity = High then + Write_Str ("Removing file "); + Write_Line + (Get_Name_String (Excluded.File) + & " " & Get_Name_String (Source.Project.Name)); + end if; + + Excluded_Sources_Htable.Remove + (Excluded_Sources, Source.File); end if; - Excluded_Sources_Htable.Remove - (Excluded_Sources, Source.File); - end if; + Next (Iter); + end loop; - Next (Iter); + Proj := Proj.Extends; end loop; - - Proj := Proj.Extends; - end loop; + end if; -- If we have any excluded element left, that means we did not find -- the source file Excluded := Excluded_Sources_Htable.Get_First (Excluded_Sources); while Excluded /= No_File_Found loop + if not Excluded.Found then - -- Check if the file belongs to another imported project to - -- provide a better error message. + -- Check if the file belongs to another imported project to + -- provide a better error message. - Src := Find_Source - (In_Tree => In_Tree, - Project => Project, - In_Imported_Only => True, - Base_Name => Excluded.File); + Src := Find_Source + (In_Tree => In_Tree, + Project => Project, + In_Imported_Only => True, + Base_Name => Excluded.File); - Err_Vars.Error_Msg_File_1 := Excluded.File; + Err_Vars.Error_Msg_File_1 := Excluded.File; - if Src = No_Source then - Error_Msg - (Project, In_Tree, "unknown file {", Excluded.Location); - else - Error_Msg - (Project, In_Tree, - "cannot remove a source from an imported project: {", - Excluded.Location); + if Src = No_Source then + Error_Msg + (Project, In_Tree, "unknown file {", Excluded.Location); + else + Error_Msg + (Project, In_Tree, + "cannot remove a source from an imported project: {", + Excluded.Location); + end if; end if; Excluded := Excluded_Sources_Htable.Get_Next (Excluded_Sources); |