aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/makeutl.adb19
-rw-r--r--gcc/ada/prj-ext.adb27
-rw-r--r--gcc/ada/prj-ext.ads4
4 files changed, 27 insertions, 32 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index f908caf..fe75769 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+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
+
2009-09-17 Bob Duff <duff@adacore.com>
* gnat_rm.texi, s-oscons-tmplt.c: Minor typo
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index 9caf9c4..a570737 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -453,7 +453,6 @@ package body Makeutl is
is
Start : Positive := 3;
Finish : Natural := Argv'Last;
- Equal_Pos : Natural;
pragma Assert (Argv'First = 1);
pragma Assert (Argv (1 .. 2) = "-X");
@@ -471,21 +470,9 @@ package body Makeutl is
end if;
end if;
- Equal_Pos := Start;
-
- while Equal_Pos <= Finish and then Argv (Equal_Pos) /= '=' loop
- Equal_Pos := Equal_Pos + 1;
- end loop;
-
- if Equal_Pos = Start or else Equal_Pos > Finish then
- return False;
- else
- Prj.Ext.Add
- (Tree => Tree,
- External_Name => Argv (Start .. Equal_Pos - 1),
- Value => Argv (Equal_Pos + 1 .. Finish));
- return True;
- end if;
+ return Prj.Ext.Check
+ (Tree => Tree,
+ Declaration => Argv (Start .. Finish));
end Is_External_Assignment;
---------------
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.
diff --git a/gcc/ada/prj-ext.ads b/gcc/ada/prj-ext.ads
index cb9ecb7..156005a 100644
--- a/gcc/ada/prj-ext.ads
+++ b/gcc/ada/prj-ext.ads
@@ -34,10 +34,6 @@ 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.
-
procedure Add_Search_Project_Directory (Path : String);
-- Add a directory to the project path. Directories added with this
-- procedure are added in order after the current directory and before