From b02a9f75f714b7d86d90748f16b3d5795c014498 Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 13 Jul 2009 08:06:51 +0000 Subject: [PATCH] 2009-07-13 Emmanuel Briot * prj-nmsc.adb: Avoid traversing the list of source files if we have already processed all locally removed files. 2009-07-13 Jose Ruiz * gnat_ugn.texi: Fix typo. 2009-07-13 Robert Dewar * freeze.adb: Minor reformatting Minor code reorganization (use Nkind_In) * exp_ch6.adb: Minor reformatting git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149546 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 16 +++++++++ gcc/ada/exp_ch6.adb | 1 - gcc/ada/freeze.adb | 19 ++++------- gcc/ada/gnat_ugn.texi | 2 +- gcc/ada/prj-nmsc.adb | 90 +++++++++++++++++++++++++++++---------------------- 5 files changed, 75 insertions(+), 53 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7f2c2e2..c2fd750 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2009-07-13 Emmanuel Briot + + * prj-nmsc.adb: Avoid traversing the list of source files if + we have already processed all locally removed files. + +2009-07-13 Jose Ruiz + + * gnat_ugn.texi: Fix typo. + +2009-07-13 Robert Dewar + + * freeze.adb: Minor reformatting + Minor code reorganization (use Nkind_In) + + * exp_ch6.adb: Minor reformatting + 2009-07-11 Eric Botcazou * checks.adb (Apply_Address_Clause_Check): Remove Size_Warning_Output diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 3142174..2d80cbc 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -4669,7 +4669,6 @@ package body Exp_Ch6 is if Ekind (Subp) = E_Function then Resolve (N, Etype (Subp)); end if; - end Expand_Protected_Subprogram_Call; -------------------------------- diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index f464f19..231ec87 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1133,8 +1133,7 @@ package body Freeze is Par := Parent (Par); end if; - if (Nkind (Par) = N_Object_Declaration - or else Nkind (Par) = N_Assignment_Statement) + if Nkind_In (Par, N_Object_Declaration, N_Assignment_Statement) and then Comes_From_Source (Par) then Temp := @@ -1469,7 +1468,7 @@ package body Freeze is ---------------------------- function After_Last_Declaration return Boolean is - Spec : constant Node_Id := Parent (Current_Scope); + Spec : constant Node_Id := Parent (Current_Scope); begin if Nkind (Spec) = N_Package_Specification then if Present (Private_Declarations (Spec)) then @@ -1534,9 +1533,7 @@ package body Freeze is -- either a tagged type, or a limited record. if Is_Limited_Type (Rec_Type) - and then - (Ada_Version < Ada_05 - or else Is_Tagged_Type (Rec_Type)) + and then (Ada_Version < Ada_05 or else Is_Tagged_Type (Rec_Type)) then return; @@ -2367,7 +2364,7 @@ package body Freeze is and then Present (Expression (Parent (E))) and then Nkind (Expression (Parent (E))) = N_Aggregate and then - Expand_Atomic_Aggregate (Expression (Parent (E)), Etype (E)) + Expand_Atomic_Aggregate (Expression (Parent (E)), Etype (E)) then null; end if; @@ -2375,8 +2372,8 @@ package body Freeze is -- For a subprogram, freeze all parameter types and also the return -- type (RM 13.14(14)). However skip this for internal subprograms. -- This is also the point where any extra formal parameters are - -- created since we now know whether the subprogram will use - -- a foreign convention. + -- created since we now know whether the subprogram will use a + -- foreign convention. if Is_Subprogram (E) then if not Is_Internal (E) then @@ -2402,12 +2399,10 @@ package body Freeze is -- If the type of a formal is incomplete, subprogram -- is being frozen prematurely. Within an instance -- (but not within a wrapper package) this is an - -- an artifact of our need to regard the end of an + -- artifact of our need to regard the end of an -- instantiation as a freeze point. Otherwise it is -- a definite error. - -- and then not Is_Wrapper_Package (Current_Scope) ??? - if In_Instance then Set_Is_Frozen (E, False); return No_List; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 4242ef0..b7e4bcf 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -13310,7 +13310,7 @@ file. If the order of the source directories is not known statically, it is an error to have several files with the same source file name. Projects can be specified to have no Ada source -files: the value of (@code{Source_Dirs} or @code{Source_Files} may be an empty +files: the value of @code{Source_Dirs} or @code{Source_Files} may be an empty list, or the @code{"Ada"} may be absent from @code{Languages}: @smallexample @c projectfile 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); -- 2.7.4