summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coorse.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-30 14:14:11 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-30 14:14:11 +0000
commit82acbddad3d1ba880cae9dcfd4f0705de2b9b693 (patch)
tree53066db52b318418f14cc54eb9820b3b1bb18089 /gcc/ada/a-coorse.ads
parent0d66ba6ced1a26807dc6537ac5f7ac4ffac8efec (diff)
downloadgcc-82acbddad3d1ba880cae9dcfd4f0705de2b9b693.tar.gz
2014-07-30 Ed Schonberg <schonberg@adacore.com>
* a-coorse.adb, a-coorse.ads (Generic_Keys): Add a Reference_Control_Type to generic package, to keep additional information for Reference_Types that manipulate keys. Add Adjust and Finalize procedures for this type. (Finalize): When finalizing a reference_preserving_key, verify that the key of the new value is equivalent to the key of the original element, raise Program_Error otherwise. (Insert): Detect tampering. (Reference_Preserving_Key): Build proper Reference_Control_Type, and update Busy and Lock bits to detect tampering. * a-cohase.ads: Keep with-clause private. 2014-07-30 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch4.adb (Expand_N_Op_Eq): Emit a warning when the operands of an equality are of an Unchecked_Union type and lack inferable discriminants. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213277 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coorse.ads')
-rw-r--r--gcc/ada/a-coorse.ads28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads
index cf0110c74c2..eea99f1c411 100644
--- a/gcc/ada/a-coorse.ads
+++ b/gcc/ada/a-coorse.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2014, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -278,8 +278,30 @@ package Ada.Containers.Ordered_Sets is
Key : Key_Type) return Reference_Type;
private
- type Reference_Type
- (Element : not null access Element_Type) is null record;
+ type Set_Access is access all Set;
+ for Set_Access'Storage_Size use 0;
+
+ type Key_Access is access all Key_Type;
+
+ type Reference_Control_Type is
+ new Ada.Finalization.Controlled with
+ record
+ Container : Set_Access;
+ Pos : Cursor;
+ Old_Key : Key_Access;
+ end record;
+
+ overriding procedure
+ Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
+ overriding procedure
+ Finalize (Control : in out Reference_Control_Type);
+ pragma Inline (Finalize);
+
+ type Reference_Type (Element : not null access Element_Type) is record
+ Control : Reference_Control_Type;
+ end record;
use Ada.Streams;