From ca311c9fa5a945158921d0c6e59d39ad7b6bbd51 Mon Sep 17 00:00:00 2001 From: Vincent Celier Date: Thu, 31 Jul 2008 14:37:42 +0200 Subject: [PATCH] prj-part.adb, [...]: Move back spec of Parse_Single_Project to body... 2008-07-31 Vincent Celier * 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 --- gcc/ada/prj-env.adb | 34 +++++++++++++++++++++++++++------- gcc/ada/prj-part.adb | 24 ++++++++++++++++++++++++ gcc/ada/prj-part.ads | 26 +------------------------- gcc/ada/prj.adb | 26 -------------------------- gcc/ada/prj.ads | 20 -------------------- 5 files changed, 52 insertions(+), 78 deletions(-) diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb index dd52f353287..041a5e3cb77 100644 --- a/gcc/ada/prj-env.adb +++ b/gcc/ada/prj-env.adb @@ -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; diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb index 67c913378dd..901875ad204 100644 --- a/gcc/ada/prj-part.adb +++ b/gcc/ada/prj-part.adb @@ -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); diff --git a/gcc/ada/prj-part.ads b/gcc/ada/prj-part.ads index 8e366bc4fff..e1c69c5ab83 100644 --- a/gcc/ada/prj-part.ads +++ b/gcc/ada/prj-part.ads @@ -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; diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb index 4499b0a2d31..23623f5feda 100644 --- a/gcc/ada/prj.adb +++ b/gcc/ada/prj.adb @@ -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 -- ----------- diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index c315c8ead27..9af43b388ce 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -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 -- 2.30.2