[multiple changes]

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

	* gnatcmd.adb, sem_util.adb, exp_ch3.adb: Minor reformatting

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

	* sem_ch12.adb (Save_References): If an identifier has been rewritten
	during analysis as an explicit dereference, keep the reference implicit
	in the generic, but preserve the entity if global. This prevents
	malformed generic trees in the presence of some nested generics.

2010-06-14  Sergey Rybin  <rybin@adacore.com>

	* gnat_ugn.texi: For the GNAT driver, clarify the effect of calling the
	tool with '-files=' option. Also fix some small errors (wrong brackets)

From-SVN: r160716
This commit is contained in:
Arnaud Charlet 2010-06-14 11:26:32 +02:00
parent 5d993afdcb
commit a50d578551
6 changed files with 58 additions and 24 deletions

View File

@ -1,3 +1,19 @@
2010-06-14 Robert Dewar <dewar@adacore.com>
* gnatcmd.adb, sem_util.adb, exp_ch3.adb: Minor reformatting
2010-06-14 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Save_References): If an identifier has been rewritten
during analysis as an explicit dereference, keep the reference implicit
in the generic, but preserve the entity if global. This prevents
malformed generic trees in the presence of some nested generics.
2010-06-14 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: For the GNAT driver, clarify the effect of calling the
tool with '-files=' option. Also fix some small errors (wrong brackets)
2010-06-14 Vincent Celier <celier@adacore.com>
* gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all

View File

@ -593,7 +593,7 @@ package body Exp_Ch3 is
------------------------
function Init_One_Dimension (N : Int) return List_Id is
Index : Entity_Id;
Index : Entity_Id;
begin
-- If the component does not need initializing, then there is nothing

View File

@ -14799,9 +14799,9 @@ to @command{gnatmake} that the binder generated file should be compiled
@noindent
A number of GNAT tools, other than @command{^gnatmake^gnatmake^}
can benefit from project files:
@command{^gnatbind^gnatbind^},
@command{^gnatcheck^gnatcheck^}),
@command{^gnatclean^gnatclean^}),
(@command{^gnatbind^gnatbind^},
@command{^gnatcheck^gnatcheck^},
@command{^gnatclean^gnatclean^},
@command{^gnatelim^gnatelim^},
@command{^gnatfind^gnatfind^},
@command{^gnatlink^gnatlink^},
@ -14809,7 +14809,7 @@ can benefit from project files:
@command{^gnatmetric^gnatmetric^},
@command{^gnatpp^gnatpp^},
@command{^gnatstub^gnatstub^},
and @command{^gnatxref^gnatxref^}. However, none of these tools can be invoked
and @command{^gnatxref^gnatxref^}). However, none of these tools can be invoked
directly with a project file switch (@option{^-P^/PROJECT_FILE=^}).
They must be invoked through the @command{gnat} driver.
@ -15085,8 +15085,8 @@ found in the package corresponding to the tool:
except @code{^Switches^Switches^ ("main.adb")}
for @code{^gnatlink^gnatlink^}.
It is also possible to invoke some of the tools,
@code{^gnatcheck^gnatcheck^}),
@code{^gnatmetric^gnatmetric^}),
(@code{^gnatcheck^gnatcheck^},
@code{^gnatmetric^gnatmetric^},
and @code{^gnatpp^gnatpp^})
on a set of project units thanks to the combination of the switches
@option{-P}, @option{-U} and possibly the main unit when one is interested
@ -15106,7 +15106,10 @@ gnat metric -Pproj -U main_unit
@end smallexample
will compute the metrics for the closure of units rooted at
@code{main_unit}. This last possibility relies implicitly
on @command{gnatbind}'s option @option{-R}.
on @command{gnatbind}'s option @option{-R}. But if the argument files for the
tool invoked by the the @command{gnat} driver are explicitly specified
either directly or through the tool @option{-files} option, then the tool
is called only for these explicitly specified files.
@c **********************
@node An Extended Example

View File

