From: Vincent Celier Date: Wed, 29 Jan 2014 15:35:09 +0000 (+0000) Subject: prj-part.adb (Check_Import_Aggregate): New procedure to check if an imported project... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=88de755d13ad0360efb041a1ddbefdde04f2b6a8;p=gcc.git prj-part.adb (Check_Import_Aggregate): New procedure to check if an imported project is an aggregate project. 2014-01-29 Vincent Celier * prj-part.adb (Check_Import_Aggregate): New procedure to check if an imported project is an aggregate project. (Parse_Single_Project): Call Check_Import_Aggregate * projects.texi: Document that aggregate projects cannot be extended or imported. From-SVN: r207254 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 43d4f4244b9..24d4801f856 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2014-01-29 Vincent Celier + + * prj-part.adb (Check_Import_Aggregate): New procedure + to check if an imported project is an aggregate project. + (Parse_Single_Project): Call Check_Import_Aggregate + * projects.texi: Document that aggregate projects cannot be + extended or imported. + 2014-01-29 Robert Dewar * exp_ch9.adb, sem_ch7.ads, s-regexp.adb, sem_ch13.adb: Minor diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb index ffcd69a2733..53847350ed1 100644 --- a/gcc/ada/prj-part.adb +++ b/gcc/ada/prj-part.adb @@ -151,6 +151,13 @@ package body Prj.Part is Project : Project_Node_Id); -- Check that an aggregate project only imports abstract projects + procedure Check_Import_Aggregate + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id); + -- Check that a non aggregate project does not import any aggregate + -- project. + procedure Create_Virtual_Extending_Project (For_Project : Project_Node_Id; Main_Project : Project_Node_Id; @@ -1100,6 +1107,35 @@ package body Prj.Part is end if; end Check_Aggregate_Imports; + ---------------------------- + -- Check_Import_Aggregate -- + ---------------------------- + + procedure Check_Import_Aggregate + (Flags : Processing_Flags; + In_Tree : Project_Node_Tree_Ref; + Project : Project_Node_Id) + is + With_Clause, Imported : Project_Node_Id; + begin + if Project_Qualifier_Of (Project, In_Tree) /= Aggregate then + With_Clause := First_With_Clause_Of (Project, In_Tree); + + while Present (With_Clause) loop + Imported := Project_Node_Of (With_Clause, In_Tree); + + if Project_Qualifier_Of (Imported, In_Tree) = Aggregate then + Error_Msg_Name_1 := Name_Id (Path_Name_Of (Imported, In_Tree)); + Error_Msg (Flags, "cannot import aggregate project %%", + Token_Ptr); + exit; + end if; + + With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); + end loop; + end if; + end Check_Import_Aggregate; + ---------------------------- -- Read_Project_Qualifier -- ---------------------------- @@ -1767,6 +1803,7 @@ package body Prj.Part is Check_Extending_All_Imports (Env.Flags, In_Tree, Project); Check_Aggregate_Imports (Env.Flags, In_Tree, Project); + Check_Import_Aggregate (Env.Flags, In_Tree, Project); -- Check that a project with a name including a dot either imports -- or extends the project whose name precedes the last dot. diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index af3387492cc..e0ef9895904 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -2474,8 +2474,8 @@ so that all files are searched for only once on the disk (thus reducing the number of system calls and contributing to faster compilation times especially on systems with sources on remote servers). As part of the loading, @command{gprbuild} -computes how and where a source file should be compiled, and even if it is found -several times in the aggregated projects it will be compiled only +computes how and where a source file should be compiled, and even if it is +found several times in the aggregated projects it will be compiled only once. Since there is no ambiguity as to which switches should be used, files @@ -2494,9 +2494,10 @@ recommended extension is still @file{.gpr}. However, a special @code{project}. An aggregate project cannot @code{with} any other project (standard or -aggregate), except an abstract project which can be used to share -attribute values. Building other aggregate projects from an aggregate -project is done through the Project_Files attribute (see below). +aggregate), except an abstract project which can be used to share attribute +values. Also, aggregate projects cannot be extended or imported though a +@code{with} clause by any other project. Building other aggregate projects from +an aggregate project is done through the Project_Files attribute (see below). An aggregate project does not have any source files directly (only through other standard projects). Therefore a number of the standard @@ -2548,11 +2549,13 @@ attribute nor the @code{Library_*} attributes, and the result will be to build all their source files (not just the ones needed by other projects). -The file can include paths (absolute or relative). Paths are -relative to the location of the aggregate project file itself (if -you use a base name, we expect to find the .gpr file in the same -directory as the aggregate project file). The extension @file{.gpr} is -mandatory, since this attribute contains file names, not project names. +The file can include paths (absolute or relative). Paths are relative to +the location of the aggregate project file itself (if you use a base name, +we expect to find the .gpr file in the same directory as the aggregate +project file). The environment variables @code{ADA_PROJECT_PATH}, +@code{GPR_PROJECT_PATH} and @code{GPR_PROJECT_PATH_FILE} are not used to find +the project files. The extension @file{.gpr} is mandatory, since this attribute +contains file names, not project names. Paths can also include the @code{"*"} and @code{"**"} globbing patterns. The latter indicates that any subdirectory (recursively) will be @@ -2936,7 +2939,9 @@ The only package that is authorized (albeit optional) is Builder. The Project_Files attribute (See @pxref{Aggregate Projects}) is used to described the aggregated projects whose object files have to be -included into the aggregate library. +included into the aggregate library. The environment variables +@code{ADA_PROJECT_PATH}, @code{GPR_PROJECT_PATH} and +@code{GPR_PROJECT_PATH_FILE} are not used to find the project files. @c --------------------------------------------- @node Project File Reference