diff options
author | Vincent Celier <celier@gnat.com> | 2004-10-27 15:38:58 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2004-10-27 15:38:58 +0200 |
commit | 1ae44ba2e358541d7d22f99c1ae370b78cbb289d (patch) | |
tree | d0e8b5f12fb45a78319041749a5e90564562fc32 | |
parent | 813fc7bf1866ee281dfa0be67f08016af9279ffe (diff) | |
download | gcc-1ae44ba2e358541d7d22f99c1ae370b78cbb289d.zip gcc-1ae44ba2e358541d7d22f99c1ae370b78cbb289d.tar.gz gcc-1ae44ba2e358541d7d22f99c1ae370b78cbb289d.tar.bz2 |
prj-nmsc.adb (Language_Independent_Check): Do not forbid virtual extension of library projects.
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.
From-SVN: r89662
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 17 | ||||
-rw-r--r-- | gcc/ada/prj-part.adb | 11 | ||||
-rw-r--r-- | gcc/ada/prj-proc.adb | 42 |
3 files changed, 38 insertions, 32 deletions
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index c3193b8..8bca19c 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -3522,22 +3522,7 @@ package body Prj.Nmsc is end if; if Lib_Dir.Default then - - -- If the extending project is a virtual project, we - -- put the error message in the library project that - -- is extended, rather than in the extending all project. - -- Of course, we cannot put it in the virtual extending - -- project, because it has no source. - - if Data.Virtual then - Error_Msg_Name_1 := Extended_Data.Name; - - Error_Msg - (Project, - "library project % cannot be virtually extended", - Extended_Data.Location); - - else + if not Data.Virtual then Error_Msg (Project, "a project extending a library project must " & diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb index 63700b0..c09f8fa 100644 --- a/gcc/ada/prj-part.adb +++ b/gcc/ada/prj-part.adb @@ -33,6 +33,7 @@ with Prj.Com; use Prj.Com; with Prj.Dect; with Prj.Err; use Prj.Err; with Scans; use Scans; +with Sdefault; with Sinput; use Sinput; with Sinput.P; use Sinput.P; with Snames; @@ -531,11 +532,6 @@ package body Prj.Part is Virtual_Hash.Remove (Imported); Declaration := Project_Declaration_Of (Imported); end loop; - - elsif Virtual_Hash.Get (Imported) /= Empty_Node then - Error_Msg - ("this project cannot be imported directly", - Location_Of (With_Clause)); end if; end if; @@ -1708,7 +1704,10 @@ begin -- Initialize Project_Path during package elaboration if Prj_Path.all = "" then - Project_Path := new String'("."); + Project_Path := + new String'("." & Path_Separator & Sdefault.Search_Dir_Prefix.all & + ".." & Directory_Separator & ".." & Directory_Separator & + ".." & Directory_Separator & "gnat"); else Project_Path := new String'("." & Path_Separator & Prj_Path.all); end if; diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index 5df87a0..561c5d4 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; |