diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-27 13:38:58 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-27 13:38:58 +0000 |
commit | 74f6b21d9c2206c1ff89881a648f12b7ed168be1 (patch) | |
tree | d0e8b5f12fb45a78319041749a5e90564562fc32 /gcc/ada/prj-proc.adb | |
parent | 29f86cb285c5f1cfa7c8f1033cd4b5108853cfd2 (diff) | |
download | gcc-74f6b21d9c2206c1ff89881a648f12b7ed168be1.tar.gz |
2004-10-26 Vincent Celier <celier@gnat.com>
* prj-nmsc.adb (Language_Independent_Check): Do not forbid virtual
extension of library projects.
* prj-part.adb: If env var ADA_PROJECT_PATH is not defined, project
path defaults to ".:<prefix>/lib/gnat".
(Parse): For an extending all project, allow direct import of a project
that is virtually extended.
* prj-proc.adb (Imported_Or_Extended_Project_From): If a project with
the specified name is directly imported, return its ID. Otherwise, if
an extension of this project is imported, return the ID of the
extension.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89662 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-proc.adb')
-rw-r--r-- | gcc/ada/prj-proc.adb | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index 5df87a08fa3..561c5d43809 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -762,11 +762,13 @@ package body Prj.Proc is (Project : Project_Id; With_Name : Name_Id) return Project_Id is - Data : constant Project_Data := Projects.Table (Project); - List : Project_List := Data.Imported_Projects; + Data : constant Project_Data := Projects.Table (Project); + List : Project_List := Data.Imported_Projects; + Result : Project_Id := No_Project; + Temp_Result : Project_Id := No_Project; begin - -- First check if it is the name of a extended project + -- First check if it is the name of an extended project if Data.Extends /= No_Project and then Projects.Table (Data.Extends).Name = With_Name @@ -776,20 +778,40 @@ package body Prj.Proc is else -- Then check the name of each imported project - while List /= Empty_Project_List - and then - Projects.Table - (Project_Lists.Table (List).Project).Name /= With_Name + while List /= Empty_Project_List loop + Result := Project_Lists.Table (List).Project; + + -- If the project is directly imported, then returns its ID + + if Projects.Table (Result).Name = With_Name then + return Result; + end if; + + -- If a project extending the project is imported, then keep + -- this extending project as a possibility. It will be the + -- returned ID if the project is not imported directly. + + declare + Proj : Project_Id := Projects.Table (Result).Extends; + begin + while Proj /= No_Project loop + if Projects.Table (Proj).Name = With_Name then + Temp_Result := Result; + exit; + end if; + + Proj := Projects.Table (Proj).Extends; + end loop; + end; - loop List := Project_Lists.Table (List).Next; end loop; pragma Assert - (List /= Empty_Project_List, + (Temp_Result /= No_Project, "project not found"); - return Project_Lists.Table (List).Project; + return Temp_Result; end if; end Imported_Or_Extended_Project_From; |