[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 7 Mar 2012 14:37:26 +0000 (15:37 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 7 Mar 2012 14:37:26 +0000 (15:37 +0100)
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

13 files changed:
gcc/ada/ChangeLog
gcc/ada/a-strsup.ads
gcc/ada/a-stwisu.ads
gcc/ada/a-stzsup.ads
gcc/ada/einfo.adb
gcc/ada/einfo.ads
gcc/ada/exp_attr.adb
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/hostparm.ads
gcc/ada/par-prag.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_res.adb

index 82db6883b375bbbc3ba6840e510bad1e71a17e8c..a864c028c4dabed68b888e94d9c9ed15958e8ffa 100644 (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.
index c88c563d3d619ab58b7b5b0999d69371e5d84d00..39f33647442363e5438930ccf50f650f27e00d95 100644 (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.
index 0390031f3da5ee58e780254e1553460187e7d534..bc0c5c1290f2d49afb20a3a1169cab8c0beece07 100644 (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.
index 7e67f53bae849e7720f15ad49489482657a3074f..3028aaa0b8525f590e2a389a9f1ddbe64d9fa9c7 100644 (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.
index 260e119413d9759f987888b16cd0d42a4d7b0c16..0fdc83c3086633ece3a65ab41119cabee99caca5 100644 (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));
index d0c8d33da1929af2ccb88e9ab448b8a906cad2b8..84775779d12204a481c36afc62024c27b980801c 100644 (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);
index 4e0c60cdb5736133cdf076baf5c61912181b950d..7621ff75e75fb5e81df2517204aa591120b6a478 100644 (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 --
index 9b10794e5c9de1c18e8b5704288deeb8d4fe4435..f652151f3569158911b68525292897000b2ef123 100644 (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
index e93320cf9d93a7e76e83bcbc8250bfec8b11ffec..f9f09fa667e262af7055d0f00f1b9d128bf91fc0 100644 (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})
index 64164f327f4cec1c1c1dc676f68380dd72ea11e0..67a7f1d4c3cb5b90df33062b745bb36b021222ff 100644 (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.
index 2e4d9b1332c4c4754957b21256d27b2aec3eb0fa..629540a4fe459ec4562504ec2520e01ebe7649a3 100644 (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 --
index 210e49c0a01c30853e5541b7fe7cba4bbcbdc2be..a2b33d8bceb1e4cfae20a672312abd66ad5a666e 100644 (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.
-
-         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 --
index 1b2eef0a90db2eeb9a6febcd46f77abec1477173..01fabab67cbed2d498dfe247b240ba11c23f28f4 100644 (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))