@ -318,8 +318,8 @@ procedure GNATCmd is
-- there is a -files= switch.
for Index in 1 .. Last_Switches.Last loop
if Last_Switches.Table (Index).all'Length > 7 and then
Last_Switches.Table (Index) (1 .. 7) = "-files="
if Last_Switches.Table (Index).all'Length > 7
and then Last_Switches.Table (Index) (1 .. 7) = "-files="
then
Add_Sources := False;
exit;
@ -353,13 +353,13 @@ procedure GNATCmd is
end if;
end loop;
-- If all arguments are switchesand there is no switch -files=, add the
-- path names of all the sources of the main project.
-- If all arguments are switches and there is no switch -files=, add
-- the path names of all the sources of the main project.
if Add_Sources then
-- For gnatcheck, gnatpp and gnatmetric , create a temporary file and
-- put the list of sources in it.
-- For gnatcheck, gnatpp and gnatmetric , create a temporary file
-- and put the list of sources in it.
if The_Command = Check or else
The_Command = Pretty or else

View File

@ -4848,8 +4848,13 @@ package body Sem_Ch12 is
-- To detect this case we have to rescan the list of formals, which
-- is usually short enough to ignore the resulting inefficiency.
-----------------------------
-- Denotes_Previous_Actual --
-----------------------------
function Denotes_Previous_Actual (Typ : Entity_Id) return Boolean is
Prev : Entity_Id;
begin
Prev := First_Entity (Instance);
while Present (Prev) loop
@ -4859,12 +4864,15 @@ package body Sem_Ch12 is
and then Entity (Subtype_Indication (Parent (Prev))) = Typ
then
return True;
elsif Prev = E then
return False;
else
Next_Entity (Prev);
end if;
end loop;
return False;
end Denotes_Previous_Actual;
@ -5874,7 +5882,7 @@ package body Sem_Ch12 is
-- If we are not instantiating, then this is where we load and
-- analyze subunits, i.e. at the point where the stub occurs. A
-- more permissible system might defer this analysis to the point
-- more permissive system might defer this analysis to the point
-- of instantiation, but this seems to complicated for now.
if not Instantiating then
@ -10480,10 +10488,18 @@ package body Sem_Ch12 is
Collect_Previous_Instances
(Private_Declarations (Specification (Decl)));
-- Previous non-generic bodies may contain instances as well
elsif Nkind (Decl) = N_Package_Body
and then Ekind (Corresponding_Spec (Decl)) /= E_Generic_Package
then
Collect_Previous_Instances (Declarations (Decl));
elsif Nkind (Decl) = N_Subprogram_Body
and then not Acts_As_Spec (Decl)
and then not Is_Generic_Subprogram (Corresponding_Spec (Decl))
then
Collect_Previous_Instances (Declarations (Decl));
end if;
Next (Decl);
@ -12023,18 +12039,17 @@ package body Sem_Ch12 is
elsif Nkind (N2) = N_Explicit_Dereference then
-- An identifier is rewritten as a dereference if it is the
-- prefix in an implicit dereference.
-- Check whether corresponding entity in prefix is global
-- prefix in an implicit dereference (call or attribute).
-- The analysis of an instantiation will expand the node
-- again, so we preserve the original tree but link it to
-- the resolved entity in case it is global.
if Is_Entity_Name (Prefix (N2))
and then Present (Entity (Prefix (N2)))
and then Is_Global (Entity (Prefix (N2)))
then
Rewrite (N,
Make_Explicit_Dereference (Loc,
Prefix =>
New_Occurrence_Of (Entity (Prefix (N2)), Loc)));
Set_Associated_Node (N, Prefix (N2));
elsif Nkind (Prefix (N2)) = N_Function_Call
and then Is_Global (Entity (Name (Prefix (N2))))
then

View File

@ -543,8 +543,8 @@ package body Sem_Util is
and then Is_Constrained (Root_Type (T)))
and then not Has_Unknown_Discriminants (T)
then
-- If the type of the dereference is already constrained, it
-- is an actual subtype.
-- If the type of the dereference is already constrained, it is an
-- actual subtype.
if Is_Array_Type (Etype (N))
and then Is_Constrained (Etype (N))