diff options
author | Emmanuel Briot <briot@adacore.com> | 2009-09-17 10:41:33 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-09-17 12:41:33 +0200 |
commit | d9b4a5d344983386125cd8c99ced8b2b6abd1a88 (patch) | |
tree | edb6e206516e44901f0bae1ade70385d55a92f3a /gcc/ada/prj-ext.adb | |
parent | daa72421353681f192c42be645ba2590f65c868e (diff) | |
download | gcc-d9b4a5d344983386125cd8c99ced8b2b6abd1a88.zip gcc-d9b4a5d344983386125cd8c99ced8b2b6abd1a88.tar.gz gcc-d9b4a5d344983386125cd8c99ced8b2b6abd1a88.tar.bz2 |
prj-ext.adb, [...] (Is_External_Assignment): Remove duplicate code.
2009-09-17 Emmanuel Briot <briot@adacore.com>
* prj-ext.adb, prj-ext.ads, makeutl.adb (Is_External_Assignment):
Remove duplicate code.
(Prj.Ext): Fix memory leak
(Check): Now allow the syntax "-Xfoo=" to set an empty value to the
variable. This was previously allowed in the code in
Is_External_Assignment, and some tests rely on it
From-SVN: r151793
Diffstat (limited to 'gcc/ada/prj-ext.adb')
-rw-r--r-- | gcc/ada/prj-ext.adb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb index 8bdc110..d5a6b80 100644 --- a/gcc/ada/prj-ext.adb +++ b/gcc/ada/prj-ext.adb @@ -32,16 +32,6 @@ with Table; package body Prj.Ext is - Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; - -- Name of alternate env. variable that contain path name(s) of directories - -- where project files may reside. GPR_PROJECT_PATH has precedence over - -- ADA_PROJECT_PATH. - - Gpr_Prj_Path : constant String_Access := Getenv (Gpr_Project_Path); - Ada_Prj_Path : constant String_Access := Getenv (Ada_Project_Path); - -- The path name(s) of directories where project files may reside. - -- May be empty. - No_Project_Default_Dir : constant String := "-"; Current_Project_Path : String_Access; @@ -82,7 +72,6 @@ package body Prj.Ext is Name_To_Name_HTable.Set (Tree.External_References, The_Key, The_Value); end Add; - ----------- ---------------------------------- -- Add_Search_Project_Directory -- ---------------------------------- @@ -104,7 +93,6 @@ package body Prj.Ext is 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 (Tree => Tree, External_Name => @@ -129,6 +117,17 @@ package body Prj.Ext is New_Len : Positive; New_Last : Positive; + Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; + Gpr_Project_Path : constant String := "GPR_PROJECT_PATH"; + -- Name of alternate env. variable that contain path name(s) of + -- directories where project files may reside. GPR_PROJECT_PATH has + -- precedence over ADA_PROJECT_PATH. + + Gpr_Prj_Path : String_Access := Getenv (Gpr_Project_Path); + Ada_Prj_Path : String_Access := Getenv (Ada_Project_Path); + -- The path name(s) of directories where project files may reside. + -- May be empty. + begin -- The current directory is always first @@ -152,12 +151,16 @@ package body Prj.Ext is Add_Str_To_Name_Buffer (Gpr_Prj_Path.all); end if; + Free (Gpr_Prj_Path); + if Ada_Prj_Path.all /= "" then Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := Path_Separator; Add_Str_To_Name_Buffer (Ada_Prj_Path.all); end if; + Free (Ada_Prj_Path); + -- Scan the directory path to see if "-" is one of the directories. -- Remove each occurrence of "-" and set Add_Default_Dir to False. -- Also resolve relative paths and symbolic links. |