[multiple changes]

2012-03-15  Ed Falis  <falis@adacore.com>

	* s-vxwork-ppc.ads: Update copyright.

2012-03-15  Robert Dewar  <dewar@adacore.com>

	* sem_ch5.adb: Minor reformatting.

2012-03-15  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch3.adb (Expand_N_Object_Declaration): When rewriting the
	declaration of a class-wide object, retain the Ekind to prevent
	subsequent misuse of constants.

2012-03-15  Yannick Moy  <moy@adacore.com>

	* gnat_rm.texi, gnat_ugn.texi: Minor correction of invariant
	terminology.

2012-03-15  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_util.adb (Initialized_By_Ctrl_Function): Add code to
	process the case when a function call appears in object.operation
	format.

2012-03-15  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.ads, sem_ch6.adb (Check_Subtype_Conformant): add
	Get_Inst formal, so that conformance within an instantiation
	follows renamings of formals. This is similar to what is already
	done in Check_Mode_conformant.
	* sem_ch12.adb (Vailidate_Access_Subprogram_Instance): check that
	formal and actual are subtype conformant. Previously only mode
	conformance was required.

From-SVN: r185410
This commit is contained in:
Arnaud Charlet 2012-03-15 09:44:33 +01:00
parent 011f9d5d67
commit f307415a69
10 changed files with 88 additions and 27 deletions

View File

@ -1,3 +1,34 @@
2012-03-15 Robert Dewar <dewar@adacore.com>
* sem_ch5.adb: Minor reformatting.
2012-03-15 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Expand_N_Object_Declaration): When rewriting the
declaration of a class-wide object, retain the Ekind to prevent
subsequent misuse of constants.
2012-03-15 Yannick Moy <moy@adacore.com>
* gnat_rm.texi, gnat_ugn.texi: Minor correction of invariant
terminology.
2012-03-15 Hristian Kirtchev <kirtchev@adacore.com>
* exp_util.adb (Initialized_By_Ctrl_Function): Add code to
process the case when a function call appears in object.operation
format.
2012-03-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.ads, sem_ch6.adb (Check_Subtype_Conformant): add
Get_Inst formal, so that conformance within an instantiation
follows renamings of formals. This is similar to what is already
done in Check_Mode_conformant.
* sem_ch12.adb (Vailidate_Access_Subprogram_Instance): check that
formal and actual are subtype conformant. Previously only mode
conformance was required.
2012-03-15 Robert Dewar <dewar@adacore.com>
* par-ch6.adb, einfo.ads, sem_eval.adb, sem_eval.ads,

View File

@ -4829,10 +4829,12 @@ package body Exp_Ch3 is
-- object renaming declaration ---because these identifiers
-- were previously added by Enter_Name to the current scope.
-- We must preserve the homonym chain of the source entity
-- as well.
-- as well. We must also preserve the kind of the entity,
-- which may be a constant.
Set_Chars (Defining_Identifier (N), Chars (Def_Id));
Set_Homonym (Defining_Identifier (N), Homonym (Def_Id));
Set_Ekind (Defining_Identifier (N), Ekind (Def_Id));
Exchange_Entities (Defining_Identifier (N), Def_Id);
end;
end if;

View File

@ -3960,11 +3960,28 @@ package body Exp_Util is
----------------------------------
function Initialized_By_Ctrl_Function (N : Node_Id) return Boolean is
Expr : constant Node_Id := Original_Node (Expression (N));
Expr : Node_Id := Original_Node (Expression (N));
begin
if Nkind (Expr) = N_Function_Call then
Expr := Name (Expr);
end if;
-- The function call may appear in object.operation format. Strip
-- all prefixes and retrieve the function name.
loop
if Nkind (Expr) = N_Selected_Component then
Expr := Selector_Name (Expr);
else
exit;
end if;
end loop;
return
Nkind (Expr) = N_Function_Call
and then Needs_Finalization (Etype (Expr));
Nkind_In (Expr, N_Expanded_Name, N_Identifier)
and then Ekind (Entity (Expr)) = E_Function
and then Needs_Finalization (Etype (Entity (Expr)));
end Initialized_By_Ctrl_Function;
----------------------

View File

