[multiple changes]

2012-03-07  Thomas Quinot  <quinot@adacore.com>

	* einfo.adb, einfo.ads: Add flag Reverse_Storage_Order.

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

	* gnat_rm.texi, gnat_ugn.texi: Rewording of GNAT UG and GNAT RM to
	account for Ada 2012 assertions, and their pragma counterparts in GNAT.

2012-03-07  Thomas Quinot  <quinot@adacore.com>

	* exp_attr.adb, sem_attr.adb: Minor reformatting.

2012-03-07  Bob Duff  <duff@adacore.com>

	* hostparm.ads (Max_Instantiations): Increase parameter.

2012-03-07  Bob Duff  <duff@adacore.com>

	* par-prag.adb: Minor code rearrangement.

2012-03-07  Bob Duff  <duff@adacore.com>

	* a-strsup.ads, a-stwisu.ads, a-stzsup.ads (Super_String):
	Remove default initial value for Data. It is no longer needed
	because "=" now composes properly for untagged records. This
	default has caused efficiency problems.

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

	* sem_res.adb (Resolve_Actuals): If the actual is a selected
	component of an anonymous access type, whose prefix is a variable,
	treat the variable as if it may be modified by the call, to
	suppress spurious warnings that a variable might be declared as
	a constant.

From-SVN: r185049
This commit is contained in:
Arnaud Charlet 2012-03-07 15:37:26 +01:00
parent 0f2508394b
commit de94a7e7ff
13 changed files with 137 additions and 33 deletions

View File

@ -1,3 +1,39 @@
2012-03-07 Thomas Quinot <quinot@adacore.com>
* einfo.adb, einfo.ads: Add flag Reverse_Storage_Order.
2012-03-07 Yannick Moy <moy@adacore.com>
* gnat_rm.texi, gnat_ugn.texi: Rewording of GNAT UG and GNAT RM to
account for Ada 2012 assertions, and their pragma counterparts in GNAT.
2012-03-07 Thomas Quinot <quinot@adacore.com>
* exp_attr.adb, sem_attr.adb: Minor reformatting.
2012-03-07 Bob Duff <duff@adacore.com>
* hostparm.ads (Max_Instantiations): Increase parameter.
2012-03-07 Bob Duff <duff@adacore.com>
* par-prag.adb: Minor code rearrangement.
2012-03-07 Bob Duff <duff@adacore.com>
* a-strsup.ads, a-stwisu.ads, a-stzsup.ads (Super_String):
Remove default initial value for Data. It is no longer needed
because "=" now composes properly for untagged records. This
default has caused efficiency problems.
2012-03-07 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb (Resolve_Actuals): If the actual is a selected
component of an anonymous access type, whose prefix is a variable,
treat the variable as if it may be modified by the call, to
suppress spurious warnings that a variable might be declared as
a constant.
2012-03-07 Thomas Quinot <quinot@adacore.com>
* einfo.adb, einfo.ads: Remove unused entity flags.

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2003-2010, Free Software Foundation, Inc. --
-- Copyright (C) 2003-2012, Free Software Foundation, Inc. --
-- --
-- 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- --
@ -43,7 +43,10 @@ package Ada.Strings.Superbounded is
type Super_String (Max_Length : Positive) is record
Current_Length : Natural := 0;
Data : String (1 .. Max_Length) := (others => ASCII.NUL);
Data : String (1 .. Max_Length);
-- A previous version had a default initial value for Data, which is no
-- longer necessary, because "=" now composes properly for untagged
-- records. Leaving it out is more efficient.
end record;
-- Type Bounded_String in Ada.Strings.Bounded.Generic_Bounded_Length is
-- derived from this type, with the constraint of the maximum length.

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2003-2010, Free Software Foundation, Inc. --
-- Copyright (C) 2003-2012, Free Software Foundation, Inc. --
-- --
-- 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- --
@ -46,7 +46,10 @@ package Ada.Strings.Wide_Superbounded is
type Super_String (Max_Length : Positive) is record
Current_Length : Natural := 0;
Data : Wide_String (1 .. Max_Length) := (others => Wide_NUL);
Data : Wide_String (1 .. Max_Length);
-- A previous version had a default initial value for Data, which is no
-- longer necessary, because "=" now composes properly for untagged
-- records. Leaving it out is more efficient.
end record;
-- Ada.Strings.Wide_Bounded.Generic_Bounded_Length.Wide_Bounded_String is
-- derived from this type, with the constraint of the maximum length.

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2003-2010, Free Software Foundation, Inc. --
-- Copyright (C) 2003-2012, Free Software Foundation, Inc. --
-- --
-- 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- --
@ -47,8 +47,10 @@ package Ada.Strings.Wide_Wide_Superbounded is
type Super_String (Max_Length : Positive) is record
Current_Length : Natural := 0;
Data : Wide_Wide_String (1 .. Max_Length) :=
(others => Wide_Wide_NUL);
Data : Wide_Wide_String (1 .. Max_Length);
-- A previous version had a default initial value for Data, which is no
-- longer necessary, because "=" now composes properly for untagged
-- records. Leaving it out is more efficient.
end record;
-- Wide_Wide_Bounded.Generic_Bounded_Length.Wide_Wide_Bounded_String is
-- derived from this type, with the constraint of the maximum length.

