From cc55f9bee5f0fc2f705ee27fd95c1339185b077a Mon Sep 17 00:00:00 2001 From: Vincent Celier Date: Thu, 23 Jan 2014 16:52:00 +0000 Subject: [PATCH] prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt to find a configuration project file when... 2014-01-23 Vincent Celier * prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt to find a configuration project file when Config_File_Name is No_Configuration_File. * prj-conf.ads (No_Configuration_File): New constant String. * prj-pars.adb (Parse): Call Get_Or_Create_Configuration_File with Config_File_Name set to No_Configuration_File, so that no existing configuration project file will be used, and the configuration project will be only created in memory when Add_Default_GNAT_Naming_Scheme is called. * projects.texi: Minor reformatting. From-SVN: r206985 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/prj-conf.adb | 42 +++++++++++++++++++++++------------------- gcc/ada/prj-conf.ads | 10 ++++++++++ gcc/ada/prj-pars.adb | 2 +- gcc/ada/projects.texi | 4 ++-- 5 files changed, 49 insertions(+), 22 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5bf50ad1edd..556cc9d159c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2014-01-23 Vincent Celier + + * prj-conf.adb (Get_Or_Create_Configuration_File): Do not attempt + to find a configuration project file when Config_File_Name is + No_Configuration_File. + * prj-conf.ads (No_Configuration_File): New constant String. + * prj-pars.adb (Parse): Call Get_Or_Create_Configuration_File + with Config_File_Name set to No_Configuration_File, so that + no existing configuration project file will be used, and the + configuration project will be only created in memory when + Add_Default_GNAT_Naming_Scheme is called. + * projects.texi: Minor reformatting. + 2014-01-23 Vincent Celier * prj-conf.adb (Get_Or_Create_Configuration_File): Never parse diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb index de4e980ffa7..dc569627b88 100644 --- a/gcc/ada/prj-conf.adb +++ b/gcc/ada/prj-conf.adb @@ -1372,19 +1372,27 @@ package body Prj.Conf is Get_Project_Target; Check_Builder_Switches; - if Conf_File_Name'Length > 0 then - Config_File_Path := Locate_Config_File (Conf_File_Name.all); + -- Do not attempt to find a configuration project file when + -- Config_File_Name is No_Configuration_File. + + if Config_File_Name = No_Configuration_File then + Config_File_Path := null; + else - Config_File_Path := Locate_Config_File (Default_File_Name); - end if; + if Conf_File_Name'Length > 0 then + Config_File_Path := Locate_Config_File (Conf_File_Name.all); + else + Config_File_Path := Locate_Config_File (Default_File_Name); + end if; - if Config_File_Path = null then - if not Allow_Automatic_Generation - and then Conf_File_Name'Length > 0 - then - Raise_Invalid_Config - ("could not locate main configuration project " - & Conf_File_Name.all); + if Config_File_Path = null then + if not Allow_Automatic_Generation + and then Conf_File_Name'Length > 0 + then + Raise_Invalid_Config + ("could not locate main configuration project " + & Conf_File_Name.all); + end if; end if; end if; @@ -1415,22 +1423,18 @@ package body Prj.Conf is and then On_Load_Config = null then Write_Line - ("warning: --RTS is taken into account only in auto-configuration"); + ("warning: " & + "--RTS is taken into account only in auto-configuration"); end if; -- Parse the configuration file - if Verbose_Mode - and then Config_File_Path /= null - and then On_Load_Config = null - then + if Verbose_Mode and then Config_File_Path /= null then Write_Str ("Checking configuration "); Write_Line (Config_File_Path.all); end if; - -- Add comment for On_Load_Config test ??? - - if Config_File_Path /= null and then On_Load_Config = null then + if Config_File_Path /= null then Prj.Part.Parse (In_Tree => Project_Node_Tree, Project => Config_Project_Node, diff --git a/gcc/ada/prj-conf.ads b/gcc/ada/prj-conf.ads index 1c72fa769ba..467d9741e03 100644 --- a/gcc/ada/prj-conf.ads +++ b/gcc/ada/prj-conf.ads @@ -40,6 +40,12 @@ package Prj.Conf is -- is set to Empty_Node when this procedure is called. You can then decide -- to create a new config file if you need. + No_Configuration_File : constant String := "/"; + -- When specified as a parameter Config_File_Name in the procedures below, + -- no existing configuration project file is parsed. This is used by + -- gnatmake, gnatclean and the GNAT driver to avoid parsing an existing + -- default configuration project file. + procedure Parse_Project_And_Apply_Config (Main_Project : out Prj.Project_Id; User_Project_Node : out Prj.Tree.Project_Node_Id; @@ -68,6 +74,10 @@ package Prj.Conf is -- happened while parsing the project itself (i.e. creating the tree), -- User_Project_Node is also set to Empty_Node. -- + -- If Config_File_Name is No_Configuration_File, then no configuration + -- project file is parsed. Normally, in this case On_Load_Config is not + -- null, and it is used to create a configuration project file in memory. + -- -- Autoconf_Specified indicates whether the user has specified --autoconf. -- If this is the case, the config file might be (re)generated, as -- appropriate, to match languages and target if the one specified doesn't diff --git a/gcc/ada/prj-pars.adb b/gcc/ada/prj-pars.adb index a0d083488cf..7fbce49fa9a 100644 --- a/gcc/ada/prj-pars.adb +++ b/gcc/ada/prj-pars.adb @@ -86,7 +86,7 @@ package body Prj.Pars is Process_Project_And_Apply_Config (Main_Project => The_Project, User_Project_Node => Project_Node, - Config_File_Name => "", + Config_File_Name => No_Configuration_File, Autoconf_Specified => False, Project_Tree => In_Tree, Project_Node_Tree => Project_Node_Tree, diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index 8253477fce4..0236ba2dc3a 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -4384,11 +4384,11 @@ Index is a language name. Indicates the kind of the language, either file based or unit based. Only authorized case-insensitive values are "unit_based" and "file_based" (the default). -@item @b{Dependency_Kind}: : single, indexed, case-insensitive index +@item @b{Dependency_Kind}: single, indexed, case-insensitive index Index is a language name. Indicates how the dependencies are handled for the language. Only authorized case-insensitive values are "makefile", "ali_file", -"ali_closure" or "none" (the default. +"ali_closure" or "none" (the default). @item @b{Required_Switches}: list, indexed, case-insensitive index -- 2.30.2