prj-part.adb, [...]: Move back spec of Parse_Single_Project to body...

2008-07-31  Vincent Celier  <celier@adacore.com>

	* prj-part.adb, prj-part.ads, prj.adb, prj.ads, prj-env.adb:
	Move back spec of Parse_Single_Project to body, as it is not called
	outside of package Prj.Part.
	(Project_Data): Remove components Linker_Name, Linker_Path and
	Minimum_Linker_Options as they are no longer set.
	Remove function There_Are_Ada_Sources from package Prj and move code
	in the only place it was used, in Prj.Env.Set_Ada_Paths.

From-SVN: r138394
This commit is contained in:
Vincent Celier 2008-07-31 14:37:42 +02:00 committed by Arnaud Charlet
parent 58fda84daa
commit ca311c9fa5
5 changed files with 52 additions and 78 deletions

View File

@ -2355,16 +2355,36 @@ package body Prj.Env is
-- For a non-library project, add the object
-- directory, if it is not a virtual project, and if
-- there are Ada sources or if the project is an
-- extending project. If there are no Ada sources,
-- there are Ada sources in the project or one of the
-- projects it extends. If there are no Ada sources,
-- adding the object directory could disrupt the order
-- of the object dirs in the path.
elsif not Data.Virtual
and then There_Are_Ada_Sources (In_Tree, Project)
then
Add_To_Object_Path
(Data.Object_Directory.Name, In_Tree);
elsif not Data.Virtual then
declare
Add_Object_Dir : Boolean := False;
Prj : Project_Id := Project;
begin
while not Add_Object_Dir
and then Prj /= No_Project
loop
if In_Tree.Projects.Table
(Prj).Ada_Sources /= Nil_String
then
Add_Object_Dir := True;
else
Prj :=
In_Tree.Projects.Table (Prj).Extends;
end if;
end loop;
if Add_Object_Dir then
Add_To_Object_Path
(Data.Object_Directory.Name, In_Tree);
end if;
end;
end if;
end if;
end if;

View File

@ -149,6 +149,30 @@ package body Prj.Part is
-- does not (because it is already extended), but other projects that it
-- imports may need to be virtually extended.
type Extension_Origin is (None, Extending_Simple, Extending_All);
-- Type of parameter From_Extended for procedures Parse_Single_Project and
-- Post_Parse_Context_Clause. Extending_All means that we are parsing the
-- tree rooted at an extending all project.
procedure Parse_Single_Project
(In_Tree : Project_Node_Tree_Ref;
Project : out Project_Node_Id;
Extends_All : out Boolean;
Path_Name : String;
Extended : Boolean;
From_Extended : Extension_Origin;
In_Limited : Boolean;
Packages_To_Check : String_List_Access;
Depth : Natural;
Current_Dir : String);
-- Parse a project file.
-- Recursive procedure: it calls itself for imported and extended
-- projects. When From_Extended is not None, if the project has already
-- been parsed and is an extended project A, return the ultimate
-- (not extended) project that extends A. When In_Limited is True,
-- the importing path includes at least one "limited with".
-- When parsing configuration projects, do not allow a depth > 1.
procedure Pre_Parse_Context_Clause
(In_Tree : Project_Node_Tree_Ref;
Context_Clause : out With_Id);

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -49,28 +49,4 @@ package Prj.Part is
-- Current_Directory is used for optimization purposes only, avoiding extra
-- system calls.
type Extension_Origin is (None, Extending_Simple, Extending_All);
-- Type of parameter From_Extended for procedures Parse_Single_Project and
-- Post_Parse_Context_Clause. Extending_All means that we are parsing the
-- tree rooted at an extending all project.
procedure Parse_Single_Project
(In_Tree : Project_Node_Tree_Ref;
Project : out Project_Node_Id;
Extends_All : out Boolean;
Path_Name : String;
Extended : Boolean;
From_Extended : Extension_Origin;
In_Limited : Boolean;
Packages_To_Check : String_List_Access;
Depth : Natural;
Current_Dir : String);
-- Parse a project file.
-- Recursive procedure: it calls itself for imported and extended
-- projects. When From_Extended is not None, if the project has already
-- been parsed and is an extended project A, return the ultimate
-- (not extended) project that extends A. When In_Limited is True,
-- the importing path includes at least one "limited with".
-- When parsing configuration projects, do not allow a depth > 1.
end Prj.Part;

View File

@ -143,9 +143,6 @@ package body Prj is
Objects_Path_File_Without_Libs => No_Path,
Config_File_Name => No_Path,
Config_File_Temp => False,
Linker_Name => No_File,
Linker_Path => No_Path,
Minimum_Linker_Options => No_Name_List,
Config_Checked => False,
Checked => False,
Seen => False,
@ -1155,29 +1152,6 @@ package body Prj is
return Extend_Name (Source_File_Name, Switches_Dependency_Suffix);
end Switches_Name;
---------------------------
-- There_Are_Ada_Sources --
---------------------------
function There_Are_Ada_Sources
(In_Tree : Project_Tree_Ref;
Project : Project_Id) return Boolean
is
Prj : Project_Id;
begin
Prj := Project;
while Prj /= No_Project loop
if In_Tree.Projects.Table (Prj).Ada_Sources /= Nil_String then
return True;
end if;
Prj := In_Tree.Projects.Table (Prj).Extends;
end loop;
return False;
end There_Are_Ada_Sources;
-----------
-- Value --
-----------

View File

@ -1289,20 +1289,6 @@ package Prj is
-- use this field directly outside of the project manager, use
-- Prj.Env.Ada_Include_Path instead.
-------------
-- Linking --
-------------
Linker_Name : File_Name_Type := No_File;
-- Value of attribute Language_Processing'Linker in the project file
Linker_Path : Path_Name_Type := No_Path;
-- Path of linker when attribute Language_Processing'Linker is specified
Minimum_Linker_Options : Name_List_Index := No_Name_List;
-- List of options specified in attribute
-- Language_Processing'Minimum_Linker_Options.
-------------------
-- Miscellaneous --
-------------------
@ -1372,12 +1358,6 @@ package Prj is
-- Return True when Language_Name (which must be lower case) is one of the
-- languages used for the project.
function There_Are_Ada_Sources
(In_Tree : Project_Tree_Ref;
Project : Project_Id) return Boolean;
-- ??? needs comment
-- ??? Name sounds strange, suggested replacement: Ada_Sources_Present
Project_Error : exception;
-- Raised by some subprograms in Prj.Attr