+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.
-- --
-- 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- --
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.
-- --
-- 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- --
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.
-- --
-- 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- --
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.
-- 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
-- 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
-- Has_Anonymous_Master Flag253
-- Is_Implementation_Defined Flag254
- -- (unused) Flag93
+ -- (unused) Flag188
-- (unused) Flag201
-----------------------
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));
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));
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));
-- 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
-- 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)
-- 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)
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;
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);
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);
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);
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 --
@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
@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
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})
-- --
-- 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- --
-- 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.
when Pragma_Ada_83 =>
Ada_Version := Ada_83;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version_Explicit := Ada_83;
------------
-- Ada_95 --
when Pragma_Ada_95 =>
Ada_Version := Ada_95;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version_Explicit := Ada_95;
---------------------
-- Ada_05/Ada_2005 --
case Attr_Id is
- -- 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);
+ -- 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);
------------------
-- Abort_Signal --
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))