View File

@ -348,6 +348,7 @@ package body Einfo is
-- Is_Itype Flag91
-- Size_Known_At_Compile_Time Flag92
-- Reverse_Storage_Order Flag93
-- Is_Generic_Actual_Type Flag94
-- Uses_Sec_Stack Flag95
-- Warnings_Off Flag96
@ -451,7 +452,6 @@ package body Einfo is
-- Is_Ada_2005_Only Flag185
-- Is_Interface Flag186
-- Has_Constrained_Partial_View Flag187
-- (unassgined) Flag188
-- Is_Pure_Unit_Access_Type Flag189
-- Has_Specified_Stream_Input Flag190
@ -525,7 +525,7 @@ package body Einfo is
-- Has_Anonymous_Master Flag253
-- Is_Implementation_Defined Flag254
-- (unused) Flag93
-- (unused) Flag188
-- (unused) Flag201
-----------------------
@ -2610,6 +2610,12 @@ package body Einfo is
return Flag164 (Base_Type (Id));
end Reverse_Bit_Order;
function Reverse_Storage_Order (Id : E) return B is
begin
pragma Assert (Is_Record_Type (Id));
return Flag93 (Base_Type (Id));
end Reverse_Storage_Order;
function RM_Size (Id : E) return U is
begin
pragma Assert (Is_Type (Id));
@ -5163,6 +5169,13 @@ package body Einfo is
Set_Flag164 (Id, V);
end Set_Reverse_Bit_Order;
procedure Set_Reverse_Storage_Order (Id : E; V : B := True) is
begin
pragma Assert
(Is_Record_Type (Id) and then Is_Base_Type (Id));
Set_Flag93 (Id, V);
end Set_Reverse_Storage_Order;
procedure Set_RM_Size (Id : E; V : U) is
begin
pragma Assert (Is_Type (Id));
@ -7656,6 +7669,7 @@ package body Einfo is
W ("Return_Present", Flag54 (Id));
W ("Returns_By_Ref", Flag90 (Id));
W ("Reverse_Bit_Order", Flag164 (Id));
W ("Reverse_Storage_Order", Flag93 (Id));
W ("Sec_Stack_Needed_For_Return", Flag167 (Id));
W ("Size_Depends_On_Discriminant", Flag177 (Id));
W ("Size_Known_At_Compile_Time", Flag92 (Id));

View File

