diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-17 10:38:31 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-17 10:38:31 +0000 |
commit | 7ac0f4a57adbba6fd8e68bb4619055459b1f6f9f (patch) | |
tree | 49238d52872cb62ea7b3b2ed01b0bb7f1bcb4397 | |
parent | 84ec5566784efbac633966ca76a31eca3160dcc0 (diff) | |
download | gcc-7ac0f4a57adbba6fd8e68bb4619055459b1f6f9f.tar.gz |
2009-09-17 Bob Duff <duff@adacore.com>
* gnat_rm.texi, s-oscons-tmplt.c: Minor typo
2009-09-17 Emmanuel Briot <briot@adacore.com>
* gnatcmd.adb, prj-proc.adb, make.adb, prj-ext.adb, prj-ext.ads,
makeutl.adb, makeutl.ads, clean.adb, prj-pars.adb, prj-pars.ads,
prj-conf.adb, prj-conf.ads, prj-tree.adb, prj-tree.ads, prj-proc.ads,
prj-nmsc.ads (Add, Value_Of, Reset): new parameter Tree.
Scenario variables are now specific to each project tree loaded in
memory.
Code clean ups.
2009-09-17 Javier Miranda <miranda@adacore.com>
* exp_disp.adb (Make_DT): Remove wrong line of code that was
undocumented and probably added by mistake.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151792 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/ada/clean.adb | 11 | ||||
-rw-r--r-- | gcc/ada/exp_disp.adb | 5 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 4 | ||||
-rw-r--r-- | gcc/ada/gnatcmd.adb | 16 | ||||
-rw-r--r-- | gcc/ada/make.adb | 113 | ||||
-rw-r--r-- | gcc/ada/makeutl.adb | 8 | ||||
-rw-r--r-- | gcc/ada/makeutl.ads | 5 | ||||
-rw-r--r-- | gcc/ada/prj-conf.adb | 1 | ||||
-rw-r--r-- | gcc/ada/prj-conf.ads | 4 | ||||
-rw-r--r-- | gcc/ada/prj-ext.adb | 43 | ||||
-rw-r--r-- | gcc/ada/prj-ext.ads | 30 | ||||
-rw-r--r-- | gcc/ada/prj-nmsc.ads | 11 | ||||
-rw-r--r-- | gcc/ada/prj-pars.adb | 11 | ||||
-rw-r--r-- | gcc/ada/prj-pars.ads | 15 | ||||
-rw-r--r-- | gcc/ada/prj-proc.adb | 3 | ||||
-rw-r--r-- | gcc/ada/prj-proc.ads | 2 | ||||
-rw-r--r-- | gcc/ada/prj-tree.adb | 4 | ||||
-rw-r--r-- | gcc/ada/prj-tree.ads | 15 | ||||
-rw-r--r-- | gcc/ada/s-oscons-tmplt.c | 2 |
20 files changed, 220 insertions, 102 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dae5c00e6a3..f908caf69f8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,22 @@ +2009-09-17 Bob Duff <duff@adacore.com> + + * gnat_rm.texi, s-oscons-tmplt.c: Minor typo + +2009-09-17 Emmanuel Briot <briot@adacore.com> + + * gnatcmd.adb, prj-proc.adb, make.adb, prj-ext.adb, prj-ext.ads, + makeutl.adb, makeutl.ads, clean.adb, prj-pars.adb, prj-pars.ads, + prj-conf.adb, prj-conf.ads, prj-tree.adb, prj-tree.ads, prj-proc.ads, + prj-nmsc.ads (Add, Value_Of, Reset): new parameter Tree. + Scenario variables are now specific to each project tree loaded in + memory. + Code clean ups. + +2009-09-17 Javier Miranda <miranda@adacore.com> + + * exp_disp.adb (Make_DT): Remove wrong line of code that was + undocumented and probably added by mistake. + 2009-09-16 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Strip diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb index 790b8423529..a113e6bc844 100644 --- a/gcc/ada/clean.adb +++ b/gcc/ada/clean.adb @@ -35,6 +35,7 @@ with Prj; use Prj; with Prj.Env; with Prj.Ext; with Prj.Pars; +with Prj.Tree; use Prj.Tree; with Prj.Util; use Prj.Util; with Snames; with Switch; use Switch; @@ -90,7 +91,7 @@ package body Clean is Project_File_Name : String_Access := null; - Project_Tree : constant Prj.Project_Tree_Ref := new Prj.Project_Tree_Data; + Project_Node_Tree : Project_Node_Tree_Ref; Main_Project : Prj.Project_Id := Prj.No_Project; @@ -1402,6 +1403,7 @@ package body Clean is Prj.Pars.Parse (Project => Main_Project, In_Tree => Project_Tree, + In_Node_Tree => Project_Node_Tree, Project_File_Name => Project_File_Name.all, Flags => Gnatmake_Flags, Packages_To_Check => Packages_To_Check_By_Gnatmake); @@ -1556,6 +1558,10 @@ package body Clean is Csets.Initialize; Namet.Initialize; Snames.Initialize; + + Project_Node_Tree := new Project_Node_Tree_Data; + Prj.Tree.Initialize (Project_Node_Tree); + Prj.Initialize (Project_Tree); -- Check if the platform is VMS and, if it is, change some variables @@ -1873,7 +1879,8 @@ package body Clean is if OK then Prj.Ext.Add - (External_Name => + (Project_Node_Tree, + External_Name => Ext_Asgn (Start .. Equal_Pos - 1), Value => Ext_Asgn (Equal_Pos + 1 .. Stop)); diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 34aacef8c25..00fd9f22e70 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -5140,9 +5140,8 @@ package body Exp_Disp is exit when Parent_Typ = Current_Typ; - if Is_CPP_Class (Parent_Typ) - or else Is_Interface (Typ) - then + if Is_CPP_Class (Parent_Typ) then + -- The tags defined in the C++ side will be inherited when -- the object is constructed (Exp_Ch3.Build_Init_Procedure) diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 1f26563397b..e25400d09fc 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -7733,11 +7733,11 @@ Followed. In addition to the implementation dependent pragmas and attributes, and the implementation advice, there are a number of other Ada features that are potentially implementation dependent. These are mentioned -throughout the Ada Reference Manual, and are summarized in annex M@. +throughout the Ada Reference Manual, and are summarized in Annex M@. A requirement for conforming Ada compilers is that they provide documentation describing how the implementation deals with each of these -issues. In this chapter, you will find each point in annex M listed +issues. In this chapter, you will find each point in Annex M listed followed by a description in italic font of how GNAT @c SGI info: @ignore diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 42d08dcd48f..d3f74c075dc 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -26,7 +26,7 @@ with GNAT.Directory_Operations; use GNAT.Directory_Operations; with Csets; -with Makeutl; +with Makeutl; use Makeutl; with MLib.Tgt; use MLib.Tgt; with MLib.Utl; with MLib.Fil; @@ -38,6 +38,7 @@ with Prj; use Prj; with Prj.Env; with Prj.Ext; use Prj.Ext; with Prj.Pars; +with Prj.Tree; use Prj.Tree; with Prj.Util; use Prj.Util; with Sinput.P; with Snames; use Snames; @@ -57,7 +58,7 @@ with GNAT.OS_Lib; use GNAT.OS_Lib; with VMS_Conv; use VMS_Conv; procedure GNATCmd is - Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data; + Project_Node_Tree : Project_Node_Tree_Ref; Project_File : String_Access; Project : Prj.Project_Id; Current_Verbosity : Prj.Verbosity := Prj.Default; @@ -1268,6 +1269,9 @@ begin Snames.Initialize; + Project_Node_Tree := new Project_Node_Tree_Data; + Prj.Tree.Initialize (Project_Node_Tree); + Prj.Initialize (Project_Tree); Last_Switches.Init; @@ -1694,7 +1698,8 @@ begin begin if Equal_Pos >= Argv'First + 3 and then Equal_Pos /= Argv'Last then - Add (External_Name => + Add (Project_Node_Tree, + External_Name => Argv (Argv'First + 2 .. Equal_Pos - 1), Value => Argv (Equal_Pos + 1 .. Argv'Last)); else @@ -1753,6 +1758,7 @@ begin Prj.Pars.Parse (Project => Project, In_Tree => Project_Tree, + In_Node_Tree => Project_Node_Tree, Project_File_Name => Project_File.all, Flags => Gnatmake_Flags, Packages_To_Check => Packages_To_Check); @@ -2114,7 +2120,7 @@ begin -- arguments. for J in 1 .. Last_Switches.Last loop - Test_If_Relative_Path + GNATCmd.Test_If_Relative_Path (Last_Switches.Table (J), Current_Work_Dir); end loop; @@ -2124,7 +2130,7 @@ begin Project_Dir : constant String := Name_Buffer (1 .. Name_Len); begin for J in 1 .. First_Switches.Last loop - Test_If_Relative_Path + GNATCmd.Test_If_Relative_Path (First_Switches.Table (J), Project_Dir); end loop; end; diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index b19aa22da71..5471c971e6c 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -49,10 +49,16 @@ with Prj; use Prj; with Prj.Com; with Prj.Env; with Prj.Pars; +with Prj.Tree; use Prj.Tree; with Prj.Util; with SFN_Scan; with Sinput.P; with Snames; use Snames; + +pragma Warnings (Off); +with System.HTable; +pragma Warnings (On); + with Switch; use Switch; with Switch.M; use Switch.M; with Targparm; use Targparm; @@ -68,8 +74,6 @@ with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables; with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.OS_Lib; use GNAT.OS_Lib; -with System.HTable; - package body Make is use ASCII; @@ -640,7 +644,7 @@ package body Make is -- directory of the ultimate extending project. If it is not, we ignore -- the fact that this ALI file is read-only. - procedure Process_Multilib; + procedure Process_Multilib (Project_Node_Tree : Project_Node_Tree_Ref); -- Add appropriate --RTS argument to handle multilib ---------------------------------------------------- @@ -710,7 +714,8 @@ package body Make is File_Name : String; Index : Int; Program : Make_Program_Type; - Unknown_Switches_To_The_Compiler : Boolean := True); + Unknown_Switches_To_The_Compiler : Boolean := True; + Project_Node_Tree : Project_Node_Tree_Ref); procedure Add_Switch (S : String_Access; Program : Make_Program_Type; @@ -998,7 +1003,7 @@ package body Make is -- during a compilation are also transitively included in the W section -- of the originally compiled file. - procedure Initialize; + procedure Initialize (Project_Node_Tree : out Project_Node_Tree_Ref); -- Performs default and package initialization. Therefore, -- Compile_Sources can be called by an external unit. @@ -1010,8 +1015,13 @@ package body Make is -- Args must have a lower bound of 1. Success indicates if the link -- succeeded or not. - procedure Scan_Make_Arg (Argv : String; And_Save : Boolean); - -- Scan make arguments. Argv is a single argument to be processed + procedure Scan_Make_Arg + (Project_Node_Tree : Project_Node_Tree_Ref; + Argv : String; + And_Save : Boolean); + -- Scan make arguments. Argv is a single argument to be processed. + -- Project_Node_Tree will be used to initialize external references. It + -- must have been initialized. ------------------- -- Add_Arguments -- @@ -1233,7 +1243,8 @@ package body Make is File_Name : String; Index : Int; Program : Make_Program_Type; - Unknown_Switches_To_The_Compiler : Boolean := True) + Unknown_Switches_To_The_Compiler : Boolean := True; + Project_Node_Tree : Project_Node_Tree_Ref) is Switches : Variable_Value; Switch_List : String_List_Id; @@ -1274,7 +1285,8 @@ package body Make is Write_Line (Argv); end if; - Scan_Make_Arg (Argv, And_Save => False); + Scan_Make_Arg + (Project_Node_Tree, Argv, And_Save => False); if not Gnatmake_Switch_Found and then not Switch_May_Be_Passed_To_The_Compiler @@ -4019,6 +4031,8 @@ package body Make is Mapping_Path : Path_Name_Type := No_Path; -- The path name of the mapping file + Project_Node_Tree : Project_Node_Tree_Ref; + Discard : Boolean; pragma Warnings (Off, Discard); @@ -4366,7 +4380,7 @@ package body Make is Obsoleted.Reset; - Make.Initialize; + Make.Initialize (Project_Node_Tree); Bind_Shared := No_Shared_Switch'Access; Link_With_Shared_Libgcc := No_Shared_Libgcc_Switch'Access; @@ -4845,7 +4859,8 @@ package body Make is end if; Add_Switches - (File_Name => Main_Unit_File_Name, + (Project_Node_Tree => Project_Node_Tree, + File_Name => Main_Unit_File_Name, Index => Main_Index, The_Package => Builder_Package, Program => None, @@ -4900,7 +4915,8 @@ package body Make is end if; Add_Switches - (File_Name => " ", + (Project_Node_Tree => Project_Node_Tree, + File_Name => " ", Index => 0, The_Package => Builder_Package, Program => None, @@ -4916,7 +4932,8 @@ package body Make is end if; Add_Switches - (File_Name => " ", + (Project_Node_Tree => Project_Node_Tree, + File_Name => " ", Index => 0, The_Package => Builder_Package, Program => None); @@ -5007,10 +5024,11 @@ package body Make is end if; Add_Switches - (File_Name => Main_Unit_File_Name, - Index => Main_Index, - The_Package => Binder_Package, - Program => Binder); + (Project_Node_Tree => Project_Node_Tree, + File_Name => Main_Unit_File_Name, + Index => Main_Index, + The_Package => Binder_Package, + Program => Binder); end if; -- Add linker switches from the project file for the first main @@ -5023,10 +5041,11 @@ package body Make is end if; Add_Switches - (File_Name => Main_Unit_File_Name, - Index => Main_Index, - The_Package => Linker_Package, - Program => Linker); + (Project_Node_Tree => Project_Node_Tree, + File_Name => Main_Unit_File_Name, + Index => Main_Index, + The_Package => Linker_Package, + Program => Linker); end if; end; end if; @@ -6310,10 +6329,11 @@ package body Make is end if; Add_Switches - (File_Name => Main_Unit_File_Name, - Index => Main_Index, - The_Package => Binder_Package, - Program => Binder); + (Project_Node_Tree => Project_Node_Tree, + File_Name => Main_Unit_File_Name, + Index => Main_Index, + The_Package => Binder_Package, + Program => Binder); end if; -- Add linker switches from the project file for this main, @@ -6327,10 +6347,11 @@ package body Make is end if; Add_Switches - (File_Name => Main_Unit_File_Name, - Index => Main_Index, - The_Package => Linker_Package, - Program => Linker); + (Project_Node_Tree => Project_Node_Tree, + File_Name => Main_Unit_File_Name, + Index => Main_Index, + The_Package => Linker_Package, + Program => Linker); end if; -- As we are using a project file, for relative paths we add @@ -6521,7 +6542,7 @@ package body Make is -- Initialize -- ---------------- - procedure Initialize is + procedure Initialize (Project_Node_Tree : out Project_Node_Tree_Ref) is procedure Check_Version_And_Help is new Check_Version_And_Help_G (Makeusg); @@ -6529,6 +6550,13 @@ package body Make is -- Start of processing for Initialize begin + -- Prepare the project's tree, since this is used to hold external + -- references, project path and other attributes that can be impacted by + -- the command line switches + + Project_Node_Tree := new Project_Node_Tree_Data; + Prj.Tree.Initialize (Project_Node_Tree); + -- Override default initialization of Check_Object_Consistency since -- this is normally False for GNATBIND, but is True for GNATMAKE since -- we do not need to check source consistency again once GNATMAKE has @@ -6611,11 +6639,12 @@ package body Make is -- do not include --version or --help. Scan_Args : for Next_Arg in 1 .. Argument_Count loop - Scan_Make_Arg (Argument (Next_Arg), And_Save => True); + Scan_Make_Arg + (Project_Node_Tree, Argument (Next_Arg), And_Save => True); end loop Scan_Args; if N_M_Switch > 0 and RTS_Specified = null then - Process_Multilib; + Process_Multilib (Project_Node_Tree); end if; if Commands_To_Stdout then @@ -6700,7 +6729,8 @@ package body Make is In_Tree => Project_Tree, Project_File_Name => Project_File_Name.all, Packages_To_Check => Packages_To_Check_By_Gnatmake, - Flags => Gnatmake_Flags); + Flags => Gnatmake_Flags, + In_Node_Tree => Project_Node_Tree); -- The parsing of project files may have changed the current output @@ -7281,7 +7311,9 @@ package body Make is -- Process_Multilib -- ---------------------- - procedure Process_Multilib is + procedure Process_Multilib + (Project_Node_Tree : Project_Node_Tree_Ref) + is Output_FD : File_Descriptor; Output_Name : String_Access; Arg_Index : Natural := 0; @@ -7382,8 +7414,9 @@ package body Make is -- Otherwise add -margs --RTS=output - Scan_Make_Arg ("-margs", And_Save => True); - Scan_Make_Arg ("--RTS=" & Line (1 .. N_Read), And_Save => True); + Scan_Make_Arg (Project_Node_Tree, "-margs", And_Save => True); + Scan_Make_Arg + (Project_Node_Tree, "--RTS=" & Line (1 .. N_Read), And_Save => True); end Process_Multilib; ----------------------------- @@ -7485,7 +7518,11 @@ package body Make is -- Scan_Make_Arg -- ------------------- - procedure Scan_Make_Arg (Argv : String; And_Save : Boolean) is + procedure Scan_Make_Arg + (Project_Node_Tree : Project_Node_Tree_Ref; + Argv : String; + And_Save : Boolean) + is Success : Boolean; begin @@ -8001,7 +8038,7 @@ package body Make is -- -Xext=val (External assignment) elsif Argv (2) = 'X' - and then Is_External_Assignment (Argv) + and then Is_External_Assignment (Project_Node_Tree, Argv) then -- Is_External_Assignment has side effects -- when it returns True; diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb index c0d9de4d764..9caf9c4231d 100644 --- a/gcc/ada/makeutl.adb +++ b/gcc/ada/makeutl.adb @@ -447,7 +447,10 @@ package body Makeutl is -- Is_External_Assignment -- ---------------------------- - function Is_External_Assignment (Argv : String) return Boolean is + function Is_External_Assignment + (Tree : Prj.Tree.Project_Node_Tree_Ref; + Argv : String) return Boolean + is Start : Positive := 3; Finish : Natural := Argv'Last; Equal_Pos : Natural; @@ -478,7 +481,8 @@ package body Makeutl is return False; else Prj.Ext.Add - (External_Name => Argv (Start .. Equal_Pos - 1), + (Tree => Tree, + External_Name => Argv (Start .. Equal_Pos - 1), Value => Argv (Equal_Pos + 1 .. Finish)); return True; end if; diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads index 1dff5a16aa1..95114f07c9a 100644 --- a/gcc/ada/makeutl.ads +++ b/gcc/ada/makeutl.ads @@ -28,6 +28,7 @@ with Namet; use Namet; with Opt; with Osint; with Prj; use Prj; +with Prj.Tree; with Types; use Types; with GNAT.OS_Lib; use GNAT.OS_Lib; @@ -83,7 +84,9 @@ package Makeutl is -- source files are still associated with the same units). Return True -- if everything is still valid - function Is_External_Assignment (Argv : String) return Boolean; + function Is_External_Assignment + (Tree : Prj.Tree.Project_Node_Tree_Ref; + Argv : String) return Boolean; -- Verify that an external assignment switch is syntactically correct -- -- Correct forms are: diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb index 879178de122..5783a530c12 100644 --- a/gcc/ada/prj-conf.adb +++ b/gcc/ada/prj-conf.adb @@ -1000,7 +1000,6 @@ package body Prj.Conf is begin -- Parse the user project tree - Prj.Tree.Initialize (Project_Node_Tree); Prj.Initialize (Project_Tree); Main_Project := No_Project; diff --git a/gcc/ada/prj-conf.ads b/gcc/ada/prj-conf.ads index f228ae3fde3..82b8dc34726 100644 --- a/gcc/ada/prj-conf.ads +++ b/gcc/ada/prj-conf.ads @@ -59,6 +59,10 @@ package Prj.Conf is -- Find the main configuration project and parse the project tree rooted at -- this configuration project. -- + -- Project_Node_Tree must have been initialized first (and possibly the + -- value for external references and project path should also have been + -- set). + -- -- If the processing fails, Main_Project is set to No_Project. If the error -- happend while parsing the project itself (ie creating the tree), -- User_Project_Node is also set to Empty_Node. diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb index 8098a3a23b1..8bdc1101719 100644 --- a/gcc/ada/prj-ext.adb +++ b/gcc/ada/prj-ext.adb @@ -26,11 +26,10 @@ with Hostparm; with Makeutl; use Makeutl; with Osint; use Osint; +with Prj.Tree; use Prj.Tree; with Sdefault; with Table; -with GNAT.HTable; - package body Prj.Ext is Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; @@ -52,19 +51,6 @@ package body Prj.Ext is procedure Initialize_Project_Path; -- Initialize Current_Project_Path - package Htable is new GNAT.HTable.Simple_HTable - (Header_Num => Header_Num, - Element => Name_Id, - No_Element => No_Name, - Key => Name_Id, - Hash => Hash, - Equal => "="); - -- External references are stored in this hash table, either by procedure - -- Add (directly or through a call to function Check) or by function - -- Value_Of when an environment variable is found non empty. Value_Of - -- first for external reference in this table, before checking the - -- environment. Htable is emptied (reset) by procedure Reset. - package Search_Directories is new Table.Table (Table_Component_Type => Name_Id, Table_Index_Type => Natural, @@ -79,7 +65,8 @@ package body Prj.Ext is --------- procedure Add - (External_Name : String; + (Tree : Prj.Tree.Project_Node_Tree_Ref; + External_Name : String; Value : String) is The_Key : Name_Id; @@ -92,7 +79,7 @@ package body Prj.Ext is Name_Buffer (1 .. Name_Len) := External_Name; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); The_Key := Name_Find; - Htable.Set (The_Key, The_Value); + Name_To_Name_HTable.Set (Tree.External_References, The_Key, The_Value); end Add; ----------- @@ -110,16 +97,19 @@ package body Prj.Ext is -- Check -- ----------- - function Check (Declaration : String) return Boolean is + function Check + (Tree : Prj.Tree.Project_Node_Tree_Ref; + Declaration : String) return Boolean is begin for Equal_Pos in Declaration'Range loop if Declaration (Equal_Pos) = '=' then exit when Equal_Pos = Declaration'First; exit when Equal_Pos = Declaration'Last; Add - (External_Name => + (Tree => Tree, + External_Name => Declaration (Declaration'First .. Equal_Pos - 1), - Value => + Value => Declaration (Equal_Pos + 1 .. Declaration'Last)); return True; end if; @@ -294,9 +284,9 @@ package body Prj.Ext is -- Reset -- ----------- - procedure Reset is + procedure Reset (Tree : Prj.Tree.Project_Node_Tree_Ref) is begin - Htable.Reset; + Name_To_Name_HTable.Reset (Tree.External_References); end Reset; ---------------------- @@ -314,7 +304,8 @@ package body Prj.Ext is -------------- function Value_Of - (External_Name : Name_Id; + (Tree : Prj.Tree.Project_Node_Tree_Ref; + External_Name : Name_Id; With_Default : Name_Id := No_Name) return Name_Id is @@ -325,7 +316,8 @@ package body Prj.Ext is Canonical_Case_File_Name (Name); Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; - The_Value := Htable.Get (Name_Find); + The_Value := + Name_To_Name_HTable.Get (Tree.External_References, Name_Find); if The_Value /= No_Name then return The_Value; @@ -341,7 +333,8 @@ package body Prj.Ext is Name_Len := Env_Value'Length; Name_Buffer (1 .. Name_Len) := Env_Value.all; The_Value := Name_Find; - Htable.Set (External_Name, The_Value); + Name_To_Name_HTable.Set + (Tree.External_References, External_Name, The_Value); Free (Env_Value); return The_Value; diff --git a/gcc/ada/prj-ext.ads b/gcc/ada/prj-ext.ads index 931c3c5d07f..cb9ecb72d7b 100644 --- a/gcc/ada/prj-ext.ads +++ b/gcc/ada/prj-ext.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -26,8 +26,14 @@ -- Subprograms to set, get and cache external references, to be used as -- External functions in project files. +with Prj.Tree; + package Prj.Ext is + ------------------ + -- Project Path -- + ------------------ + Gpr_Project_Path : constant String := "GPR_PROJECT_PATH"; -- Name of primary env. variable that contain path name(s) of directories -- where project files may reside. @@ -48,22 +54,36 @@ package Prj.Ext is -- always start with the current directory (".") and the path separators -- should be the correct ones for the platform. + ------------------------- + -- External References -- + ------------------------- + -- External references influence the way a project tree is processed (in + -- particular they provide the values for the typed string variables that + -- are then used in case constructions). + -- External references are project-tree specific, so that when multiple + -- trees are loaded in parallel we can have different scenarios (or even + -- load the same tree twice and see different views of it). + procedure Add - (External_Name : String; + (Tree : Prj.Tree.Project_Node_Tree_Ref; + External_Name : String; Value : String); -- Add an external reference (or modify an existing one) function Value_Of - (External_Name : Name_Id; + (Tree : Prj.Tree.Project_Node_Tree_Ref; + External_Name : Name_Id; With_Default : Name_Id := No_Name) return Name_Id; -- Get the value of an external reference, and cache it for future uses - function Check (Declaration : String) return Boolean; + function Check + (Tree : Prj.Tree.Project_Node_Tree_Ref; + Declaration : String) return Boolean; -- Check that an external declaration <external>=<value> is correct. -- If it is correct, the external reference is Added. - procedure Reset; + procedure Reset (Tree : Prj.Tree.Project_Node_Tree_Ref); -- Clear the internal data structure that stores the external references -- and free any allocated memory. diff --git a/gcc/ada/prj-nmsc.ads b/gcc/ada/prj-nmsc.ads index eec6289e503..c69084f99ff 100644 --- a/gcc/ada/prj-nmsc.ads +++ b/gcc/ada/prj-nmsc.ads @@ -33,11 +33,10 @@ private package Prj.Nmsc is Flags : Processing_Flags); -- Perform consistency and semantic checks on all the projects in the tree. -- This procedure interprets the various case statements in the project - -- based on the current environment variables (the "scenario"). After - -- checking the validity of the naming scheme, it searches for all the - -- source files of the project. The result of this procedure is a filled-in - -- data structure for Project_Id which contains all the information about - -- the project. This information is only valid while the scenario variables - -- are preserved. + -- based on the current external references. After checking the validity of + -- the naming scheme, it searches for all the source files of the project. + -- The result of this procedure is a filled-in data structure for + -- Project_Id which contains all the information about the project. This + -- information is only valid while the external references are preserved. end Prj.Nmsc; diff --git a/gcc/ada/prj-pars.adb b/gcc/ada/prj-pars.adb index bacbf8d7f87..a2b1c42ecc6 100644 --- a/gcc/ada/prj-pars.adb +++ b/gcc/ada/prj-pars.adb @@ -45,18 +45,21 @@ package body Prj.Pars is Project_File_Name : String; Packages_To_Check : String_List_Access := All_Packages; Flags : Processing_Flags; - Reset_Tree : Boolean := True) + Reset_Tree : Boolean := True; + In_Node_Tree : Prj.Tree.Project_Node_Tree_Ref := null) is Project_Node : Project_Node_Id := Empty_Node; The_Project : Project_Id := No_Project; Success : Boolean := True; Current_Dir : constant String := Get_Current_Dir; - Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; + Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref := In_Node_Tree; Automatically_Generated : Boolean; Config_File_Path : String_Access; begin - Project_Node_Tree := new Project_Node_Tree_Data; - Prj.Tree.Initialize (Project_Node_Tree); + if Project_Node_Tree = null then + Project_Node_Tree := new Project_Node_Tree_Data; + Prj.Tree.Initialize (Project_Node_Tree); + end if; -- Parse the main project file into a tree diff --git a/gcc/ada/prj-pars.ads b/gcc/ada/prj-pars.ads index 01caff93c19..4e7d4808d4a 100644 --- a/gcc/ada/prj-pars.ads +++ b/gcc/ada/prj-pars.ads @@ -25,6 +25,8 @@ -- General wrapper for the parsing of project files +with Prj.Tree; + package Prj.Pars is procedure Set_Verbosity (To : Verbosity); @@ -36,20 +38,21 @@ package Prj.Pars is Project_File_Name : String; Packages_To_Check : String_List_Access := All_Packages; Flags : Processing_Flags; - Reset_Tree : Boolean := True); + Reset_Tree : Boolean := True; + In_Node_Tree : Prj.Tree.Project_Node_Tree_Ref := null); -- Parse and process a project files and all its imported project files, in -- the project tree In_Tree. -- All the project files are parsed (through Prj.Tree) to create a tree in -- memory. That tree is then processed (through Prj.Proc) to create a - -- expanded representation of the tree based on the current scenario - -- variables. This function is only a convenient wrapper over other + -- expanded representation of the tree based on the current external + -- references. This function is only a convenient wrapper over other -- services provided in the Prj.* package hierarchy. -- -- If parsing is successful, Project is the project ID of the root project -- file; otherwise, Project_Id is set to No_Project. Project_Node_Tree is -- set to the tree (unprocessed) representation of the project file. This -- tree is permanently correct, whereas Project will need to be recomputed - -- if the scenario variables change. + -- if the external references change. -- -- Packages_To_Check indicates the packages where any unknown attribute -- produces an error. For other packages, an unknown attribute produces a @@ -57,5 +60,9 @@ package Prj.Pars is -- -- When Reset_Tree is True, all the project data are removed from the -- project table before processing. + -- + -- In_Node_Tree (if given) must have been Initialized. The main reason to + -- pass an existing tree, is to pass the external references that will then + -- be used to process the tree. end Prj.Pars; diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index 9893cf6129b..839034835ff 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -1041,7 +1041,8 @@ package body Prj.Proc is end if; end if; - Value := Prj.Ext.Value_Of (Name, Default); + Value := Prj.Ext.Value_Of + (From_Project_Node_Tree, Name, Default); if Value = No_Name then if not Quiet_Output then diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads index 40b5bf35d19..4257c9004f8 100644 --- a/gcc/ada/prj-proc.ads +++ b/gcc/ada/prj-proc.ads @@ -40,7 +40,7 @@ package Prj.Proc is Flags : Prj.Processing_Flags; Reset_Tree : Boolean := True); -- Process a project tree (ie the direct resulting of parsing a .gpr file) - -- based on the current scenario variables. + -- based on the current external references. -- -- The result of this phase_1 is a partial project tree (Project) where -- only a few fields have been initialized (in particular the list of diff --git a/gcc/ada/prj-tree.adb b/gcc/ada/prj-tree.adb index 08e4977c056..4823a988d6c 100644 --- a/gcc/ada/prj-tree.adb +++ b/gcc/ada/prj-tree.adb @@ -983,6 +983,10 @@ package body Prj.Tree is begin Project_Node_Table.Init (Tree.Project_Nodes); Projects_Htable.Reset (Tree.Projects_HT); + + -- Do not reset the external references, in case we are reloading a + -- project, since we want to preserve the current environment + -- Name_To_Name_HTable.Reset (Tree.External_References); end Initialize; ---------- diff --git a/gcc/ada/prj-tree.ads b/gcc/ada/prj-tree.ads index e587d3705aa..991dbff0c1e 100644 --- a/gcc/ada/prj-tree.ads +++ b/gcc/ada/prj-tree.ads @@ -1001,7 +1001,6 @@ package Prj.Tree is package Tree_Private_Part is -- This is conceptually in the private part - -- However, for efficiency, some packages are accessing it directly type Project_Node_Record is record @@ -1371,9 +1370,23 @@ package Prj.Tree is end Tree_Private_Part; + package Name_To_Name_HTable is new GNAT.Dynamic_HTables.Simple_HTable + (Header_Num => Header_Num, + Element => Name_Id, + No_Element => No_Name, + Key => Name_Id, + Hash => Hash, + Equal => "="); + type Project_Node_Tree_Data is record Project_Nodes : Tree_Private_Part.Project_Node_Table.Instance; Projects_HT : Tree_Private_Part.Projects_Htable.Instance; + + External_References : Name_To_Name_HTable.Instance; + -- External references are stored in this hash table (and manipulated + -- through subprogrames in prj-ext.ads). External references are + -- project-tree specific so that one can load the same tree twice but + -- have two views of it, for instance. end record; -- The data for a project node tree diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index bce8648209b..c1075d68126 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -58,7 +58,7 @@ pragma Style_Checks ("M32766"); ** s-oscons-tmpl.s. ** ** The default one assumes that the template can be compiled by the newly- - ** build cross compiler. It uses markup produced in the (pseudo-)assembly + ** built cross compiler. It uses markup produced in the (pseudo-)assembly ** listing: ** ** xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i |