From 0bd38d942cf03bc447d09bce4045369eccfa9431 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 24 Jan 2014 15:01:57 +0100 Subject: [PATCH] [multiple changes] 2014-01-24 Vincent Celier * projects.texi: Document that aggregate projects are only supported by gprbuild, but not by gnatmake. Document that the only attribute Switches in package Binder of aggregate projects will be ignored if its index is not others. Document that attribute Global_Config_File is allowed in package Binder of aggregate projects. 2014-01-24 Robert Dewar * sem_prag.adb: Minor code reorganization. * sem_util.adb: Minor fix of potential latent bug in Is_LHS. From-SVN: r207029 --- gcc/ada/ChangeLog | 14 ++++++++++++++ gcc/ada/projects.texi | 42 +++++++++++++++++++++++++++--------------- gcc/ada/sem_prag.adb | 10 +++------- gcc/ada/sem_util.adb | 38 +++++++++++++++++++++++++++++++++----- 4 files changed, 77 insertions(+), 27 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 054033e..a21fe7c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2014-01-24 Vincent Celier + + * projects.texi: Document that aggregate projects are only + supported by gprbuild, but not by gnatmake. Document that the + only attribute Switches in package Binder of aggregate projects + will be ignored if its index is not others. Document that + attribute Global_Config_File is allowed in package Binder of + aggregate projects. + +2014-01-24 Robert Dewar + + * sem_prag.adb: Minor code reorganization. + * sem_util.adb: Minor fix of potential latent bug in Is_LHS. + 2014-01-24 Pascal Obry * prj-attr.adb, projects.texi, snames.ads-tmpl: Add Excluded_Patterns diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index 148589f..e9011e1 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -2365,6 +2365,9 @@ aggregate project, you will need to add "p.gpr" in the list of project files for the aggregate project, or the main will not be built when building the aggregate project. +Aggregate projects are only supported with @command{gprbuild}, but not with +@command{gnatmake}. + @c --------------------------------------------------------- @node Building a set of projects with a single command @subsection Building a set of projects with a single command @@ -2404,8 +2407,8 @@ with Annex E. @subsection Define a build environment @c --------------------------------------------- -The environment variables at the time you launch @command{gprbuild} or -@command{gnatmake} will influence the view these tools have of the project +The environment variables at the time you launch @command{gprbuild} +will influence the view these tools have of the project (PATH to find the compiler, ADA_PROJECT_PATH or GPR_PROJECT_PATH to find the projects, environment variables that are referenced in project files through the "external" statement,...). Several command line switches @@ -2462,12 +2465,12 @@ end MyProject; @subsection Performance improvements in builder @c -------------------------------------------- -The loading of aggregate projects is optimized in @command{gprbuild} and -@command{gnatmake}, so that all files are searched for only once on the disk +The loading of aggregate projects is optimized in @command{gprbuild}, +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} and @command{gnatmake} -compute how and where a source file should be compiled, and even if it is found +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 once. @@ -2663,15 +2666,15 @@ These override the value given by the attribute, so that users can override the value set in the (presumably shared with others in his team) aggregate project. -@item The -X command line switch to @command{gprbuild} and @command{gnatmake} +@item The -X command line switch to @command{gprbuild} This always takes precedence. @end itemize This attribute is only taken into account in the main aggregate -project (i.e. the one specified on the command line to @command{gprbuild} or -@command{gnatmake}), and ignored in other aggregate projects. It is invalid +project (i.e. the one specified on the command line to @command{gprbuild}), +and ignored in other aggregate projects. It is invalid in standard projects. The goal is to have a consistent value in all projects that are built through the aggregate, which would not @@ -2695,13 +2698,15 @@ are valid: @table @asis @item @b{^Switches^Switches^}: @cindex @code{^Switches^Switches^} -This attribute gives the list of switches to use for the builder -(@command{gprbuild} or @command{gnatmake}), depending on the language of the -main file. For instance, +This attribute gives the list of switches to use for @command{gprbuild}. +Because no mains can be specified for aggregate projects, the only possible +index for attribute @code{Switches} is @code{others}. All other indexes will +be ignored. + +Example: @smallexample @c projectfile -for ^Switches^Switches^ ("Ada") use ("-d", "-p"); -for ^Switches^Switches^ ("C") use ("-p"); +for ^Switches^Switches^ (other) use ("-v", "-k", "-j8"); @end smallexample These switches are only read from the main aggregate project (the @@ -2797,7 +2802,7 @@ B), the switches used by the compiler are unambiguous. @cindex @code{Global_Configuration_Pragmas} This attribute can be used to specify a file containing -configuration pragmas, to be passed to the compiler. Since we +configuration pragmas, to be passed to the Ada compiler. Since we ignore the package Builder in other aggregate projects and projects, only those pragmas defined in the main aggregate project will be taken into account. @@ -2805,6 +2810,13 @@ taken into account. Projects can locally add to those by using the @code{Compiler.Local_Configuration_Pragmas} attribute if they need. +@item @b{Global_Config_File} +@cindex @code{Global_Config_File} + +This attribute, indexed with a language name, can be used to specify a config +when compiling sources of the language. For Ada, these files are configuration +pragmas files. + @end table For projects that are built through the aggregate, the package Builder diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 28b020b..e76e688 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -15565,14 +15565,10 @@ package body Sem_Prag is case Ekind (Ent) is - -- Objects (constants and variables) + -- Objects (constants and variables) and types. For these cases + -- all we need to do is to set the Linker_Section_pragma field. - when E_Constant | E_Variable => - Set_Linker_Section_Pragma (Ent, N); - - -- Types - - when Type_Kind => + when E_Constant | E_Variable | Type_Kind => Set_Linker_Section_Pragma (Ent, N); -- Subprograms diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index dc6a495..b5bb307 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -9850,20 +9850,48 @@ package body Sem_Util is ------------ -- We seem to have a lot of overlapping functions that do similar things - -- (testing for left hand sides or lvalues???). Anyway, since this one is - -- purely syntactic, it should be in Sem_Aux I would think??? + -- (testing for left hand sides or lvalues???). function Is_LHS (N : Node_Id) return Boolean is P : constant Node_Id := Parent (N); begin + -- Return True if we are the left hand side of an assignment statement + if Nkind (P) = N_Assignment_Statement then return Name (P) = N; - elsif - Nkind_In (P, N_Indexed_Component, N_Selected_Component, N_Slice) + -- Case of prefix of indexed or selected component or slice + + elsif Nkind_In (P, N_Indexed_Component, N_Selected_Component, N_Slice) + and then N = Prefix (P) then - return N = Prefix (P) and then Is_LHS (P); + -- Here we have the case where the parent P is N.Q or N(Q .. R). + -- If P is an LHS, then N is also effectively an LHS, but there + -- is an important exception. If N is of an access type, then + -- what we really have is N.all.Q (or N.all(Q .. R)). In either + -- case this makes N.all a left hand side but not N itself! + + -- Here follows a worrisome kludge. If Etype (N) is not set, which + -- for sure happens in the call from Find_Direct_Name, that means we + -- don't know if N is of an access type, so we can't give an accurate + -- answer. For now, we assume we do not have an access type, which + -- means for example that P.Q.R := X will look like a modification + -- of P, even if P.Q eventually turns out to be an access type. The + -- consequence is at least that in some cases we incorrectly identify + -- a reference as a modification. It is not clear if there are any + -- other bad consequences. ??? + + if Present (Etype (N)) and then Is_Access_Type (Etype (N)) then + return False; + + -- OK, not access type case, so just test whole expression + + else + return Is_LHS (P); + end if; + + -- All other cases are not left hand sides else return False; -- 2.7.4