@ -3212,12 +3212,14 @@ pragma Invariant
@end smallexample
@noindent
This pragma provides exactly the same capabilities as the Invariant aspect
defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The Invariant
aspect is fully implemented in Ada 2012 mode, but since it requires the use
of the aspect syntax, which is not available exception in 2012 mode, it is
not possible to use the Invariant aspect in earlier versions of Ada. However
the Invariant pragma may be used in any version of Ada.
This pragma provides exactly the same capabilities as the Type_Invariant aspect
defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
requires the use of the aspect syntax, which is not available except in 2012
mode, it is not possible to use the Type_Invariant aspect in earlier versions
of Ada. However the Invariant pragma may be used in any version of Ada. Also
note that the aspect Invariant is a synonym in GNAT for the aspect
Type_Invariant, but there is no pragma Type_Invariant.
The pragma must appear within the visible part of the package specification,
after the type to which its Entity argument appears. As with the Invariant
@ -3233,7 +3235,7 @@ in Ada 2012 mode, but you cannot have both an invariant aspect and an
invariant pragma for the same entity.
For further details on the use of this pragma, see the Ada 2012 documentation
of the Invariant aspect.
of the Type_Invariant aspect.
@node Pragma Keep_Names
@unnumberedsec Pragma Keep_Names
@ -17378,7 +17380,7 @@ A complete description of the AIs may be found in
@item @code{Favor_Top_Level} @tab -- GNAT
@item @code{Inline} @tab
@item @code{Inline_Always} @tab -- GNAT
@item @code{Invariant} @tab
@item @code{Invariant} @tab -- GNAT
@item @code{Machine_Radix} @tab
@item @code{No_Return} @tab
@item @code{Object_Size} @tab -- GNAT
@ -17398,6 +17400,7 @@ A complete description of the AIs may be found in
@item @code{Suppress} @tab
@item @code{Suppress_Debug_Info} @tab -- GNAT
@item @code{Test_Case} @tab -- GNAT
@item @code{Type_Invariant} @tab
@item @code{Unchecked_Union} @tab
@item @code{Universal_Aliasing} @tab -- GNAT
@item @code{Unmodified} @tab -- GNAT
@ -18418,8 +18421,8 @@ A complete description of the AIs may be found in
@noindent
Type invariants may be specified for private types using the aspect notation.
Aspect @code{Invariant} may be specified for any private type,
@code{Invariant'Class} can
Aspect @code{Type_Invariant} may be specified for any private type,
@code{Type_Invariant'Class} can
only be specified for tagged types, and is inherited by any descendent of the
tagged types. The invariant is a boolean expression that is tested for being
true in the following situations: conversions to the private type, object
@ -18427,6 +18430,8 @@ A complete description of the AIs may be found in
[@b{in}] @b{out}
parameters and returned result on return from any primitive operation for
the type that is visible to a client.
GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
@code{Invariant'Class} for @code{Type_Invariant'Class}.
@noindent
RM References: 13.03.03 (00)

View File

@ -3090,7 +3090,7 @@ $ gnatlink ada_unit file1.o file2.o --LINK=./my_script
@end smallexample
If the @code{zero cost} exception mechanism is used, and the platform
doesn't support automatic registration of exception tables (e.g.@: HP-UX,
doesn't support automatic registration of exception tables (e.g.@: HP-UX
or AIX), the simple approach described above will not work and
a pre-linking phase using GNAT will be necessary.
@ -5442,8 +5442,8 @@ when such pragmas should be used.
@emph{List inherited aspects.}
@cindex @option{-gnatw.l} (@command{gcc})
This switch causes the compiler to list inherited invariants,
preconditions, and postconditions from Invariant'Class, Pre'Class, and
Post'Class aspects. Also list inherited subtype predicates.
preconditions, and postconditions from Type_Invariant'Class, Invariant'Class,
Pre'Class, and Post'Class aspects. Also list inherited subtype predicates.
These messages are not automatically turned on by the use of @option{-gnatwa}.
@item -gnatw.L

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2011, Free Software Foundation, Inc. --
-- Copyright (C) 1998-2012, Free Software Foundation, Inc. --
-- --
-- GNARL 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- --

View File

@ -10433,7 +10433,11 @@ package body Sem_Ch12 is
Abandon_Instantiation (Actual);
end if;
Check_Mode_Conformant
-- In Ada 2012, actuals for access_to_subprograms must be subtype
-- conformant with the generic formal. Previous to AI05-288 only mode
-- conformance was required.
Check_Subtype_Conformant
(Designated_Type (Act_T),
Designated_Type (A_Gen_T),
Actual,

View File

@ -2087,10 +2087,9 @@ package body Sem_Ch5 is
Check_Controlled_Array_Attribute (DS);
-- The index is not processed during the analysis of a
-- quantified expression but delayed to its expansion where the
-- quantified expression is transformed into an expression with
-- actions.
-- The index is not processed during analysis of a quantified
-- expression but delayed to its expansion where the quantified
-- expression is transformed into an expression with actions.
if Nkind (Parent (N)) /= N_Quantified_Expression
or else Operating_Mode = Check_Semantics

View File

@ -7251,14 +7251,16 @@ package body Sem_Ch6 is
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Err_Loc : Node_Id := Empty;
Skip_Controlling_Formals : Boolean := False)
Skip_Controlling_Formals : Boolean := False;
Get_Inst : Boolean := False)
is
Result : Boolean;
pragma Warnings (Off, Result);
begin
Check_Conformance
(New_Id, Old_Id, Subtype_Conformant, True, Result, Err_Loc,
Skip_Controlling_Formals => Skip_Controlling_Formals);
Skip_Controlling_Formals => Skip_Controlling_Formals,
Get_Inst => Get_Inst);
end Check_Subtype_Conformant;
---------------------------

View File

@ -28,7 +28,7 @@ package Sem_Ch6 is
type Conformance_Type is
(Type_Conformant, Mode_Conformant, Subtype_Conformant, Fully_Conformant);
pragma Ordered (Conformance_Type);
-- pragma Ordered (Conformance_Type);
-- Conformance type used in conformance checks between specs and bodies,
-- and for overriding. The literals match the RM definitions of the
-- corresponding terms. This is an ordered type, since each conformance
@ -141,7 +141,8 @@ package Sem_Ch6 is
(New_Id : Entity_Id;
Old_Id : Entity_Id;
Err_Loc : Node_Id := Empty;
Skip_Controlling_Formals : Boolean := False);
Skip_Controlling_Formals : Boolean := False;
Get_Inst : Boolean := False);
-- Check that two callable entities (subprograms, entries, literals)
-- are subtype conformant, post error message if not (RM 6.3.1(16)),
-- the flag being placed on the Err_Loc node if it is specified, and