Commit e86a3a7e by Arnaud Charlet

[multiple changes]

2010-06-22  Robert Dewar  <dewar@adacore.com>

	* errout.adb (Unwind_Internal_Type): Improve handling of First_Subtype
	test to catch more cases where first subtype is the results we want.
	* sem_res.adb (Make_Call_Into_Operator): Don't go to First_Subtype in
	error case, since Errout will now handle this correctly.
	* gcc-interface/Make-lang.in: Add Sem_Aux to list of GNATBIND objects.
	Update dependencies.

2010-06-22  Arnaud Charlet  <charlet@adacore.com>

	* exp_ch4.adb (Expand_Allocator_Expression): Set Related_Node properly
	when calling Make_Temporary.

2010-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Access_Subprogram_Declaration): An anonymous access to
	subprogram can be associated with an entry body.

2010-06-22  Robert Dewar  <dewar@adacore.com>

	* scos.ads: Add note on membership test handling.

2010-06-22  Vincent Celier  <celier@adacore.com>

	* projects.texi: Minor spelling fixes.
	Minor reformatting.

2010-06-22  Paul Hilfinger  <hilfinger@adacore.com>

	* s-rannum.adb: Correct off-by-one error in Extract_Value.

From-SVN: r161171
parent b086849e
2010-06-22 Robert Dewar <dewar@adacore.com>
* errout.adb (Unwind_Internal_Type): Improve handling of First_Subtype
test to catch more cases where first subtype is the results we want.
* sem_res.adb (Make_Call_Into_Operator): Don't go to First_Subtype in
error case, since Errout will now handle this correctly.
* gcc-interface/Make-lang.in: Add Sem_Aux to list of GNATBIND objects.
Update dependencies.
2010-06-22 Arnaud Charlet <charlet@adacore.com>
* exp_ch4.adb (Expand_Allocator_Expression): Set Related_Node properly
when calling Make_Temporary.
2010-06-22 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Access_Subprogram_Declaration): An anonymous access to
subprogram can be associated with an entry body.
2010-06-22 Robert Dewar <dewar@adacore.com>
* scos.ads: Add note on membership test handling.
2010-06-22 Vincent Celier <celier@adacore.com>
* projects.texi: Minor spelling fixes.
Minor reformatting.
2010-06-22 Paul Hilfinger <hilfinger@adacore.com>
* s-rannum.adb: Correct off-by-one error in Extract_Value.
2010-06-22 Vincent Celier <celier@adacore.com> 2010-06-22 Vincent Celier <celier@adacore.com>
* mlib-prj.adb (Display): In non verbose mode, truncate after fourth * mlib-prj.adb (Display): In non verbose mode, truncate after fourth
......
...@@ -43,6 +43,7 @@ with Opt; use Opt; ...@@ -43,6 +43,7 @@ with Opt; use Opt;
with Nlists; use Nlists; with Nlists; use Nlists;
with Output; use Output; with Output; use Output;
with Scans; use Scans; with Scans; use Scans;
with Sem_Aux; use Sem_Aux;
with Sinput; use Sinput; with Sinput; use Sinput;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
with Snames; use Snames; with Snames; use Snames;
...@@ -2824,7 +2825,7 @@ package body Errout is ...@@ -2824,7 +2825,7 @@ package body Errout is
-- "type derived from" message more than once in the case where we climb -- "type derived from" message more than once in the case where we climb
-- up multiple levels. -- up multiple levels.
loop Find : loop
Old_Ent := Ent; Old_Ent := Ent;
-- Implicit access type, use directly designated type In Ada 2005, -- Implicit access type, use directly designated type In Ada 2005,
...@@ -2872,7 +2873,7 @@ package body Errout is ...@@ -2872,7 +2873,7 @@ package body Errout is
Set_Msg_Str ("access to procedure "); Set_Msg_Str ("access to procedure ");
end if; end if;
exit; exit Find;
-- Type is access to object, named or anonymous -- Type is access to object, named or anonymous
...@@ -2910,51 +2911,54 @@ package body Errout is ...@@ -2910,51 +2911,54 @@ package body Errout is
-- itself an internal name. This avoids the obvious loop (subtype -> -- itself an internal name. This avoids the obvious loop (subtype ->
-- basetype -> subtype) which would otherwise occur!) -- basetype -> subtype) which would otherwise occur!)
elsif Present (Freeze_Node (Ent)) else
and then Present (First_Subtype_Link (Freeze_Node (Ent))) declare
and then FST : constant Entity_Id := First_Subtype (Ent);
not Is_Internal_Name
(Chars (First_Subtype_Link (Freeze_Node (Ent))))
then
Ent := First_Subtype_Link (Freeze_Node (Ent));
-- Otherwise use root type begin
if not Is_Internal_Name (Chars (FST)) then
Ent := FST;
exit Find;
else -- Otherwise use root type
if not Derived then
Buffer_Remove ("type ");
-- Test for "subtype of type derived from" which seems else
-- excessive and is replaced by simply "type derived from" if not Derived then
Buffer_Remove ("type ");
Buffer_Remove ("subtype of"); -- Test for "subtype of type derived from" which seems
-- excessive and is replaced by "type derived from".
-- Avoid duplication "type derived from type derived from" Buffer_Remove ("subtype of");
if not Buffer_Ends_With ("type derived from ") then -- Avoid duplicated "type derived from type derived from"
Set_Msg_Str ("type derived from ");
end if;
Derived := True; if not Buffer_Ends_With ("type derived from ") then
end if; Set_Msg_Str ("type derived from ");
end if;
Derived := True;
end if;
end if;
end;
Ent := Etype (Ent); Ent := Etype (Ent);
end if; end if;
-- If we are stuck in a loop, get out and settle for the internal -- If we are stuck in a loop, get out and settle for the internal
-- name after all. In this case we set to kill the message if it -- name after all. In this case we set to kill the message if it is
-- is not the first error message (we really try hard not to show -- not the first error message (we really try hard not to show the
-- the dirty laundry of the implementation to the poor user!) -- dirty laundry of the implementation to the poor user!)
if Ent = Old_Ent then if Ent = Old_Ent then
Kill_Message := True; Kill_Message := True;
exit; exit Find;
end if; end if;
-- Get out if we finally found a non-internal name to use -- Get out if we finally found a non-internal name to use
exit when not Is_Internal_Name (Chars (Ent)); exit Find when not Is_Internal_Name (Chars (Ent));
end loop; end loop Find;
if Mchar = '"' then if Mchar = '"' then
Set_Msg_Char ('"'); Set_Msg_Char ('"');
......
...@@ -590,7 +590,7 @@ package body Exp_Ch4 is ...@@ -590,7 +590,7 @@ package body Exp_Ch4 is
Set_Analyzed (Node); Set_Analyzed (Node);
Temp := Make_Temporary (Loc, 'P', Node); Temp := Make_Temporary (Loc, 'P', N);
Insert_Action (N, Insert_Action (N,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
...@@ -659,7 +659,7 @@ package body Exp_Ch4 is ...@@ -659,7 +659,7 @@ package body Exp_Ch4 is
Remove_Side_Effects (Exp); Remove_Side_Effects (Exp);
end if; end if;
Temp := Make_Temporary (Loc, 'P'); Temp := Make_Temporary (Loc, 'P', N);
-- For a class wide allocation generate the following code: -- For a class wide allocation generate the following code:
...@@ -979,7 +979,7 @@ package body Exp_Ch4 is ...@@ -979,7 +979,7 @@ package body Exp_Ch4 is
end if; end if;
elsif Aggr_In_Place then elsif Aggr_In_Place then
Temp := Make_Temporary (Loc, 'P'); Temp := Make_Temporary (Loc, 'P', N);
Tmp_Node := Tmp_Node :=
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Temp, Defining_Identifier => Temp,
......
...@@ -443,6 +443,7 @@ GNATBIND_OBJS = \ ...@@ -443,6 +443,7 @@ GNATBIND_OBJS = \
ada/scng.o \ ada/scng.o \
ada/scans.o \ ada/scans.o \
ada/sdefault.o \ ada/sdefault.o \
ada/sem_aux.o \
ada/sinfo.o \ ada/sinfo.o \
ada/sinput.o \ ada/sinput.o \
ada/sinput-c.o \ ada/sinput-c.o \
...@@ -1600,16 +1601,16 @@ ada/errout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ...@@ -1600,16 +1601,16 @@ ada/errout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/fname.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \ ada/fname.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \ ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \ ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \
ada/nlists.adb ada/opt.ads ada/output.ads ada/scans.ads ada/sinfo.ads \ ada/nlists.adb ada/opt.ads ada/output.ads ada/scans.ads ada/sem_aux.ads \
ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
ada/stand.ads ada/stringt.ads ada/stylesw.ads ada/system.ads \ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stylesw.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads \
ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \ ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/urealp.ads ada/widechar.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
...@@ -2570,10 +2571,10 @@ ada/gnatvsn.o : ada/ada.ads ada/a-unccon.ads ada/gnatvsn.ads \ ...@@ -2570,10 +2571,10 @@ ada/gnatvsn.o : ada/ada.ads ada/a-unccon.ads ada/gnatvsn.ads \
ada/gnatvsn.adb ada/system.ads ada/s-secsta.ads ada/s-stoele.ads \ ada/gnatvsn.adb ada/system.ads ada/s-secsta.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-stoele.adb
ada/hlo.o : ada/ada.ads ada/a-unccon.ads ada/hlo.ads ada/hlo.adb \ ada/hlo.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/hlo.ads \
ada/hostparm.ads ada/output.ads ada/system.ads ada/s-exctab.ads \ ada/hlo.adb ada/hostparm.ads ada/output.ads ada/system.ads \
ada/s-stalib.ads ada/s-unstyp.ads ada/types.ads ada/unchconv.ads \ ada/s-exctab.ads ada/s-os_lib.ads ada/s-stalib.ads ada/s-string.ads \
ada/unchdeal.ads ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/hostparm.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \ ada/hostparm.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \
ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \ ada/system.ads ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads \
......
...@@ -144,8 +144,9 @@ detailed later in this documentation. They are summarized here as a reference. ...@@ -144,8 +144,9 @@ detailed later in this documentation. They are summarized here as a reference.
@item @b{Project variables}: @item @b{Project variables}:
In addition to attributes, a project can use variables to store intermediate In addition to attributes, a project can use variables to store intermediate
values and avoid duplication in complex expressions. It can be initialized with a value coming from the environment values and avoid duplication in complex expressions. It can be initialized
Z frequent use of variables is to define scenarios. with a value coming from the environment.
A frequent use of variables is to define scenarios.
@xref{External Values}, @xref{Scenarios in Projects}, and @xref{Variables}. @xref{External Values}, @xref{Scenarios in Projects}, and @xref{Variables}.
@item @b{Source files} and @b{source directories}: @item @b{Source files} and @b{source directories}:
...@@ -199,8 +200,8 @@ the directory @file{obj/}. ...@@ -199,8 +200,8 @@ the directory @file{obj/}.
@end smallexample @end smallexample
@noindent @noindent
Our project is to be called @emph{Build}. By convention, the name of the Our project is to be called @emph{Build}. The name of the
file is the name of the project (lower-cased) with the file is the name of the project (case-insensitive) with the
@file{.gpr} extension, therefore the project file name is @file{build.gpr}. This @file{.gpr} extension, therefore the project file name is @file{build.gpr}. This
is not mandatory, but a warning is issued when this convention is not followed. is not mandatory, but a warning is issued when this convention is not followed.
...@@ -245,9 +246,9 @@ There are several ways of defining source directories: ...@@ -245,9 +246,9 @@ There are several ways of defining source directories:
@itemize @bullet @itemize @bullet
@item When the attribute @b{Source_Dirs} is not used, a project contains a @item When the attribute @b{Source_Dirs} is not used, a project contains a
single source directory which is the one where the project file itself resides. single source directory which is the one where the project file itself
In our example, if @file{build.gpr} is placed in the @file{common} directory, resides. In our example, if @file{build.gpr} is placed in the @file{common}
the project has the needed implicit source directory. directory, the project has the needed implicit source directory.
@item The attribute @b{Source_Dirs} can be set to a list of path names, one @item The attribute @b{Source_Dirs} can be set to a list of path names, one
for each of the source directories. Such paths can either be absolute for each of the source directories. Such paths can either be absolute
...@@ -257,25 +258,25 @@ There are several ways of defining source directories: ...@@ -257,25 +258,25 @@ There are several ways of defining source directories:
Each of the source directories must exist and be readable. Each of the source directories must exist and be readable.
@cindex portability @cindex portability
The syntax for directories is platform specific. For portability, however, the The syntax for directories is platform specific. For portability, however,
project manager will always properly translate UNIX-like path names to the the project manager will always properly translate UNIX-like path names to
native format of specific platform. For instance, when the same project file the native format of specific platform. For instance, when the same project
is to be used both on Unix and Windows, "/" should be used as the directory file is to be used both on Unix and Windows, "/" should be used as the
separator rather than "\". directory separator rather than "\".
@item The attribute @b{Source_Dirs} can automatically include subdirectories using @item The attribute @b{Source_Dirs} can automatically include subdirectories
a special syntax inspired by some UNIX shells. If any of the path in the using a special syntax inspired by some UNIX shells. If any of the path in
list ends with @emph{"/**"}, then that path and all its subdirectories the list ends with @emph{"/**"}, then that path and all its subdirectories
(recursively) are included in the list of source directories. For (recursively) are included in the list of source directories. For instance,
instance, @file{./**} represent the complete directory tree rooted at ".". @file{./**} represent the complete directory tree rooted at ".".
@cindex Source directories, recursive @cindex Source directories, recursive
@cindex @code{Excluded_Source_Dirs} @cindex @code{Excluded_Source_Dirs}
When using that construct, it can sometimes be convenient to also use When using that construct, it can sometimes be convenient to also use the
the attribute @b{Excluded_Source_Dirs}, which is also a list of paths. attribute @b{Excluded_Source_Dirs}, which is also a list of paths. Each entry
Each entry specifies a directory whose immediate content, not including specifies a directory whose immediate content, not including subdirs, is to
subdirs, is to be excluded. It is also possible to exclude a complete directory be excluded. It is also possible to exclude a complete directory subtree
subtree using the "**" notation. using the "/**" notation.
@end itemize @end itemize
...@@ -305,24 +306,24 @@ locating the specified source files in the specified source directories. ...@@ -305,24 +306,24 @@ locating the specified source files in the specified source directories.
specified languages in all the source directories. specified languages in all the source directories.
Since the project manager was initially developed for Ada environments, the Since the project manager was initially developed for Ada environments, the
default language is Ada and the above project file is complete: it defines default language is usually Ada and the above project file is complete: it
without ambiguity the sources composing the project: that is to say, all defines without ambiguity the sources composing the project: that is to say,
the sources in subdirectory "common" for the default language (Ada) using all the sources in subdirectory "common" for the default language (Ada) using
the default naming convention. the default naming convention.
@cindex @code{Languages} @cindex @code{Languages}
However, when compiling a multi-language application, or a pure C However, when compiling a multi-language application, or a pure C
application, the project application, the project manager must be told which languages are of
manager must be told which languages are of interest, which is done by setting interest, which is done by setting the @b{Languages} attribute to a list of
the @b{Languages} attribute to a list of strings, each of which is the strings, each of which is the name of a language. Tools like
name of a language. Tools like @command{gnatmake} only know about Ada, @command{gnatmake} only know about Ada, while other tools like
while other tools like @command{gprbuild} know about many more @command{gprbuild} know about many more languages such as C, C++, Fortran,
languages such as C, C++, Fortran, assembly and others can be added dynamically. assembly and others can be added dynamically.
@cindex Naming scheme @cindex Naming scheme
Even when using only Ada, the default naming might not be suitable. Indeed, Even when using only Ada, the default naming might not be suitable. Indeed,
how does the project manager recognizes an "Ada file" from any other how does the project manager recognizes an "Ada file" from any other
file ? Project files can describe the naming scheme used for source files, file? Project files can describe the naming scheme used for source files,
and override the default (@pxref{Naming Schemes}). The default is the and override the default (@pxref{Naming Schemes}). The default is the
standard GNAT extension (@file{.adb} for bodies and @file{.ads} for standard GNAT extension (@file{.adb} for bodies and @file{.ads} for
specs), which is what is used in our example, explaining why no naming scheme specs), which is what is used in our example, explaining why no naming scheme
...@@ -355,8 +356,8 @@ locating the specified source files in the specified source directories. ...@@ -355,8 +356,8 @@ locating the specified source files in the specified source directories.
external tools. external tools.
A warning is issued if both attributes @code{Source_Files} and A warning is issued if both attributes @code{Source_Files} and
@code{Source_List_File} are given explicit values. In this case, the attribute @code{Source_List_File} are given explicit values. In this case, the
@code{Source_Files} prevails. attribute @code{Source_Files} prevails.
@item @cindex @code{Excluded_Source_Files} @item @cindex @code{Excluded_Source_Files}
@cindex @code{Locally_Removed_Files} @cindex @code{Locally_Removed_Files}
...@@ -366,9 +367,9 @@ locating the specified source files in the specified source directories. ...@@ -366,9 +367,9 @@ locating the specified source files in the specified source directories.
This can be done thanks to the attribute @b{Excluded_Source_Files} This can be done thanks to the attribute @b{Excluded_Source_Files}
(or its synonym @b{Locally_Removed_Files}). (or its synonym @b{Locally_Removed_Files}).
Its value is the list of file names that should not be taken into account. Its value is the list of file names that should not be taken into account.
This attribute is often used when extending a project, @xref{Project Extension}. This attribute is often used when extending a project, @xref{Project
A similar attribute @b{Excluded_Source_List_File} plays the same role Extension}. A similar attribute @b{Excluded_Source_List_File} plays the same
but takes the name of file containing file names similarly to role but takes the name of file containing file names similarly to
@code{Source_List_File}. @code{Source_List_File}.
@end itemize @end itemize
...@@ -385,12 +386,15 @@ attached to it unless explicitly declared as mentionend above. ...@@ -385,12 +386,15 @@ attached to it unless explicitly declared as mentionend above.
If the order of the source directories is known statically, that is if If the order of the source directories is known statically, that is if
@code{"/**"} is not used in the string list @code{Source_Dirs}, then there may @code{"/**"} is not used in the string list @code{Source_Dirs}, then there may
be several files with the same source file name sitting in different directories be several files with the same source file name sitting in different
of the project. In this case, only the file in the first directory is considered directories of the project. In this case, only the file in the first directory
as a source of the project and the others are hidden. If the order of the source is considered as a source of the project and the others are hidden. If
directories is not known statically, it is an error to have several files with @code{"/**"} is not used in the string list @code{Source_Dirs}, it is an error
the same source file name, since there would be an ambiguity as to which one to have several files with the same source file name in the same directory
should be used. @code{"/**"} subtree, since there would be an ambiguity as to which one should
be used. However, two files with the same source file name may in two single
directories or directory subtrees. In this case, the one in the first directory
or directory subtree is a source of the project.
@c --------------------------------------------- @c ---------------------------------------------
@node Object and Exec Directory @node Object and Exec Directory
...@@ -399,13 +403,13 @@ should be used. ...@@ -399,13 +403,13 @@ should be used.
@noindent @noindent
The next step when writing a project is to indicate where the compiler should The next step when writing a project is to indicate where the compiler should
put the object files. In fact, the compiler and other tools might create several put the object files. In fact, the compiler and other tools might create
different kind of files (for GNAT, there is the @code{.o} object file and the several different kind of files (for GNAT, there is the object file and the ALI
@code{.ali} file for instance). One of the important concepts in projects is file for instance). One of the important concepts in projects is that most
that most tools may consider source directories as read-only and do not attempt tools may consider source directories as read-only and do not attempt to create
to create new or temporary files there. Instead, all files are created new or temporary files there. Instead, all files are created in the object
in the object directory. It is of course not true for project-aware IDEs, directory. It is of course not true for project-aware IDEs, whose purpose it is
whose purpose it is to create the source files. to create the source files.
@cindex @code{Object_Dir} @cindex @code{Object_Dir}
The object directory is specified through the @b{Object_Dir} attribute. The object directory is specified through the @b{Object_Dir} attribute.
...@@ -416,7 +420,7 @@ some tools have a switch to create the directory if needed (See ...@@ -416,7 +420,7 @@ some tools have a switch to create the directory if needed (See
the switch @code{-p} for @command{gnatmake} and @command{gprbuild}). the switch @code{-p} for @command{gnatmake} and @command{gprbuild}).
If the attribute @code{Object_Dir} is not specified, it defaults to If the attribute @code{Object_Dir} is not specified, it defaults to
the directory that contains the project file. the project directory, that is the directory containing the project file.
For our example, we can specify the object dir in this way: For our example, we can specify the object dir in this way:
...@@ -428,13 +432,13 @@ For our example, we can specify the object dir in this way: ...@@ -428,13 +432,13 @@ For our example, we can specify the object dir in this way:
@end smallexample @end smallexample
@noindent @noindent
As mentioned earlier, there is a single object directory per project. As mentioned earlier, there is a single object directory per project. As a
As a result, if you have an existing system where the object files are spread result, if you have an existing system where the object files are spread in
in several directories, you can either move all of them into the same directory several directories, you can either move all of them into the same directory if
if you want to build it with a single project file, or you want to build it with a single project file, or study the section on
study the section on subsystems subsystems (@pxref{Organizing Projects into Subsystems}) to see how each
(@pxref{Organizing Projects into Subsystems}) to see how each separate object separate object directory can be associated with one of the subsystem
directory can be associated with one of the subsystem constituting the application. constituting the application.
When the @command{linker} is called, it usually creates an executable. By When the @command{linker} is called, it usually creates an executable. By
default, this executable is placed in the object directory of the project. It default, this executable is placed in the object directory of the project. It
...@@ -443,10 +447,10 @@ might be convenient to store it in its own directory. ...@@ -443,10 +447,10 @@ might be convenient to store it in its own directory.
@cindex @code{Exec_Dir} @cindex @code{Exec_Dir}
This can be done through the @code{Exec_Dir} attribute, which, like This can be done through the @code{Exec_Dir} attribute, which, like
@emph{Object_Dir} contains a single absolute or relative path and must point to @emph{Object_Dir} contains a single absolute or relative path and must point to
an existing and writable directory, unless you ask the tool to create it on your an existing and writable directory, unless you ask the tool to create it on
behalf. When not specified, It defaults to the object directory and therefore to your behalf. When not specified, It defaults to the object directory and
the project file's directory if neither @emph{Object_Dir} nor @emph{Exec_Dir} therefore to the project file's directory if neither @emph{Object_Dir} nor
was specified. @emph{Exec_Dir} was specified.
In the case of the example, let's place the executable in the root In the case of the example, let's place the executable in the root
of the hierarchy, ie the same directory as @file{build.gpr}. Hence of the hierarchy, ie the same directory as @file{build.gpr}. Hence
...@@ -510,22 +514,17 @@ automatically builds all the executables corresponding to the files ...@@ -510,22 +514,17 @@ automatically builds all the executables corresponding to the files
listed in the @emph{Main} attribute. It is possible to specify one listed in the @emph{Main} attribute. It is possible to specify one
or more executables on the command line to build a subset of them. or more executables on the command line to build a subset of them.
@cindex @code{Main_Language}
The attribute @b{Main_Language} contains a string that specifies the
language of the main program.
@c ??? What is this for, we already have the naming scheme
@c --------------------------------------------- @c ---------------------------------------------
@node Tools Options in Project Files @node Tools Options in Project Files
@subsection Tools Options in Project Files @subsection Tools Options in Project Files
@c --------------------------------------------- @c ---------------------------------------------
@noindent @noindent
We now have a project file that fully describes our environment, and can be used We now have a project file that fully describes our environment, and can be
to build the application with a simple @command{gnatmake} command as seen in the used to build the application with a simple @command{gnatmake} command as seen
previous section. In fact, the empty project we showed immediately at the in the previous section. In fact, the empty project we showed immediately at
beginning (with no attribute at all) could already fullfill that need if it was the beginning (with no attribute at all) could already fullfill that need if it
put in the @file{common} directory. was put in the @file{common} directory.
Of course, we always want more control. This section will show you how to Of course, we always want more control. This section will show you how to
specify the compilation switches that the various tools involved in the specify the compilation switches that the various tools involved in the
...@@ -533,16 +532,16 @@ building of the executable should use. ...@@ -533,16 +532,16 @@ building of the executable should use.
@cindex command line length @cindex command line length
Since source names and locations are described into the project file, it is not Since source names and locations are described into the project file, it is not
necessary to use switches on the command line for this purpose (switches such as necessary to use switches on the command line for this purpose (switches such
-I for gcc). This removes a major source of command line length overflow. as -I for gcc). This removes a major source of command line length overflow.
Clearly, the builders will have to communicate this information one way or Clearly, the builders will have to communicate this information one way or
another to the underlying compilers and tools they call but they usually use another to the underlying compilers and tools they call but they usually use
response files for this and thus should not be subject to command line response files for this and thus should not be subject to command line
overflows. overflows.
Several tools are participating to the creation of an executable: the Several tools are participating to the creation of an executable: the compiler
compiler produces object files from the source files; the binder (in the Ada produces object files from the source files; the binder (in the Ada case)
case) creates an source file that takes care, among other things, of elaboration creates an source file that takes care, among other things, of elaboration
issues and global variables initialization; and the linker gathers everything issues and global variables initialization; and the linker gathers everything
into a single executable that users can execute. All these tools are known by into a single executable that users can execute. All these tools are known by
the project manager and will be called with user defined switches from the the project manager and will be called with user defined switches from the
...@@ -553,13 +552,13 @@ express which switches to be used for any of the tools involved in the build. ...@@ -553,13 +552,13 @@ express which switches to be used for any of the tools involved in the build.
A project file is subdivided into zero or more @b{packages}, each of which A project file is subdivided into zero or more @b{packages}, each of which
contains the attributes specific to one tool (or one set of tools). Project contains the attributes specific to one tool (or one set of tools). Project
files use an Ada-like syntax for packages. Package names permitted in project files use an Ada-like syntax for packages. Package names permitted in project
files are restricted to a predefined set (@pxref{Packages}), and the contents of files are restricted to a predefined set (@pxref{Packages}), and the contents
packages are limited to a small set of constructs and attributes of packages are limited to a small set of constructs and attributes
(@pxref{Attributes}). (@pxref{Attributes}).
Our example project file can be extended with the following empty Our example project file can be extended with the following empty packages. At
packages. At this stage, they could all be omitted since they are empty, this stage, they could all be omitted since they are empty, but they show which
but they show which packages would be involved in the build process. packages would be involved in the build process.
@smallexample @smallexample
@b{project} Build @b{is} @b{project} Build @b{is}
...@@ -631,8 +630,8 @@ Several attributes can be used to specify the switches: ...@@ -631,8 +630,8 @@ Several attributes can be used to specify the switches:
@end smallexample @end smallexample
@noindent @noindent
@code{Switches} can also be given a language name as index instead of a file name @code{Switches} can also be given a language name as index instead of a file
in which case it has the same semantics as @emph{Default_Switches}. name in which case it has the same semantics as @emph{Default_Switches}.
@item @b{Local_Configuration_Pragams}: @item @b{Local_Configuration_Pragams}:
@cindex @code{Local_Configuration_Pragmas} @cindex @code{Local_Configuration_Pragmas}
...@@ -646,8 +645,8 @@ Several attributes can be used to specify the switches: ...@@ -646,8 +645,8 @@ Several attributes can be used to specify the switches:
The switches for the other tools are defined in a similar manner through the The switches for the other tools are defined in a similar manner through the
@b{Default_Switches} and @b{Switches} attributes, respectively in the @b{Default_Switches} and @b{Switches} attributes, respectively in the
@emph{Builder} package (for @command{gnatmake} and @command{gprbuild}), @emph{Builder} package (for @command{gnatmake} and @command{gprbuild}),
the @emph{Binder} package (for @command{gnatbind} and @command{gprbind}) the @emph{Binder} package (binding Ada executables) and the @emph{Linker}
and the @emph{Linker} package (for @command{gnatlink} and @command{gprlink}). package (for inking executables).
@c --------------------------------------------- @c ---------------------------------------------
@node Compiling with Project Files @node Compiling with Project Files
...@@ -744,7 +743,7 @@ on Windows), we could configure our project file to build "proc1" ...@@ -744,7 +743,7 @@ on Windows), we could configure our project file to build "proc1"
Attribute @b{Executable_Suffix}, when specified, may change the suffix Attribute @b{Executable_Suffix}, when specified, may change the suffix
of the executable files, when no attribute @code{Executable} applies: of the executable files, when no attribute @code{Executable} applies:
its value replace the platform-specific executable suffix. its value replace the platform-specific executable suffix.
By default, the latter is empty on UNIX and ".exe" on Windows. The default executable suffix is empty on UNIX and ".exe" on Windows.
It is also possible to change the name of the produced executable by using the It is also possible to change the name of the produced executable by using the
command line switch @option{-o}. when several mains are defined in the project, command line switch @option{-o}. when several mains are defined in the project,
...@@ -771,7 +770,7 @@ project C_Main is ...@@ -771,7 +770,7 @@ project C_Main is
C_Switches := ("-pedantic"); C_Switches := ("-pedantic");
for Default_Switches ("C") use C_Switches; for Default_Switches ("C") use C_Switches;
for Default_Switches ("Ada") use ("-gnaty"); for Default_Switches ("Ada") use ("-gnaty");
for Switches ("main.c") use C_Switches & ("-g"); for Switches ("main.c") use C_Switches & ("-g");
end Compiler; end Compiler;
end C_Main; end C_Main;
@end smallexample @end smallexample
...@@ -802,6 +801,7 @@ replaced by a reference to the @code{Default_Switches} attribute: ...@@ -802,6 +801,7 @@ replaced by a reference to the @code{Default_Switches} attribute:
Note the tick (@emph{'}) used to refer to attributes defined in a package. Note the tick (@emph{'}) used to refer to attributes defined in a package.
Here is the output of the GPRbuild command using this project: Here is the output of the GPRbuild command using this project:
@c This is NOT the output of gprbuild????
@smallexample @smallexample
$gprbuild -Pc_main $gprbuild -Pc_main
...@@ -817,7 +817,7 @@ gcc main.o -o main.exe ...@@ -817,7 +817,7 @@ gcc main.o -o main.exe
@noindent @noindent
The default switches for Ada sources, The default switches for Ada sources,
the default switches for C sources (in the compilation of @file{lib.c}), the default switches for C sources (in the compilation of @file{lib.c}),
and the specific switches for @file{c_main.c} have all been taken into and the specific switches for @file{main.c} have all been taken into
account. account.
@c --------------------------------------------- @c ---------------------------------------------
...@@ -829,8 +829,8 @@ account. ...@@ -829,8 +829,8 @@ account.
Sometimes an Ada software system is ported from one compilation environment to Sometimes an Ada software system is ported from one compilation environment to
another (say GNAT), and the file are not named using the default GNAT another (say GNAT), and the file are not named using the default GNAT
conventions. Instead of changing all the file names, which for a variety of conventions. Instead of changing all the file names, which for a variety of
reasons might not be possible, you can define the relevant file naming scheme in reasons might not be possible, you can define the relevant file naming scheme
the @b{Naming} package of your project file. in the @b{Naming} package of your project file.
The naming scheme has two distinct goals for the project manager: it The naming scheme has two distinct goals for the project manager: it
allows finding of source files when searching in the source allows finding of source files when searching in the source
...@@ -860,9 +860,9 @@ The following attributes can be defined in package @code{Naming}: ...@@ -860,9 +860,9 @@ The following attributes can be defined in package @code{Naming}:
@cindex @code{Dot_Replacement} @cindex @code{Dot_Replacement}
This attribute specifies the string that should replace the "." in unit This attribute specifies the string that should replace the "." in unit
names. Its default value is @code{"-"} so that a unit names. Its default value is @code{"-"} so that a unit
@code{Parent.Child}is expected to be found in the file @file{parent-child.adb}. @code{Parent.Child} is expected to be found in the file
The replacement string must satisfy the following requirements to @file{parent-child.adb}. The replacement string must satisfy the following
avoid ambiguities in the naming scheme: requirements to avoid ambiguities in the naming scheme:
@itemize - @itemize -
@item It must not be empty @item It must not be empty
...@@ -978,7 +978,7 @@ For example, the following package models the Apex file naming rules: ...@@ -978,7 +978,7 @@ For example, the following package models the Apex file naming rules:
@end ifclear @end ifclear
@ifset vms @ifset vms
For example, the following package models the HP Ada file naming rules: For example, the following package models the DEC Ada file naming rules:
@smallexample @c projectfile @smallexample @c projectfile
@group @group
...@@ -1053,21 +1053,18 @@ of our project: ...@@ -1053,21 +1053,18 @@ of our project:
When such a project is compiled, @command{gnatmake} will automatically When such a project is compiled, @command{gnatmake} will automatically
check the other projects and recompile their sources when needed. It will also check the other projects and recompile their sources when needed. It will also
recompile the sources from @code{Build} when needed, and finally create the recompile the sources from @code{Build} when needed, and finally create the
executable. In some cases, executable. In some cases, the implementation units needed to recompile a
the implementation units needed to recompile a project are not available, project are not available, or come from some third-party and you do not want to
or come from some third-party and recompile it yourself. In this case, the attribute @b{Externally_Built} to
you do not want to recompile it yourself. In this case, the "true" can be set, indicating to the builder that this project can be assumed
attribute @b{Externally_Built} to "true" can be set, indicating to the builder to be up-to-date, and should not be considered for recompilation. In Ada, if
that this project can be assumed to be up-to-date, and should not be considered the sources of this externally built project were compiled with another version
for recompilation. In Ada, if the sources of this externally built project of the compiler or with incompatible options, the binder will issue an error.
were compiled with another version of the compiler or with incompatible options,
the binder will issue an error.
The project's @code{with} clause has several effects. It provides source The project's @code{with} clause has several effects. It provides source
visibility between projects during the compilation process. visibility between projects during the compilation process. It also guarantees
It also guarantees that the necessary object files from @code{Logging} that the necessary object files from @code{Logging} and @code{GtkAda} are
and @code{GtkAda} are available when available when linking @code{Build}.
linking @code{Build}.
As can be seen in this example, the syntax for importing projects is similar As can be seen in this example, the syntax for importing projects is similar
to the syntax for importing compilation units in Ada. However, project files to the syntax for importing compilation units in Ada. However, project files
...@@ -1095,14 +1092,13 @@ the search stops: ...@@ -1095,14 +1092,13 @@ the search stops:
@cindex @code{GPR_PROJECT_PATH} @cindex @code{GPR_PROJECT_PATH}
Then it is searched relative to all the directories specified in the Then it is searched relative to all the directories specified in the
^environment variables^logical names^ @b{GPR_PROJECT_PATH} and ^environment variables^logical names^ @b{GPR_PROJECT_PATH} and
@b{ADA_PROJECT_PATH} (in that order) if they exist.. The former is @b{ADA_PROJECT_PATH} (in that order) if they exist. The former is
recommended, the latter is kept for backward compatibility. recommended, the latter is kept for backward compatibility.
@item Finally, it is searched relative to the default project directories. @item Finally, it is searched relative to the default project directories.
Such directories are defined by the compiler and are relative to the Such directories depends on the tool used. For @command{gnatmake}, there is
installation directory of that compiler (in the @file{lib/gnat/} and one default project directory: @file{<prefix>/lib/gnat/}. In our example,
@file{lib/gpr/} subdirectories). In our example, @file{gtkada.gpr} @file{gtkada.gpr} is found in the predefined directory if it was installed at
is found in the predefined directory if it was installed at the same root the same root as GNAT.
as GNAT.
@end itemize @end itemize
...@@ -1131,7 +1127,7 @@ when they do, they need to specify precisely which project owns which sources ...@@ -1131,7 +1127,7 @@ when they do, they need to specify precisely which project owns which sources
using attribute @code{Source_Files} or equivalent. By contrast, 2 projects using attribute @code{Source_Files} or equivalent. By contrast, 2 projects
can each own a source with the same base file name as long as they live in can each own a source with the same base file name as long as they live in
different directories. The latter is not true for Ada Sources because of the different directories. The latter is not true for Ada Sources because of the
correlation betwen source files and Ada units: it is not possible to link an correlation betwen source files and Ada units.
@c --------------------------------------------- @c ---------------------------------------------
@node Cyclic Project Dependencies @node Cyclic Project Dependencies
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2007,2009 Free Software Foundation, Inc. -- -- Copyright (C) 2007-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -528,7 +528,7 @@ package body System.Random_Numbers is ...@@ -528,7 +528,7 @@ package body System.Random_Numbers is
function Extract_Value (S : String; Index : Integer) return State_Val is function Extract_Value (S : String; Index : Integer) return State_Val is
begin begin
return State_Val'Value (S (S'First + Index * 11 .. return State_Val'Value (S (S'First + Index * 11 ..
S'First + Index * 11 + 11)); S'First + Index * 11 + 10));
end Extract_Value; end Extract_Value;
end System.Random_Numbers; end System.Random_Numbers;
...@@ -272,6 +272,10 @@ package SCOs is ...@@ -272,6 +272,10 @@ package SCOs is
-- enclosing statement. The SCO line for a nested decision always occurs -- enclosing statement. The SCO line for a nested decision always occurs
-- after the line for the enclosing decision. -- after the line for the enclosing decision.
-- Note that membership tests are considered to be a single simple
-- condition, and that is true even if the Ada 2005 set membership
-- form is used, e.g. A in (2,7,11.15).
-- Case Expressions -- Case Expressions
-- For case statements, we rely on statement coverage to make sure that -- For case statements, we rely on statement coverage to make sure that
......
...@@ -1037,8 +1037,8 @@ package body Sem_Ch3 is ...@@ -1037,8 +1037,8 @@ package body Sem_Ch3 is
begin begin
-- Associate the Itype node with the inner full-type declaration or -- Associate the Itype node with the inner full-type declaration or
-- subprogram spec. This is required to handle nested anonymous -- subprogram spec or entry body. This is required to handle nested
-- declarations. For example: -- anonymous declarations. For example:
-- procedure P -- procedure P
-- (X : access procedure -- (X : access procedure
...@@ -1050,7 +1050,9 @@ package body Sem_Ch3 is ...@@ -1050,7 +1050,9 @@ package body Sem_Ch3 is
N_Private_Type_Declaration, N_Private_Type_Declaration,
N_Private_Extension_Declaration, N_Private_Extension_Declaration,
N_Procedure_Specification, N_Procedure_Specification,
N_Function_Specification) N_Function_Specification,
N_Entry_Body)
or else or else
Nkind_In (D_Ityp, N_Object_Declaration, Nkind_In (D_Ityp, N_Object_Declaration,
N_Object_Renaming_Declaration, N_Object_Renaming_Declaration,
......
...@@ -1444,7 +1444,7 @@ package body Sem_Res is ...@@ -1444,7 +1444,7 @@ package body Sem_Res is
null; null;
-- Operator may be defined in an extension of system -- Operator may be defined in an extension of System
elsif Present (System_Aux_Id) elsif Present (System_Aux_Id)
and then Scope (Opnd_Type) = System_Aux_Id and then Scope (Opnd_Type) = System_Aux_Id
...@@ -1452,13 +1452,10 @@ package body Sem_Res is ...@@ -1452,13 +1452,10 @@ package body Sem_Res is
null; null;
else else
-- Note: go to First_Subtype here to ensure the message has the
-- proper source type name (Typ may be an anonymous base type).
-- Could we use Wrong_Type here??? (this would require setting -- Could we use Wrong_Type here??? (this would require setting
-- Etype (N) to the actual type found where Typ was expected). -- Etype (N) to the actual type found where Typ was expected).
Error_Msg_NE ("expect type&", N, First_Subtype (Typ)); Error_Msg_NE ("expect }", N, Typ);
end if; end if;
end if; end if;
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment