aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Briot <briot@adacore.com>2009-04-24 13:25:35 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-24 15:25:35 +0200
commit2324b3fd3862e466c3098c17eeb06b056f1d16ee (patch)
tree3cb23ab452a5575705b017da687491f2eb562291
parent74744c7bdaabf1a34fb5e613b193d59b61a81c85 (diff)
downloadgcc-2324b3fd3862e466c3098c17eeb06b056f1d16ee.zip
gcc-2324b3fd3862e466c3098c17eeb06b056f1d16ee.tar.gz
gcc-2324b3fd3862e466c3098c17eeb06b056f1d16ee.tar.bz2
2009-04-24 Emmanuel Briot <briot@adacore.com>
* make.adb, prj.adb, prj.ads, makeutl.adb, makeutl.ads: (Project_Data.Dir_Path): field removed, since it can be computed directly from .Directory, and is needed only once when processing the project is buildgpr.adb or make.adb From-SVN: r146719
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/make.adb46
-rw-r--r--gcc/ada/makeutl.adb24
-rw-r--r--gcc/ada/makeutl.ads8
-rw-r--r--gcc/ada/prj.adb3
-rw-r--r--gcc/ada/prj.ads7
6 files changed, 38 insertions, 57 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index df3650f..be36f83 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-24 Emmanuel Briot <briot@adacore.com>
+
+ * make.adb, prj.adb, prj.ads, makeutl.adb, makeutl.ads:
+ (Project_Data.Dir_Path): field removed, since it can be computed
+ directly from .Directory, and is needed only once when processing the
+ project is buildgpr.adb or make.adb
+
2009-04-24 Robert Dewar <dewar@adacore.com>
* prj-env.adb, prj-proc.adb, prj.adb, prj.ads,
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 6f6b687..b9c9bb7 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -2351,16 +2351,10 @@ package body Make is
-- We get the project directory for the relative path
-- switches and arguments.
+ Arguments_Project := Ultimate_Extending_Project_Of
+ (Arguments_Project, Project_Tree);
Data := Project_Tree.Projects.Table (Arguments_Project);
- -- If the source is in an extended project, we go to
- -- the ultimate extending project.
-
- while Data.Extended_By /= No_Project loop
- Arguments_Project := Data.Extended_By;
- Data := Project_Tree.Projects.Table (Arguments_Project);
- end loop;
-
-- If building a dynamic or relocatable library, compile with
-- PIC option, if it exists.
@@ -2375,13 +2369,6 @@ package body Make is
end;
end if;
- if Data.Dir_Path = null then
- Data.Dir_Path :=
- new String'(Get_Name_String (Data.Directory.Display_Name));
- Project_Tree.Projects.Table (Arguments_Project) :=
- Data;
- end if;
-
-- We now look for package Compiler and get the switches from
-- this package.
@@ -2431,6 +2418,8 @@ package body Make is
declare
New_Args : Argument_List (1 .. Number);
Last_New : Natural := 0;
+ Dir_Path : constant String :=
+ Get_Name_String (Data.Directory.Name);
begin
Current := Switches.Values;
@@ -2446,7 +2435,7 @@ package body Make is
new String'(Name_Buffer (1 .. Name_Len));
Test_If_Relative_Path
(New_Args (Last_New),
- Parent => Data.Dir_Path,
+ Parent => Dir_Path,
Including_Non_Switch => False);
end if;
@@ -2471,11 +2460,13 @@ package body Make is
New_Args : Argument_List :=
(1 => new String'
(Name_Buffer (1 .. Name_Len)));
+ Dir_Path : constant String :=
+ Get_Name_String (Data.Directory.Name);
begin
Test_If_Relative_Path
(New_Args (1),
- Parent => Data.Dir_Path,
+ Parent => Dir_Path,
Including_Non_Switch => False);
Add_Arguments
(Configuration_Pragmas_Switch (Arguments_Project) &
@@ -5411,10 +5402,10 @@ package body Make is
-- project file.
declare
- Dir_Path : constant String_Access :=
- new String'(Get_Name_String
+ Dir_Path : constant String :=
+ Get_Name_String
(Project_Tree.Projects.Table
- (Main_Project).Directory.Name));
+ (Main_Project).Directory.Name);
begin
for J in 1 .. Binder_Switches.Last loop
Test_If_Relative_Path
@@ -5425,7 +5416,7 @@ package body Make is
for J in 1 .. Saved_Binder_Switches.Last loop
Test_If_Relative_Path
(Saved_Binder_Switches.Table (J),
- Parent => Current_Work_Dir, Including_L_Switch => False);
+ Parent => Current_Work_Dir.all, Including_L_Switch => False);
end loop;
for J in 1 .. Linker_Switches.Last loop
@@ -5435,7 +5426,8 @@ package body Make is
for J in 1 .. Saved_Linker_Switches.Last loop
Test_If_Relative_Path
- (Saved_Linker_Switches.Table (J), Parent => Current_Work_Dir);
+ (Saved_Linker_Switches.Table (J),
+ Parent => Current_Work_Dir.all);
end loop;
for J in 1 .. Gcc_Switches.Last loop
@@ -5448,7 +5440,7 @@ package body Make is
for J in 1 .. Saved_Gcc_Switches.Last loop
Test_If_Relative_Path
(Saved_Gcc_Switches.Table (J),
- Parent => Current_Work_Dir,
+ Parent => Current_Work_Dir.all,
Including_Non_Switch => False);
end loop;
end;
@@ -6581,10 +6573,10 @@ package body Make is
-- relative path in the project file.
declare
- Dir_Path : constant String_Access :=
- new String'(Get_Name_String
- (Project_Tree.Projects.Table
- (Main_Project).Directory.Name));
+ Dir_Path : constant String :=
+ Get_Name_String
+ (Project_Tree.Projects.Table
+ (Main_Project).Directory.Name);
begin
for
J in Last_Binder_Switch + 1 .. Binder_Switches.Last
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index 93dd6b5..c5bd942 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -422,17 +422,10 @@ package body Makeutl is
Proj : constant Project_Id :=
Linker_Opts.Table (Index).Project;
Option : Name_Id;
+ Dir_Path : constant String :=
+ Get_Name_String (In_Tree.Projects.Table (Proj).Directory.Name);
begin
- -- If Dir_Path has not been computed for this project, do it now
-
- if In_Tree.Projects.Table (Proj).Dir_Path = null then
- In_Tree.Projects.Table (Proj).Dir_Path :=
- new String'
- (Get_Name_String
- (In_Tree.Projects.Table (Proj).Directory.Name));
- end if;
-
while Options /= Nil_String loop
Option := In_Tree.String_Elements.Table (Options).Value;
Get_Name_String (Option);
@@ -447,7 +440,7 @@ package body Makeutl is
Test_If_Relative_Path
(Switch => Linker_Options_Buffer (Last_Linker_Option),
- Parent => In_Tree.Projects.Table (Proj).Dir_Path,
+ Parent => Dir_Path,
Including_L_Switch => True);
end if;
@@ -604,7 +597,7 @@ package body Makeutl is
procedure Test_If_Relative_Path
(Switch : in out String_Access;
- Parent : String_Access;
+ Parent : String;
Including_L_Switch : Boolean := True;
Including_Non_Switch : Boolean := True)
is
@@ -645,7 +638,7 @@ package body Makeutl is
-- arguments are not converted.
if not Is_Absolute_Path (Sw (Start .. Sw'Last)) then
- if Parent = null or else Parent'Length = 0 then
+ if Parent'Length = 0 then
Do_Fail
("relative search path switches ("""
& Sw
@@ -655,7 +648,7 @@ package body Makeutl is
Switch :=
new String'
(Sw (1 .. Start - 1) &
- Parent.all &
+ Parent &
Directory_Separator &
Sw (Start .. Sw'Last));
end if;
@@ -663,12 +656,11 @@ package body Makeutl is
elsif Including_Non_Switch then
if not Is_Absolute_Path (Sw) then
- if Parent = null or else Parent'Length = 0 then
+ if Parent'Length = 0 then
Do_Fail
("relative paths (""" & Sw & """) are not allowed");
else
- Switch :=
- new String'(Parent.all & Directory_Separator & Sw);
+ Switch := new String'(Parent & Directory_Separator & Sw);
end if;
end if;
end if;
diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads
index 705e6e7..bb8ac84 100644
--- a/gcc/ada/makeutl.ads
+++ b/gcc/ada/makeutl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-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- --
@@ -128,12 +128,12 @@ package Makeutl is
procedure Test_If_Relative_Path
(Switch : in out String_Access;
- Parent : String_Access;
+ Parent : String;
Including_L_Switch : Boolean := True;
Including_Non_Switch : Boolean := True);
-- Test if Switch is a relative search path switch.
- -- If it is, fail if Parent is null, otherwise prepend the path with
- -- Parent. This subprogram is only called when using project files.
+ -- If it is, fail if Parent is the empty string, otherwise prepend the path
+ -- with Parent. This subprogram is only called when using project files.
-- For gnatbind switches, Including_L_Switch is False, because the
-- argument of the -L switch is not a path.
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index ab1439d..ec2e646 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -93,7 +93,6 @@ package body Prj is
Location => No_Location,
Mains => Nil_String,
Directory => No_Path_Information,
- Dir_Path => null,
Library => False,
Library_Dir => No_Path_Information,
Library_Src_Dir => No_Path_Information,
@@ -108,7 +107,6 @@ package body Prj is
Symbol_Data => No_Symbols,
Ada_Sources => Nil_String,
Interfaces_Defined => False,
- Imported_Directories_Switches => null,
Include_Path => null,
Include_Data_Set => False,
Source_Dirs => Nil_String,
@@ -826,7 +824,6 @@ package body Prj is
procedure Free (Project : in out Project_Data) is
begin
- Free (Project.Dir_Path);
Free (Project.Include_Path);
Free (Project.Ada_Include_Path);
Free (Project.Objects_Path);
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index c86db3e..01e9946 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -1194,9 +1194,6 @@ package Prj is
Directory : Path_Information := No_Path_Information;
-- Path name of the directory where the project file resides
- Dir_Path : String_Access;
- -- Same as Directory.Name, but as an access to String
-
Object_Directory : Path_Information := No_Path_Information;
-- The path name of the object directory of this project file
@@ -1269,10 +1266,6 @@ package Prj is
-- True if attribute Interfaces is declared for the project or any
-- project it extends.
- Imported_Directories_Switches : Argument_List_Access := null;
- -- List of the source search switches (-I<source dir>) to be used when
- -- compiling.
-
Include_Path : String_Access := null;
-- The search source path for the project. Used as the value for an
-- environment variable, specified by attribute Include_Path