@ -3548,6 +3548,13 @@ package Einfo is
-- a single storage unit (Ada 95) or within a single machine scalar (see
-- Ada 2005 AI-133), or must occupy an integral number of storage units.
-- Reverse_Storage_Order (Flag93) [base type only]
-- Present in all record type entities. Set if entity has a
-- Scalar_Storage_Order aspect (set by an aspect clause or attribute
-- definition clause) that has reversed the order of storage elements
-- from the default value. When this flag is set, the Bit_Order aspect
-- must be set to the same value.
-- RM_Size (Uint13)
-- Present in all type and subtype entities. Contains the value of
-- type'Size as defined in the RM. See also the Esize field and
@ -5625,6 +5632,7 @@ package Einfo is
-- Is_Limited_Interface (Flag197)
-- OK_To_Reorder_Components (Flag239) (base type only)
-- Reverse_Bit_Order (Flag164) (base type only)
-- Reverse_Storage_Order (Flag93) (base type only)
-- First_Component (synth)
-- First_Component_Or_Discriminant (synth)
-- (plus type attributes)
@ -5651,6 +5659,7 @@ package Einfo is
-- Is_Limited_Interface (Flag197)
-- OK_To_Reorder_Components (Flag239) (base type only)
-- Reverse_Bit_Order (Flag164) (base type only)
-- Reverse_Storage_Order (Flag93) (base type only)
-- First_Component (synth)
-- First_Component_Or_Discriminant (synth)
-- (plus type attributes)
@ -6360,6 +6369,7 @@ package Einfo is
function Return_Present (Id : E) return B;
function Returns_By_Ref (Id : E) return B;
function Reverse_Bit_Order (Id : E) return B;
function Reverse_Storage_Order (Id : E) return B;
function Scalar_Range (Id : E) return N;
function Scale_Value (Id : E) return U;
function Scope_Depth_Value (Id : E) return U;
@ -6955,6 +6965,7 @@ package Einfo is
procedure Set_Return_Present (Id : E; V : B := True);
procedure Set_Returns_By_Ref (Id : E; V : B := True);
procedure Set_Reverse_Bit_Order (Id : E; V : B := True);
procedure Set_Reverse_Storage_Order (Id : E; V : B := True);
procedure Set_Scalar_Range (Id : E; V : N);
procedure Set_Scale_Value (Id : E; V : U);
procedure Set_Scope_Depth_Value (Id : E; V : U);
@ -7699,6 +7710,7 @@ package Einfo is
pragma Inline (Return_Present);
pragma Inline (Returns_By_Ref);
pragma Inline (Reverse_Bit_Order);
pragma Inline (Reverse_Storage_Order);
pragma Inline (Scalar_Range);
pragma Inline (Scale_Value);
pragma Inline (Scope_Depth_Value);
@ -8100,6 +8112,7 @@ package Einfo is
pragma Inline (Set_Return_Present);
pragma Inline (Set_Returns_By_Ref);
pragma Inline (Set_Reverse_Bit_Order);
pragma Inline (Set_Reverse_Storage_Order);
pragma Inline (Set_Scalar_Range);
pragma Inline (Set_Scale_Value);
pragma Inline (Set_Scope_Depth_Value);

View File

@ -678,13 +678,13 @@ package body Exp_Attr is
case Id is
-- Attributes related to Ada 2012 iterators (placeholder ???)
-- Attributes related to Ada 2012 iterators (placeholder ???)
when Attribute_Constant_Indexing => null;
when Attribute_Default_Iterator => null;
when Attribute_Implicit_Dereference => null;
when Attribute_Iterator_Element => null;
when Attribute_Variable_Indexing => null;
when Attribute_Constant_Indexing => null;
when Attribute_Default_Iterator => null;
when Attribute_Implicit_Dereference => null;
when Attribute_Iterator_Element => null;
when Attribute_Variable_Indexing => null;
------------
-- Access --

View File

