Global variable Root_Environment was used in the Project Manager, but was not initialized by GNATCOLL and GPS. This patch eliminates the direct use of Root_Environment.
Tested on x86_64-pc-linux-gnu, committed on trunk 2014-06-13 Vincent Celier <cel...@adacore.com> * makeutl.ads (Compute_Builder_Switches): Change name of parameter Root_Environment to Env. * prj-conf.adb (Check_Switches): Call Locate_Runtime with the Env parameter of procedure Get_Or_Create_Configuration_File. (Locate_Runtime): Call Find_Rts_In_Path with the Project_Path of new parameter Env. * prj-conf.ads (Locate_Runtime): New parameter Env of type Prj.Tree.Environment.
Index: make.adb =================================================================== --- make.adb (revision 211615) +++ make.adb (working copy) @@ -5327,7 +5327,7 @@ if Compute_Builder then Do_Compute_Builder_Switches (Project_Tree => Project_Tree, - Root_Environment => Root_Environment, + Env => Root_Environment, Main_Project => Main_Project, Only_For_Lang => Name_Ada); Index: makeutl.adb =================================================================== --- makeutl.adb (revision 211615) +++ makeutl.adb (working copy) @@ -3173,7 +3173,7 @@ procedure Compute_Builder_Switches (Project_Tree : Project_Tree_Ref; - Root_Environment : in out Prj.Tree.Environment; + Env : in out Prj.Tree.Environment; Main_Project : Project_Id; Only_For_Lang : Name_Id := No_Name) is @@ -3312,7 +3312,7 @@ and then Default_Switches_Array /= No_Array then Prj.Err.Error_Msg - (Root_Environment.Flags, + (Env.Flags, "Default_Switches forbidden in presence of " & "Global_Compilation_Switches. Use Switches instead.", Project_Tree.Shared.Arrays.Table @@ -3432,7 +3432,7 @@ Name_Len := Name_Len + Name_Len; Prj.Err.Error_Msg - (Root_Environment.Flags, + (Env.Flags, '"' & Name_Buffer (1 .. Name_Len) & """ is not a builder switch. Consider moving " & "it to Global_Compilation_Switches.", Index: makeutl.ads =================================================================== --- makeutl.ads (revision 211615) +++ makeutl.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -323,7 +323,7 @@ procedure Compute_Builder_Switches (Project_Tree : Project_Tree_Ref; - Root_Environment : in out Prj.Tree.Environment; + Env : in out Prj.Tree.Environment; Main_Project : Project_Id; Only_For_Lang : Name_Id := No_Name); -- Compute the builder switches and global compilation switches. Every time Index: prj-conf.adb =================================================================== --- prj-conf.adb (revision 211615) +++ prj-conf.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2006-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2006-2014, 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- -- @@ -721,7 +721,7 @@ Set_Runtime_For (Name_Ada, Name_Buffer (7 .. Name_Len)); - Locate_Runtime (Name_Ada, Project_Tree); + Locate_Runtime (Name_Ada, Project_Tree, Env); end if; elsif Name_Len > 7 @@ -748,7 +748,7 @@ if not Runtime_Name_Set_For (Lang) then Set_Runtime_For (Lang, RTS); - Locate_Runtime (Lang, Project_Tree); + Locate_Runtime (Lang, Project_Tree, Env); end if; end; end if; @@ -1518,7 +1518,8 @@ procedure Locate_Runtime (Language : Name_Id; - Project_Tree : Prj.Project_Tree_Ref) + Project_Tree : Prj.Project_Tree_Ref; + Env : Prj.Tree.Environment) is function Is_Base_Name (Path : String) return Boolean; -- Returns True if Path has no directory separator @@ -1551,7 +1552,7 @@ begin if not Is_Base_Name (RTS_Name) then Full_Path := - Find_Rts_In_Path (Root_Environment.Project_Path, RTS_Name); + Find_Rts_In_Path (Env.Project_Path, RTS_Name); if Full_Path = null then Fail_Program (Project_Tree, "cannot find RTS " & RTS_Name); Index: prj-conf.ads =================================================================== --- prj-conf.ads (revision 211615) +++ prj-conf.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2006-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2006-2014, 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- -- @@ -218,7 +218,8 @@ procedure Locate_Runtime (Language : Name_Id; - Project_Tree : Prj.Project_Tree_Ref); + Project_Tree : Prj.Project_Tree_Ref; + Env : Prj.Tree.Environment); -- If RTS_Name is a base name (a name without path separator), then -- do nothing. Otherwise, convert it to an absolute path (possibly by -- searching it in the project path) and call Set_Runtime_For with the