diff options
Diffstat (limited to 'gcc/ada/prj-nmsc.adb')
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 369 |
1 files changed, 198 insertions, 171 deletions
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 743a1fc79ca..bc6c8ec9919 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -507,7 +507,8 @@ package body Prj.Nmsc is -- when there are no sources for language Lang_Name. procedure Show_Source_Dirs - (Project : Project_Id; In_Tree : Project_Tree_Ref); + (Project : Project_Id; + Shared : Shared_Project_Tree_Data_Access); -- List all the source directories of a project procedure Write_Attr (Name, Value : String); @@ -651,7 +652,6 @@ package body Prj.Nmsc is Add_Src : Boolean; Source : Source_Id; Prev_Unit : Unit_Index := No_Unit_Index; - Source_To_Replace : Source_Id := No_Source; begin @@ -939,7 +939,7 @@ package body Prj.Nmsc is Prj.Util.Value_Of (Snames.Name_Project_Files, Project.Decl.Attributes, - Tree); + Tree.Shared); Project_Path_For_Aggregate : Prj.Env.Project_Search_Path; @@ -958,22 +958,27 @@ package body Prj.Nmsc is procedure Found_Project_File (Path : Path_Information; Rank : Natural) is pragma Unreferenced (Rank); begin - Debug_Output ("Aggregates: ", Name_Id (Path.Display_Name)); - - -- For usual "with" statement, this phase will have been done when - -- parsing the project itself. However, for aggregate projects, we - -- can only do this when processing the aggregate project, since the - -- exact list of project files or project directories can depend on - -- scenario variables. - -- - -- We only load the projects explicitly here, but do not process - -- them. For the processing, Prj.Proc will take care of processing - -- them, within the same call to Recursive_Process (thus avoiding the - -- processing of a given project multiple times). - -- - -- ??? We might already have loaded the project - - Add_Aggregated_Project (Project, Path => Path.Name); + if Path.Name /= Project.Path.Name then + Debug_Output ("Aggregates: ", Name_Id (Path.Display_Name)); + + -- For usual "with" statement, this phase will have been done when + -- parsing the project itself. However, for aggregate projects, we + -- can only do this when processing the aggregate project, since + -- the exact list of project files or project directories can + -- depend on scenario variables. + -- + -- We only load the projects explicitly here, but do not process + -- them. For the processing, Prj.Proc will take care of processing + -- them, within the same call to Recursive_Process (thus avoiding + -- the processing of a given project multiple times). + -- + -- ??? We might already have loaded the project + + Add_Aggregated_Project (Project, Path => Path.Name); + + else + Debug_Output ("Pattern returned the aggregate itself, ignored"); + end if; end Found_Project_File; -- Start of processing for Check_Aggregate_Project @@ -1021,22 +1026,24 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Source_Dirs : constant Variable_Value := Util.Value_Of (Name_Source_Dirs, - Project.Decl.Attributes, Data.Tree); + Project.Decl.Attributes, Shared); Source_Files : constant Variable_Value := Util.Value_Of (Name_Source_Files, - Project.Decl.Attributes, Data.Tree); + Project.Decl.Attributes, Shared); Source_List_File : constant Variable_Value := Util.Value_Of (Name_Source_List_File, - Project.Decl.Attributes, Data.Tree); + Project.Decl.Attributes, Shared); Languages : constant Variable_Value := Util.Value_Of (Name_Languages, - Project.Decl.Attributes, Data.Tree); + Project.Decl.Attributes, Shared); begin if Project.Source_Dirs /= Nil_String then @@ -1065,6 +1072,7 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; Prj_Data : Project_Processing_Data; begin @@ -1079,7 +1087,7 @@ package body Prj.Nmsc is Check_Programming_Languages (Project, Data); if Current_Verbosity = High then - Show_Source_Dirs (Project, Data.Tree); + Show_Source_Dirs (Project, Shared); end if; end if; @@ -1303,6 +1311,9 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := + Data.Tree.Shared; + Dot_Replacement : File_Name_Type := No_File; Casing : Casing_Type := All_Lower_Case; Separate_Suffix : File_Name_Type := No_File; @@ -1364,11 +1375,11 @@ package body Prj.Nmsc is Current_Array_Id := Arrays; while Current_Array_Id /= No_Array loop - Current_Array := Data.Tree.Arrays.Table (Current_Array_Id); + Current_Array := Shared.Arrays.Table (Current_Array_Id); Element_Id := Current_Array.Value; while Element_Id /= No_Array_Element loop - Element := Data.Tree.Array_Elements.Table (Element_Id); + Element := Shared.Array_Elements.Table (Element_Id); if Element.Index /= All_Other_Names then @@ -1441,8 +1452,7 @@ package body Prj.Nmsc is Attribute_Id := Attributes; while Attribute_Id /= No_Variable loop - Attribute := - Data.Tree.Variable_Elements.Table (Attribute_Id); + Attribute := Shared.Variable_Elements.Table (Attribute_Id); if not Attribute.Value.Default then if Attribute.Name = Name_Executable_Suffix then @@ -1475,11 +1485,11 @@ package body Prj.Nmsc is Current_Array_Id := Arrays; while Current_Array_Id /= No_Array loop - Current_Array := Data.Tree.Arrays.Table (Current_Array_Id); + Current_Array := Shared.Arrays.Table (Current_Array_Id); Element_Id := Current_Array.Value; while Element_Id /= No_Array_Element loop - Element := Data.Tree.Array_Elements.Table (Element_Id); + Element := Shared.Array_Elements.Table (Element_Id); if Element.Index /= All_Other_Names then @@ -1806,7 +1816,7 @@ package body Prj.Nmsc is Attribute_Id := Attributes; while Attribute_Id /= No_Variable loop - Attribute := Data.Tree.Variable_Elements.Table (Attribute_Id); + Attribute := Shared.Variable_Elements.Table (Attribute_Id); if not Attribute.Value.Default then if Attribute.Name = Name_Separate_Suffix then @@ -1857,11 +1867,11 @@ package body Prj.Nmsc is Current_Array_Id := Arrays; while Current_Array_Id /= No_Array loop - Current_Array := Data.Tree.Arrays.Table (Current_Array_Id); + Current_Array := Shared.Arrays.Table (Current_Array_Id); Element_Id := Current_Array.Value; while Element_Id /= No_Array_Element loop - Element := Data.Tree.Array_Elements.Table (Element_Id); + Element := Shared.Array_Elements.Table (Element_Id); -- Get the name of the language @@ -1918,8 +1928,7 @@ package body Prj.Nmsc is Attribute_Id := Attributes; while Attribute_Id /= No_Variable loop - Attribute := - Data.Tree.Variable_Elements.Table (Attribute_Id); + Attribute := Shared.Variable_Elements.Table (Attribute_Id); if not Attribute.Value.Default then if Attribute.Name = Name_Driver then @@ -2026,7 +2035,7 @@ package body Prj.Nmsc is begin Packages := Project.Decl.Packages; while Packages /= No_Package loop - Element := Data.Tree.Packages.Table (Packages); + Element := Shared.Packages.Table (Packages); case Element.Name is when Name_Binder => @@ -2082,8 +2091,7 @@ package body Prj.Nmsc is Attribute_Id := Project.Decl.Attributes; while Attribute_Id /= No_Variable loop - Attribute := - Data.Tree.Variable_Elements.Table (Attribute_Id); + Attribute := Shared.Variable_Elements.Table (Attribute_Id); if not Attribute.Value.Default then if Attribute.Name = Name_Target then @@ -2400,11 +2408,11 @@ package body Prj.Nmsc is Current_Array_Id := Project.Decl.Arrays; while Current_Array_Id /= No_Array loop - Current_Array := Data.Tree.Arrays.Table (Current_Array_Id); + Current_Array := Shared.Arrays.Table (Current_Array_Id); Element_Id := Current_Array.Value; while Element_Id /= No_Array_Element loop - Element := Data.Tree.Array_Elements.Table (Element_Id); + Element := Shared.Array_Elements.Table (Element_Id); -- Get the name of the language @@ -2684,10 +2692,11 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; Externally_Built : constant Variable_Value := Util.Value_Of (Name_Externally_Built, - Project.Decl.Attributes, Data.Tree); + Project.Decl.Attributes, Shared); begin if not Externally_Built.Default then @@ -2726,17 +2735,19 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Interfaces : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Interfaces, Project.Decl.Attributes, - Data.Tree); + Shared); Library_Interface : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Interface, Project.Decl.Attributes, - Data.Tree); + Shared); List : String_List_Id; Element : String_Element; @@ -2767,7 +2778,7 @@ package body Prj.Nmsc is List := Interfaces.Values; while List /= Nil_String loop - Element := Data.Tree.String_Elements.Table (List); + Element := Shared.String_Elements.Table (List); Name := Canonical_Case_File_Name (Element.Value); Project_2 := Project; @@ -2840,7 +2851,7 @@ package body Prj.Nmsc is List := Library_Interface.Values; while List /= Nil_String loop - Element := Data.Tree.String_Elements.Table (List); + Element := Shared.String_Elements.Table (List); Get_Name_String (Element.Value); To_Lower (Name_Buffer (1 .. Name_Len)); Name := Name_Find; @@ -2913,9 +2924,10 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; Naming_Id : constant Package_Id := Util.Value_Of - (Name_Naming, Project.Decl.Packages, Data.Tree); + (Name_Naming, Project.Decl.Packages, Shared); Naming : Package_Element; Ada_Body_Suffix_Loc : Source_Ptr := No_Location; @@ -2957,17 +2969,17 @@ package body Prj.Nmsc is Util.Value_Of (Name_Dot_Replacement, Naming.Decl.Attributes, - Data.Tree); + Shared); Casing_String : constant Variable_Value := Util.Value_Of (Name_Casing, Naming.Decl.Attributes, - Data.Tree); + Shared); Sep_Suffix : constant Variable_Value := Util.Value_Of (Name_Separate_Suffix, Naming.Decl.Attributes, - Data.Tree); + Shared); Dot_Repl_Loc : Source_Ptr; begin @@ -3105,26 +3117,26 @@ package body Prj.Nmsc is Value_Of (Name_Implementation_Exceptions, In_Arrays => Naming.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); when Spec => Exceptions := Value_Of (Name_Specification_Exceptions, In_Arrays => Naming.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); end case; Exception_List := Value_Of (Index => Lang, In_Array => Exceptions, - In_Tree => Data.Tree); + Shared => Shared); if Exception_List /= Nil_Variable_Value then Element_Id := Exception_List.Values; while Element_Id /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Element_Id); + Element := Shared.String_Elements.Table (Element_Id); File_Name := Canonical_Case_File_Name (Element.Value); Source := @@ -3200,14 +3212,14 @@ package body Prj.Nmsc is Value_Of (Name_Body, In_Arrays => Naming.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); if Exceptions = No_Array_Element then Exceptions := Value_Of (Name_Implementation, In_Arrays => Naming.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); end if; when Spec => @@ -3215,19 +3227,19 @@ package body Prj.Nmsc is Value_Of (Name_Spec, In_Arrays => Naming.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); if Exceptions = No_Array_Element then Exceptions := Value_Of (Name_Spec, In_Arrays => Naming.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); end if; end case; while Exceptions /= No_Array_Element loop - Element := Data.Tree.Array_Elements.Table (Exceptions); + Element := Shared.Array_Elements.Table (Exceptions); File_Name := Canonical_Case_File_Name (Element.Value.Value); Get_Name_String (Element.Index); @@ -3332,14 +3344,14 @@ package body Prj.Nmsc is (Name => Lang, Attribute_Or_Array_Name => Name_Spec_Suffix, In_Package => Naming_Id, - In_Tree => Data.Tree); + Shared => Shared); if Suffix = Nil_Variable_Value then Suffix := Value_Of (Name => Lang, Attribute_Or_Array_Name => Name_Specification_Suffix, In_Package => Naming_Id, - In_Tree => Data.Tree); + Shared => Shared); end if; if Suffix /= Nil_Variable_Value then @@ -3364,7 +3376,7 @@ package body Prj.Nmsc is (Name => Lang, Attribute_Or_Array_Name => Name_Body_Suffix, In_Package => Naming_Id, - In_Tree => Data.Tree); + Shared => Shared); if Suffix = Nil_Variable_Value then Suffix := @@ -3372,7 +3384,7 @@ package body Prj.Nmsc is (Name => Lang, Attribute_Or_Array_Name => Name_Implementation_Suffix, In_Package => Naming_Id, - In_Tree => Data.Tree); + Shared => Shared); end if; if Suffix /= Nil_Variable_Value then @@ -3470,13 +3482,13 @@ package body Prj.Nmsc is Util.Value_Of (Name_Spec_Suffix, Naming.Decl.Arrays, - Data.Tree); + Shared); Impls : Array_Element_Id := Util.Value_Of (Name_Body_Suffix, Naming.Decl.Arrays, - Data.Tree); + Shared); Lang : Language_Ptr; Lang_Name : Name_Id; @@ -3489,7 +3501,7 @@ package body Prj.Nmsc is -- user project, and they override the default. while Specs /= No_Array_Element loop - Lang_Name := Data.Tree.Array_Elements.Table (Specs).Index; + Lang_Name := Shared.Array_Elements.Table (Specs).Index; Lang := Get_Language_From_Name (Project, Name => Get_Name_String (Lang_Name)); @@ -3523,7 +3535,7 @@ package body Prj.Nmsc is Lang_Name); else - Value := Data.Tree.Array_Elements.Table (Specs).Value; + Value := Shared.Array_Elements.Table (Specs).Value; if Value.Kind = Single then Lang.Config.Naming_Data.Spec_Suffix := @@ -3531,11 +3543,11 @@ package body Prj.Nmsc is end if; end if; - Specs := Data.Tree.Array_Elements.Table (Specs).Next; + Specs := Shared.Array_Elements.Table (Specs).Next; end loop; while Impls /= No_Array_Element loop - Lang_Name := Data.Tree.Array_Elements.Table (Impls).Index; + Lang_Name := Shared.Array_Elements.Table (Impls).Index; Lang := Get_Language_From_Name (Project, Name => Get_Name_String (Lang_Name)); @@ -3545,7 +3557,7 @@ package body Prj.Nmsc is ("Ignoring impl naming data (lang. not in project): ", Lang_Name); else - Value := Data.Tree.Array_Elements.Table (Impls).Value; + Value := Shared.Array_Elements.Table (Impls).Value; if Lang.Name = Name_Ada then Ada_Body_Suffix_Loc := Value.Location; @@ -3557,7 +3569,7 @@ package body Prj.Nmsc is end if; end if; - Impls := Data.Tree.Array_Elements.Table (Impls).Next; + Impls := Shared.Array_Elements.Table (Impls).Next; end loop; end Initialize_Naming_Data; @@ -3569,7 +3581,7 @@ package body Prj.Nmsc is if Naming_Id /= No_Package and then Project.Qualifier /= Configuration then - Naming := Data.Tree.Packages.Table (Naming_Id); + Naming := Shared.Packages.Table (Naming_Id); Debug_Increase_Indent ("Checking package Naming for ", Project.Name); Initialize_Naming_Data; Check_Naming; @@ -3585,31 +3597,33 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Attributes : constant Prj.Variable_Id := Project.Decl.Attributes; Lib_Dir : constant Prj.Variable_Value := Prj.Util.Value_Of - (Snames.Name_Library_Dir, Attributes, Data.Tree); + (Snames.Name_Library_Dir, Attributes, Shared); Lib_Name : constant Prj.Variable_Value := Prj.Util.Value_Of - (Snames.Name_Library_Name, Attributes, Data.Tree); + (Snames.Name_Library_Name, Attributes, Shared); Lib_Version : constant Prj.Variable_Value := Prj.Util.Value_Of - (Snames.Name_Library_Version, Attributes, Data.Tree); + (Snames.Name_Library_Version, Attributes, Shared); Lib_ALI_Dir : constant Prj.Variable_Value := Prj.Util.Value_Of - (Snames.Name_Library_Ali_Dir, Attributes, Data.Tree); + (Snames.Name_Library_Ali_Dir, Attributes, Shared); Lib_GCC : constant Prj.Variable_Value := Prj.Util.Value_Of - (Snames.Name_Library_GCC, Attributes, Data.Tree); + (Snames.Name_Library_GCC, Attributes, Shared); The_Lib_Kind : constant Prj.Variable_Value := Prj.Util.Value_Of - (Snames.Name_Library_Kind, Attributes, Data.Tree); + (Snames.Name_Library_Kind, Attributes, Shared); Imported_Project_List : Project_List; @@ -3839,7 +3853,7 @@ package body Prj.Nmsc is Dirs_Id := Project.Source_Dirs; while Dirs_Id /= Nil_String loop - Dir_Elem := Data.Tree.String_Elements.Table (Dirs_Id); + Dir_Elem := Shared.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Project.Library_Dir.Name = @@ -3871,7 +3885,7 @@ package body Prj.Nmsc is Dir_Loop : while Dirs_Id /= Nil_String loop Dir_Elem := - Data.Tree.String_Elements.Table (Dirs_Id); + Shared.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Project.Library_Dir.Name = @@ -4027,8 +4041,7 @@ package body Prj.Nmsc is Dirs_Id := Project.Source_Dirs; while Dirs_Id /= Nil_String loop - Dir_Elem := - Data.Tree.String_Elements.Table (Dirs_Id); + Dir_Elem := Shared.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Project.Library_ALI_Dir.Name = @@ -4061,8 +4074,7 @@ package body Prj.Nmsc is ALI_Dir_Loop : while Dirs_Id /= Nil_String loop Dir_Elem := - Data.Tree.String_Elements.Table - (Dirs_Id); + Shared.String_Elements.Table (Dirs_Id); Dirs_Id := Dir_Elem.Next; if Project.Library_ALI_Dir.Name = @@ -4178,14 +4190,14 @@ package body Prj.Nmsc is Value_Of (Name_Linker, Project.Decl.Packages, - Data.Tree); + Shared); Driver : constant Variable_Value := Value_Of (Name => No_Name, Attribute_Or_Array_Name => Name_Driver, In_Package => Linker, - In_Tree => Data.Tree); + Shared => Shared); begin if Driver /= Nil_Variable_Value @@ -4227,26 +4239,26 @@ package body Prj.Nmsc is Linker_Package_Id : constant Package_Id := Util.Value_Of (Name_Linker, - Project.Decl.Packages, Data.Tree); + Project.Decl.Packages, Shared); Linker_Package : Package_Element; Switches : Array_Element_Id := No_Array_Element; begin if Linker_Package_Id /= No_Package then - Linker_Package := Data.Tree.Packages.Table (Linker_Package_Id); + Linker_Package := Shared.Packages.Table (Linker_Package_Id); Switches := Value_Of (Name => Name_Switches, In_Arrays => Linker_Package.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); if Switches = No_Array_Element then Switches := Value_Of (Name => Name_Default_Switches, In_Arrays => Linker_Package.Decl.Arrays, - In_Tree => Data.Tree); + Shared => Shared); end if; if Switches /= No_Array_Element then @@ -4310,6 +4322,8 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Languages : Variable_Value := Nil_Variable_Value; Def_Lang : Variable_Value := Nil_Variable_Value; Def_Lang_Id : Name_Id; @@ -4354,10 +4368,10 @@ package body Prj.Nmsc is begin Project.Languages := null; Languages := - Prj.Util.Value_Of (Name_Languages, Project.Decl.Attributes, Data.Tree); + Prj.Util.Value_Of (Name_Languages, Project.Decl.Attributes, Shared); Def_Lang := Prj.Util.Value_Of - (Name_Default_Language, Project.Decl.Attributes, Data.Tree); + (Name_Default_Language, Project.Decl.Attributes, Shared); if Project.Source_Dirs /= Nil_String then @@ -4411,7 +4425,7 @@ package body Prj.Nmsc is -- Languages. while Current /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Current); + Element := Shared.String_Elements.Table (Current); Get_Name_String (Element.Value); To_Lower (Name_Buffer (1 .. Name_Len)); @@ -4435,41 +4449,43 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Lib_Interfaces : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Interface, Project.Decl.Attributes, - Data.Tree); + Shared); Lib_Auto_Init : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Auto_Init, Project.Decl.Attributes, - Data.Tree); + Shared); Lib_Src_Dir : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Src_Dir, Project.Decl.Attributes, - Data.Tree); + Shared); Lib_Symbol_File : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Symbol_File, Project.Decl.Attributes, - Data.Tree); + Shared); Lib_Symbol_Policy : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Symbol_Policy, Project.Decl.Attributes, - Data.Tree); + Shared); Lib_Ref_Symbol_File : constant Prj.Variable_Value := Prj.Util.Value_Of (Snames.Name_Library_Reference_Symbol_File, Project.Decl.Attributes, - Data.Tree); + Shared); Auto_Init_Supported : Boolean; OK : Boolean := True; @@ -4508,14 +4524,14 @@ package body Prj.Nmsc is while Interfaces /= Nil_String loop Get_Name_String - (Data.Tree.String_Elements.Table (Interfaces).Value); + (Shared.String_Elements.Table (Interfaces).Value); To_Lower (Name_Buffer (1 .. Name_Len)); if Name_Len = 0 then Error_Msg (Data.Flags, "an interface cannot be an empty string", - Data.Tree.String_Elements.Table (Interfaces).Location, + Shared.String_Elements.Table (Interfaces).Location, Project); else @@ -4564,8 +4580,8 @@ package body Prj.Nmsc is Error_Msg (Data.Flags, "%% is not a unit of this project", - Data.Tree.String_Elements.Table - (Interfaces).Location, Project); + Shared.String_Elements.Table (Interfaces).Location, + Project); else if Source.Kind = Spec @@ -4575,27 +4591,24 @@ package body Prj.Nmsc is end if; String_Element_Table.Increment_Last - (Data.Tree.String_Elements); + (Shared.String_Elements); - Data.Tree.String_Elements.Table - (String_Element_Table.Last - (Data.Tree.String_Elements)) := + Shared.String_Elements.Table + (String_Element_Table.Last (Shared.String_Elements)) := (Value => Name_Id (Source.Dep_Name), Index => 0, Display_Value => Name_Id (Source.Dep_Name), Location => - Data.Tree.String_Elements.Table - (Interfaces).Location, + Shared.String_Elements.Table (Interfaces).Location, Flag => False, Next => Interface_ALIs); Interface_ALIs := - String_Element_Table.Last - (Data.Tree.String_Elements); + String_Element_Table.Last (Shared.String_Elements); end if; end if; - Interfaces := Data.Tree.String_Elements.Table (Interfaces).Next; + Interfaces := Shared.String_Elements.Table (Interfaces).Next; end loop; -- Put the list of Interface ALIs in the project data @@ -4703,7 +4716,7 @@ package body Prj.Nmsc is Src_Dirs := Project.Source_Dirs; while Src_Dirs /= Nil_String loop - Src_Dir := Data.Tree.String_Elements.Table (Src_Dirs); + Src_Dir := Shared.String_Elements.Table (Src_Dirs); -- Report error if it is one of the source directories @@ -4734,7 +4747,7 @@ package body Prj.Nmsc is Src_Dirs := Pid.Project.Source_Dirs; Dir_Loop : while Src_Dirs /= Nil_String loop Src_Dir := - Data.Tree.String_Elements.Table (Src_Dirs); + Shared.String_Elements.Table (Src_Dirs); -- Report error if it is one of the source -- directories. @@ -5002,41 +5015,43 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Object_Dir : constant Variable_Value := Util.Value_Of - (Name_Object_Dir, Project.Decl.Attributes, Data.Tree); + (Name_Object_Dir, Project.Decl.Attributes, Shared); Exec_Dir : constant Variable_Value := Util.Value_Of - (Name_Exec_Dir, Project.Decl.Attributes, Data.Tree); + (Name_Exec_Dir, Project.Decl.Attributes, Shared); Source_Dirs : constant Variable_Value := Util.Value_Of - (Name_Source_Dirs, Project.Decl.Attributes, Data.Tree); + (Name_Source_Dirs, Project.Decl.Attributes, Shared); Ignore_Source_Sub_Dirs : constant Variable_Value := Util.Value_Of (Name_Ignore_Source_Sub_Dirs, Project.Decl.Attributes, - Data.Tree); + Shared); Excluded_Source_Dirs : constant Variable_Value := Util.Value_Of (Name_Excluded_Source_Dirs, Project.Decl.Attributes, - Data.Tree); + Shared); Source_Files : constant Variable_Value := Util.Value_Of (Name_Source_Files, - Project.Decl.Attributes, Data.Tree); + Project.Decl.Attributes, Shared); Last_Source_Dir : String_List_Id := Nil_String; Last_Src_Dir_Rank : Number_List_Index := No_Number_List; Languages : constant Variable_Value := Prj.Util.Value_Of - (Name_Languages, Project.Decl.Attributes, Data.Tree); + (Name_Languages, Project.Decl.Attributes, Shared); Remove_Source_Dirs : Boolean := False; @@ -5070,12 +5085,12 @@ package body Prj.Nmsc is List := Project.Source_Dirs; Rank_List := Project.Source_Dir_Ranks; while List /= Nil_String loop - Element := Data.Tree.String_Elements.Table (List); + Element := Shared.String_Elements.Table (List); exit when Element.Value = Name_Id (Path.Name); Prev := List; List := Element.Next; Prev_Rank := Rank_List; - Rank_List := Data.Tree.Number_Lists.Table (Prev_Rank).Next; + Rank_List := Shared.Number_Lists.Table (Prev_Rank).Next; end loop; -- The directory is in the list if List is not Nil_String @@ -5083,7 +5098,7 @@ package body Prj.Nmsc is if not Remove_Source_Dirs and then List = Nil_String then Debug_Output ("Adding source dir=", Name_Id (Path.Display_Name)); - String_Element_Table.Increment_Last (Data.Tree.String_Elements); + String_Element_Table.Increment_Last (Shared.String_Elements); Element := (Value => Name_Id (Path.Name), Index => 0, @@ -5092,35 +5107,34 @@ package body Prj.Nmsc is Flag => False, Next => Nil_String); - Number_List_Table.Increment_Last (Data.Tree.Number_Lists); + Number_List_Table.Increment_Last (Shared.Number_Lists); if Last_Source_Dir = Nil_String then -- This is the first source directory Project.Source_Dirs := - String_Element_Table.Last (Data.Tree.String_Elements); + String_Element_Table.Last (Shared.String_Elements); Project.Source_Dir_Ranks := - Number_List_Table.Last (Data.Tree.Number_Lists); + Number_List_Table.Last (Shared.Number_Lists); else -- We already have source directories, link the previous -- last to the new one. - Data.Tree.String_Elements.Table (Last_Source_Dir).Next := - String_Element_Table.Last (Data.Tree.String_Elements); - Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank).Next := - Number_List_Table.Last (Data.Tree.Number_Lists); + Shared.String_Elements.Table (Last_Source_Dir).Next := + String_Element_Table.Last (Shared.String_Elements); + Shared.Number_Lists.Table (Last_Src_Dir_Rank).Next := + Number_List_Table.Last (Shared.Number_Lists); end if; -- And register this source directory as the new last Last_Source_Dir := - String_Element_Table.Last (Data.Tree.String_Elements); - Data.Tree.String_Elements.Table (Last_Source_Dir) := Element; - Last_Src_Dir_Rank := - Number_List_Table.Last (Data.Tree.Number_Lists); - Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank) := + String_Element_Table.Last (Shared.String_Elements); + Shared.String_Elements.Table (Last_Source_Dir) := Element; + Last_Src_Dir_Rank := Number_List_Table.Last (Shared.Number_Lists); + Shared.Number_Lists.Table (Last_Src_Dir_Rank) := (Number => Rank, Next => No_Number_List); elsif Remove_Source_Dirs and then List /= Nil_String then @@ -5128,16 +5142,15 @@ package body Prj.Nmsc is -- Remove source dir if present if Prev = Nil_String then - Project.Source_Dirs := - Data.Tree.String_Elements.Table (List).Next; + Project.Source_Dirs := Shared.String_Elements.Table (List).Next; Project.Source_Dir_Ranks := - Data.Tree.Number_Lists.Table (Rank_List).Next; + Shared.Number_Lists.Table (Rank_List).Next; else - Data.Tree.String_Elements.Table (Prev).Next := - Data.Tree.String_Elements.Table (List).Next; - Data.Tree.Number_Lists.Table (Prev_Rank).Next := - Data.Tree.Number_Lists.Table (Rank_List).Next; + Shared.String_Elements.Table (Prev).Next := + Shared.String_Elements.Table (List).Next; + Shared.Number_Lists.Table (Prev_Rank).Next := + Shared.Number_Lists.Table (Rank_List).Next; end if; end if; end Add_To_Or_Remove_From_Source_Dirs; @@ -5357,11 +5370,11 @@ package body Prj.Nmsc is begin while Current /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Current); + Element := Shared.String_Elements.Table (Current); if Element.Value /= No_Name then Element.Value := Name_Id (Canonical_Case_File_Name (Element.Value)); - Data.Tree.String_Elements.Table (Current) := Element; + Shared.String_Elements.Table (Current) := Element; end if; Current := Element.Next; @@ -5377,9 +5390,11 @@ package body Prj.Nmsc is (Project : Project_Id; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Mains : constant Variable_Value := Prj.Util.Value_Of - (Name_Main, Project.Decl.Attributes, Data.Tree); + (Name_Main, Project.Decl.Attributes, Shared); List : String_List_Id; Elem : String_Element; @@ -5405,7 +5420,7 @@ package body Prj.Nmsc is else List := Mains.Values; while List /= Nil_String loop - Elem := Data.Tree.String_Elements.Table (List); + Elem := Shared.String_Elements.Table (List); if Length_Of_Name (Elem.Value) = 0 then Error_Msg @@ -5972,15 +5987,17 @@ package body Prj.Nmsc is (Project : in out Project_Processing_Data; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Excluded_Source_List_File : constant Variable_Value := Util.Value_Of (Name_Excluded_Source_List_File, Project.Project.Decl.Attributes, - Data.Tree); + Shared); Excluded_Sources : Variable_Value := Util.Value_Of (Name_Excluded_Source_Files, Project.Project.Decl.Attributes, - Data.Tree); + Shared); Current : String_List_Id; Element : String_Element; @@ -5999,7 +6016,7 @@ package body Prj.Nmsc is Excluded_Sources := Util.Value_Of (Name_Locally_Removed_Files, - Project.Project.Decl.Attributes, Data.Tree); + Project.Project.Decl.Attributes, Shared); end if; -- If there are excluded sources, put them in the table @@ -6023,7 +6040,7 @@ package body Prj.Nmsc is Current := Excluded_Sources.Values; while Current /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Current); + Element := Shared.String_Elements.Table (Current); Name := Canonical_Case_File_Name (Element.Value); -- If the element has no location, then use the location of @@ -6129,17 +6146,19 @@ package body Prj.Nmsc is (Project : in out Project_Processing_Data; Data : in out Tree_Processing_Data) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Sources : constant Variable_Value := Util.Value_Of (Name_Source_Files, Project.Project.Decl.Attributes, - Data.Tree); + Shared); Source_List_File : constant Variable_Value := Util.Value_Of (Name_Source_List_File, Project.Project.Decl.Attributes, - Data.Tree); + Shared); Name_Loc : Name_Location; Has_Explicit_Sources : Boolean; @@ -6188,7 +6207,7 @@ package body Prj.Nmsc is end if; while Current /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Current); + Element := Shared.String_Elements.Table (Current); Name := Canonical_Case_File_Name (Element.Value); Get_Name_String (Element.Value); @@ -6810,6 +6829,8 @@ package body Prj.Nmsc is Search_For : Search_Type; Resolve_Links : Boolean) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + package Recursive_Dirs is new GNAT.Dynamic_HTables.Simple_HTable (Header_Num => Header_Num, Element => Boolean, @@ -6950,13 +6971,12 @@ package body Prj.Nmsc is while List /= Nil_String loop Get_Name_String - (Data.Tree.String_Elements.Table (List).Value); + (Shared.String_Elements.Table (List).Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); OK := Name_Buffer (1 .. Name_Len) /= Dir_Name; exit when not OK; - List := - Data.Tree.String_Elements.Table (List).Next; + List := Shared.String_Elements.Table (List).Next; end loop; end; end if; @@ -7116,7 +7136,7 @@ package body Prj.Nmsc is begin while Pattern_Id /= Nil_String loop - Element := Data.Tree.String_Elements.Table (Pattern_Id); + Element := Shared.String_Elements.Table (Pattern_Id); Find_Pattern (Element.Value, Rank, Element.Location); Rank := Rank + 1; Pattern_Id := Element.Next; @@ -7134,6 +7154,8 @@ package body Prj.Nmsc is Data : in out Tree_Processing_Data; For_All_Sources : Boolean) is + Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared; + Source_Dir : String_List_Id; Element : String_Element; Src_Dir_Rank : Number_List_Index; @@ -7153,8 +7175,8 @@ package body Prj.Nmsc is Src_Dir_Rank := Project.Project.Source_Dir_Ranks; while Source_Dir /= Nil_String loop begin - Num_Nod := Data.Tree.Number_Lists.Table (Src_Dir_Rank); - Element := Data.Tree.String_Elements.Table (Source_Dir); + Num_Nod := Shared.Number_Lists.Table (Src_Dir_Rank); + Element := Shared.String_Elements.Table (Source_Dir); -- Use Element.Value in this test, not Display_Value, because we -- want the symbolic links to be resolved when appropriate. @@ -7932,7 +7954,7 @@ package body Prj.Nmsc is procedure Show_Source_Dirs (Project : Project_Id; - In_Tree : Project_Tree_Ref) + Shared : Shared_Project_Tree_Data_Access) is Current : String_List_Id; Element : String_Element; @@ -7945,7 +7967,7 @@ package body Prj.Nmsc is Current := Project.Source_Dirs; while Current /= Nil_String loop - Element := In_Tree.String_Elements.Table (Current); + Element := Shared.String_Elements.Table (Current); Debug_Output (Get_Name_String (Element.Display_Value)); Current := Element.Next; end loop; @@ -7965,8 +7987,9 @@ package body Prj.Nmsc is Flags : Processing_Flags) is procedure Recursive_Check - (Project : Project_Id; - Data : in out Tree_Processing_Data); + (Project : Project_Id; + Prj_Tree : Project_Tree_Ref; + Data : in out Tree_Processing_Data); -- Check_Naming_Scheme for the project --------------------- @@ -7974,17 +7997,21 @@ package body Prj.Nmsc is --------------------- procedure Recursive_Check - (Project : Project_Id; - Data : in out Tree_Processing_Data) - is + (Project : Project_Id; + Prj_Tree : Project_Tree_Ref; + Data : in out Tree_Processing_Data) is begin - if Verbose_Mode then - Write_Str ("Processing_Naming_Scheme for project """); - Write_Str (Get_Name_String (Project.Name)); - Write_Line (""""); + if Current_Verbosity = High then + Debug_Increase_Indent + ("Processing_Naming_Scheme for project", Project.Name); end if; + Data.Tree := Prj_Tree; Prj.Nmsc.Check (Project, Data); + + if Current_Verbosity = High then + Debug_Decrease_Indent ("Done Processing_Naming_Scheme"); + end if; end Recursive_Check; procedure Check_All_Projects is new @@ -7996,7 +8023,7 @@ package body Prj.Nmsc is begin Lib_Data_Table.Init; Initialize (Data, Tree => Tree, Node_Tree => Node_Tree, Flags => Flags); - Check_All_Projects (Root_Project, Data, Imported_First => True); + Check_All_Projects (Root_Project, Tree, Data, Imported_First => True); Free (Data); -- Adjust language configs for projects that are extended |