@ -1202,11 +1202,23 @@ pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
@end smallexample
@noindent
If the argument is @code{CHECK}, then pragma @code{Assert} is enabled.
If the argument is @code{IGNORE}, then pragma @code{Assert} is ignored.
If the argument is @code{CHECK}, then assertions are enabled.
If the argument is @code{IGNORE}, then assertions are ignored.
This pragma overrides the effect of the @option{-gnata} switch on the
command line.
Assertions are of three kinds:
@itemize @bullet
@item
Pragma @code{Assert}.
@item
In Ada 2012, all assertions defined in the RM as aspects: preconditions,
postconditions, type invariants and (sub)type predicates.
@item
Corresponding pragmas for type invariants and (sub)type predicates.
@end itemize
The implementation defined policy @code{DISABLE} is like
@code{IGNORE} except that it completely disables semantic
checking of the argument to @code{pragma Assert}. This may
@ -1423,17 +1435,20 @@ pragma Check_Policy (Critical_Error, OFF);
@noindent
is given, then subsequent @code{Check} pragmas whose first argument is also
@code{Critical_Error} will be disabled. The special identifier @code{Assertion}
controls the behavior of normal @code{Assert} pragmas (thus a pragma
controls the behavior of normal assertions (thus a pragma
@code{Check_Policy} with this identifier is similar to the normal
@code{Assertion_Policy} pragma except that it can appear within a
declarative part).
The special identifiers @code{Precondition} and @code{Postcondition} control
the status of preconditions and postconditions. If a @code{Precondition} pragma
the status of preconditions and postconditions given as pragmas.
If a @code{Precondition} pragma
is encountered, it is ignored if turned off by a @code{Check_Policy} specifying
that @code{Precondition} checks are @code{Off} or @code{Ignored}. Similarly use
of the name @code{Postcondition} controls whether @code{Postcondition} pragmas
are recognized.
are recognized. Note that preconditions and postconditions given as aspects
are controlled differently, either by the @code{Assertion_Policy} pragma or
by the @code{Check_Policy} pragma with identifier @code{Assertion}.
The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
to turn on corresponding checks. The default for a set of checks for which no

View File

@ -4073,7 +4073,11 @@ activated. Note that these pragmas can also be controlled using the
configuration pragmas @code{Assertion_Policy} and @code{Debug_Policy}.
It also activates pragmas @code{Check}, @code{Precondition}, and
@code{Postcondition}. Note that these pragmas can also be controlled
using the configuration pragma @code{Check_Policy}.
using the configuration pragma @code{Check_Policy}. In Ada 2012, it
also activates all assertions defined in the RM as aspects: preconditions,
postconditions, type invariants and (sub)type predicates. In all Ada modes,
corresponding pragmas for type invariants and (sub)type predicates are
also activated.
@item -gnatA
@cindex @option{-gnatA} (@command{gcc})

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- 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- --
@ -69,7 +69,7 @@ package Hostparm is
-- of file names in the library, must be at least Max_Line_Length, but
-- can be larger.
Max_Instantiations : constant := 4000;
Max_Instantiations : constant := 8000;
-- Maximum number of instantiations permitted (to stop runaway cases
-- of nested instantiations). These situations probably only occur in
-- specially concocted test cases.

View File

@ -310,7 +310,7 @@ begin
when Pragma_Ada_83 =>
Ada_Version := Ada_83;
Ada_Version_Explicit := Ada_Version;
Ada_Version_Explicit := Ada_83;
------------
-- Ada_95 --
@ -322,7 +322,7 @@ begin
when Pragma_Ada_95 =>
Ada_Version := Ada_95;
Ada_Version_Explicit := Ada_Version;
Ada_Version_Explicit := Ada_95;
---------------------
-- Ada_05/Ada_2005 --

View File

@ -2134,15 +2134,15 @@ package body Sem_Attr is
case Attr_Id is
-- Attributes related to Ada 2012 iterators. Attribute specifications
-- exist for these, but they cannot be queried.
-- Attributes related to Ada 2012 iterators. Attribute specifications
-- exist for these, but they cannot be queried.
when Attribute_Constant_Indexing |
Attribute_Default_Iterator |
Attribute_Implicit_Dereference |
Attribute_Iterator_Element |
Attribute_Variable_Indexing =>
Error_Msg_N ("illegal attribute", N);
when Attribute_Constant_Indexing |
Attribute_Default_Iterator |
Attribute_Implicit_Dereference |
Attribute_Iterator_Element |
Attribute_Variable_Indexing =>
Error_Msg_N ("illegal attribute", N);
------------------
-- Abort_Signal --

View File

@ -3968,6 +3968,20 @@ package body Sem_Res is
Error_Msg_N
("invalid implicit conversion for access parameter", A);
end if;
-- If the actual is an access selected component of a variable,
-- the call may modify its designated object. It is reasonable
-- to treat this as a potential modification of the enclosing
-- record, to prevent spurious warnings that it should be
-- declared as a constant, because intuitively programmers
-- regard the designated subcomponent as part of the record.
if Nkind (A) = N_Selected_Component
and then Is_Entity_Name (Prefix (A))
and then not Is_Constant_Object (Entity (Prefix (A)))
then
Note_Possible_Modification (A, Sure => False);
end if;
end if;
-- Check bad case of atomic/volatile argument (RM C.6(12))