diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-07 14:37:26 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-07 14:37:26 +0000 |
commit | 19a5cf04d15892234f34ec172c23f65c9f524aeb (patch) | |
tree | 3453ccf0772d82d19afcfe1be5b4a5271b2ad0c8 | |
parent | 1b3c3119971d15769babdee619abcca551fbe7ad (diff) | |
download | gcc-19a5cf04d15892234f34ec172c23f65c9f524aeb.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185049 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 36 | ||||
-rw-r--r-- | gcc/ada/a-strsup.ads | 7 | ||||
-rw-r--r-- | gcc/ada/a-stwisu.ads | 7 | ||||
-rw-r--r-- | gcc/ada/a-stzsup.ads | 8 | ||||
-rw-r--r-- | gcc/ada/einfo.adb | 18 | ||||
-rw-r--r-- | gcc/ada/einfo.ads | 13 | ||||
-rw-r--r-- | gcc/ada/exp_attr.adb | 12 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 25 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 6 | ||||
-rw-r--r-- | gcc/ada/hostparm.ads | 4 | ||||
-rw-r--r-- | gcc/ada/par-prag.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 18 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 14 |
13 files changed, 138 insertions, 34 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 82db6883b37..a864c028c4d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,41 @@ 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. 2012-03-07 Eric Botcazou <ebotcazou@adacore.com> diff --git a/gcc/ada/a-strsup.ads b/gcc/ada/a-strsup.ads index c88c563d3d6..39f33647442 100644 --- a/gcc/ada/a-strsup.ads +++ b/gcc/ada/a-strsup.ads @@ -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. diff --git a/gcc/ada/a-stwisu.ads b/gcc/ada/a-stwisu.ads index 0390031f3da..bc0c5c1290f 100644 --- a/gcc/ada/a-stwisu.ads +++ b/gcc/ada/a-stwisu.ads @@ -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. diff --git a/gcc/ada/a-stzsup.ads b/gcc/ada/a-stzsup.ads index 7e67f53bae8..3028aaa0b85 100644 --- a/gcc/ada/a-stzsup.ads +++ b/gcc/ada/a-stzsup.ads @@ -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. diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index 260e119413d..0fdc83c3086 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -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)); diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index d0c8d33da19..84775779d12 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -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); diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 4e0c60cdb57..7621ff75e75 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -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 -- diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 9b10794e5c9..f652151f356 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -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 diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index e93320cf9d9..f9f09fa667e 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -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}) diff --git a/gcc/ada/hostparm.ads b/gcc/ada/hostparm.ads index 64164f327f4..67a7f1d4c3c 100644 --- a/gcc/ada/hostparm.ads +++ b/gcc/ada/hostparm.ads @@ -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. diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 2e4d9b1332c..629540a4fe4 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -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 -- diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 210e49c0a01..a2b33d8bceb 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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 -- diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 1b2eef0a90d..01fabab67cb 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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)) |