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
@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
@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.
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
@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
@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.
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
------------
-- 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;