Commit 2324b3fd by Emmanuel Briot Committed by Arnaud Charlet

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
parent 74744c7b
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> 2009-04-24 Robert Dewar <dewar@adacore.com>
* prj-env.adb, prj-proc.adb, prj.adb, prj.ads, * prj-env.adb, prj-proc.adb, prj.adb, prj.ads,
......
...@@ -2351,16 +2351,10 @@ package body Make is ...@@ -2351,16 +2351,10 @@ package body Make is
-- We get the project directory for the relative path -- We get the project directory for the relative path
-- switches and arguments. -- switches and arguments.
Arguments_Project := Ultimate_Extending_Project_Of
(Arguments_Project, Project_Tree);
Data := Project_Tree.Projects.Table (Arguments_Project); 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 -- If building a dynamic or relocatable library, compile with
-- PIC option, if it exists. -- PIC option, if it exists.
...@@ -2375,13 +2369,6 @@ package body Make is ...@@ -2375,13 +2369,6 @@ package body Make is
end; end;
end if; 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 -- We now look for package Compiler and get the switches from
-- this package. -- this package.
...@@ -2431,6 +2418,8 @@ package body Make is ...@@ -2431,6 +2418,8 @@ package body Make is
declare declare
New_Args : Argument_List (1 .. Number); New_Args : Argument_List (1 .. Number);
Last_New : Natural := 0; Last_New : Natural := 0;
Dir_Path : constant String :=
Get_Name_String (Data.Directory.Name);
begin begin
Current := Switches.Values; Current := Switches.Values;
...@@ -2446,7 +2435,7 @@ package body Make is ...@@ -2446,7 +2435,7 @@ package body Make is
new String'(Name_Buffer (1 .. Name_Len)); new String'(Name_Buffer (1 .. Name_Len));
Test_If_Relative_Path Test_If_Relative_Path
(New_Args (Last_New), (New_Args (Last_New),
Parent => Data.Dir_Path, Parent => Dir_Path,
Including_Non_Switch => False); Including_Non_Switch => False);
end if; end if;
...@@ -2471,11 +2460,13 @@ package body Make is ...@@ -2471,11 +2460,13 @@ package body Make is
New_Args : Argument_List := New_Args : Argument_List :=
(1 => new String' (1 => new String'
(Name_Buffer (1 .. Name_Len))); (Name_Buffer (1 .. Name_Len)));
Dir_Path : constant String :=
Get_Name_String (Data.Directory.Name);
begin begin
Test_If_Relative_Path Test_If_Relative_Path
(New_Args (1), (New_Args (1),
Parent => Data.Dir_Path, Parent => Dir_Path,
Including_Non_Switch => False); Including_Non_Switch => False);
Add_Arguments Add_Arguments
(Configuration_Pragmas_Switch (Arguments_Project) & (Configuration_Pragmas_Switch (Arguments_Project) &
...@@ -5411,10 +5402,10 @@ package body Make is ...@@ -5411,10 +5402,10 @@ package body Make is
-- project file. -- project file.
declare declare
Dir_Path : constant String_Access := Dir_Path : constant String :=
new String'(Get_Name_String Get_Name_String
(Project_Tree.Projects.Table (Project_Tree.Projects.Table
(Main_Project).Directory.Name)); (Main_Project).Directory.Name);
begin begin
for J in 1 .. Binder_Switches.Last loop for J in 1 .. Binder_Switches.Last loop
Test_If_Relative_Path Test_If_Relative_Path
...@@ -5425,7 +5416,7 @@ package body Make is ...@@ -5425,7 +5416,7 @@ package body Make is
for J in 1 .. Saved_Binder_Switches.Last loop for J in 1 .. Saved_Binder_Switches.Last loop
Test_If_Relative_Path Test_If_Relative_Path
(Saved_Binder_Switches.Table (J), (Saved_Binder_Switches.Table (J),
Parent => Current_Work_Dir, Including_L_Switch => False); Parent => Current_Work_Dir.all, Including_L_Switch => False);
end loop; end loop;
for J in 1 .. Linker_Switches.Last loop for J in 1 .. Linker_Switches.Last loop
...@@ -5435,7 +5426,8 @@ package body Make is ...@@ -5435,7 +5426,8 @@ package body Make is
for J in 1 .. Saved_Linker_Switches.Last loop for J in 1 .. Saved_Linker_Switches.Last loop
Test_If_Relative_Path 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; end loop;
for J in 1 .. Gcc_Switches.Last loop for J in 1 .. Gcc_Switches.Last loop
...@@ -5448,7 +5440,7 @@ package body Make is ...@@ -5448,7 +5440,7 @@ package body Make is
for J in 1 .. Saved_Gcc_Switches.Last loop for J in 1 .. Saved_Gcc_Switches.Last loop
Test_If_Relative_Path Test_If_Relative_Path
(Saved_Gcc_Switches.Table (J), (Saved_Gcc_Switches.Table (J),
Parent => Current_Work_Dir, Parent => Current_Work_Dir.all,
Including_Non_Switch => False); Including_Non_Switch => False);
end loop; end loop;
end; end;
...@@ -6581,10 +6573,10 @@ package body Make is ...@@ -6581,10 +6573,10 @@ package body Make is
-- relative path in the project file. -- relative path in the project file.
declare declare
Dir_Path : constant String_Access := Dir_Path : constant String :=
new String'(Get_Name_String Get_Name_String
(Project_Tree.Projects.Table (Project_Tree.Projects.Table
(Main_Project).Directory.Name)); (Main_Project).Directory.Name);
begin begin
for for
J in Last_Binder_Switch + 1 .. Binder_Switches.Last J in Last_Binder_Switch + 1 .. Binder_Switches.Last
......
...@@ -422,17 +422,10 @@ package body Makeutl is ...@@ -422,17 +422,10 @@ package body Makeutl is
Proj : constant Project_Id := Proj : constant Project_Id :=
Linker_Opts.Table (Index).Project; Linker_Opts.Table (Index).Project;
Option : Name_Id; Option : Name_Id;
Dir_Path : constant String :=
Get_Name_String (In_Tree.Projects.Table (Proj).Directory.Name);
begin 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 while Options /= Nil_String loop
Option := In_Tree.String_Elements.Table (Options).Value; Option := In_Tree.String_Elements.Table (Options).Value;
Get_Name_String (Option); Get_Name_String (Option);
...@@ -447,7 +440,7 @@ package body Makeutl is ...@@ -447,7 +440,7 @@ package body Makeutl is
Test_If_Relative_Path Test_If_Relative_Path
(Switch => Linker_Options_Buffer (Last_Linker_Option), (Switch => Linker_Options_Buffer (Last_Linker_Option),
Parent => In_Tree.Projects.Table (Proj).Dir_Path, Parent => Dir_Path,
Including_L_Switch => True); Including_L_Switch => True);
end if; end if;
...@@ -604,7 +597,7 @@ package body Makeutl is ...@@ -604,7 +597,7 @@ package body Makeutl is
procedure Test_If_Relative_Path procedure Test_If_Relative_Path
(Switch : in out String_Access; (Switch : in out String_Access;
Parent : String_Access; Parent : String;
Including_L_Switch : Boolean := True; Including_L_Switch : Boolean := True;
Including_Non_Switch : Boolean := True) Including_Non_Switch : Boolean := True)
is is
...@@ -645,7 +638,7 @@ package body Makeutl is ...@@ -645,7 +638,7 @@ package body Makeutl is
-- arguments are not converted. -- arguments are not converted.
if not Is_Absolute_Path (Sw (Start .. Sw'Last)) then 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 Do_Fail
("relative search path switches (""" ("relative search path switches ("""
& Sw & Sw
...@@ -655,7 +648,7 @@ package body Makeutl is ...@@ -655,7 +648,7 @@ package body Makeutl is
Switch := Switch :=
new String' new String'
(Sw (1 .. Start - 1) & (Sw (1 .. Start - 1) &
Parent.all & Parent &
Directory_Separator & Directory_Separator &
Sw (Start .. Sw'Last)); Sw (Start .. Sw'Last));
end if; end if;
...@@ -663,12 +656,11 @@ package body Makeutl is ...@@ -663,12 +656,11 @@ package body Makeutl is
elsif Including_Non_Switch then elsif Including_Non_Switch then
if not Is_Absolute_Path (Sw) then if not Is_Absolute_Path (Sw) then
if Parent = null or else Parent'Length = 0 then if Parent'Length = 0 then
Do_Fail Do_Fail
("relative paths (""" & Sw & """) are not allowed"); ("relative paths (""" & Sw & """) are not allowed");
else else
Switch := Switch := new String'(Parent & Directory_Separator & Sw);
new String'(Parent.all & Directory_Separator & Sw);
end if; end if;
end if; end if;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -128,12 +128,12 @@ package Makeutl is ...@@ -128,12 +128,12 @@ package Makeutl is
procedure Test_If_Relative_Path procedure Test_If_Relative_Path
(Switch : in out String_Access; (Switch : in out String_Access;
Parent : String_Access; Parent : String;
Including_L_Switch : Boolean := True; Including_L_Switch : Boolean := True;
Including_Non_Switch : Boolean := True); Including_Non_Switch : Boolean := True);
-- Test if Switch is a relative search path switch. -- Test if Switch is a relative search path switch.
-- If it is, fail if Parent is null, otherwise prepend the path with -- If it is, fail if Parent is the empty string, otherwise prepend the path
-- Parent. This subprogram is only called when using project files. -- with Parent. This subprogram is only called when using project files.
-- For gnatbind switches, Including_L_Switch is False, because the -- For gnatbind switches, Including_L_Switch is False, because the
-- argument of the -L switch is not a path. -- argument of the -L switch is not a path.
......
...@@ -93,7 +93,6 @@ package body Prj is ...@@ -93,7 +93,6 @@ package body Prj is
Location => No_Location, Location => No_Location,
Mains => Nil_String, Mains => Nil_String,
Directory => No_Path_Information, Directory => No_Path_Information,
Dir_Path => null,
Library => False, Library => False,
Library_Dir => No_Path_Information, Library_Dir => No_Path_Information,
Library_Src_Dir => No_Path_Information, Library_Src_Dir => No_Path_Information,
...@@ -108,7 +107,6 @@ package body Prj is ...@@ -108,7 +107,6 @@ package body Prj is
Symbol_Data => No_Symbols, Symbol_Data => No_Symbols,
Ada_Sources => Nil_String, Ada_Sources => Nil_String,
Interfaces_Defined => False, Interfaces_Defined => False,
Imported_Directories_Switches => null,
Include_Path => null, Include_Path => null,
Include_Data_Set => False, Include_Data_Set => False,
Source_Dirs => Nil_String, Source_Dirs => Nil_String,
...@@ -826,7 +824,6 @@ package body Prj is ...@@ -826,7 +824,6 @@ package body Prj is
procedure Free (Project : in out Project_Data) is procedure Free (Project : in out Project_Data) is
begin begin
Free (Project.Dir_Path);
Free (Project.Include_Path); Free (Project.Include_Path);
Free (Project.Ada_Include_Path); Free (Project.Ada_Include_Path);
Free (Project.Objects_Path); Free (Project.Objects_Path);
......
...@@ -1194,9 +1194,6 @@ package Prj is ...@@ -1194,9 +1194,6 @@ package Prj is
Directory : Path_Information := No_Path_Information; Directory : Path_Information := No_Path_Information;
-- Path name of the directory where the project file resides -- 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; Object_Directory : Path_Information := No_Path_Information;
-- The path name of the object directory of this project file -- The path name of the object directory of this project file
...@@ -1269,10 +1266,6 @@ package Prj is ...@@ -1269,10 +1266,6 @@ package Prj is
-- True if attribute Interfaces is declared for the project or any -- True if attribute Interfaces is declared for the project or any
-- project it extends. -- 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; Include_Path : String_Access := null;
-- The search source path for the project. Used as the value for an -- The search source path for the project. Used as the value for an
-- environment variable, specified by attribute Include_Path -- environment variable, specified by attribute Include_Path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment