summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coinho-shared.adb
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-17 19:31:06 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-17 19:31:06 +0000
commit8e882a1674e70cdea3bf8630a7613fe2bf12e52d (patch)
tree3580b7403687d7d146efbcceecee9d57deff3d8f /gcc/ada/a-coinho-shared.adb
parentfade5ce98b583fa416ba84b4cc3cad12af227f57 (diff)
parent634a5ad7fc8a4498978609c4e523b29658affa22 (diff)
downloadgcc-8e882a1674e70cdea3bf8630a7613fe2bf12e52d.tar.gz
2014-06-17 Tobias Burnus <burnus@net-b.de>
* Merge from the trunk to r211744. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/fortran-dev@211745 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coinho-shared.adb')
-rw-r--r--gcc/ada/a-coinho-shared.adb82
1 files changed, 78 insertions, 4 deletions
diff --git a/gcc/ada/a-coinho-shared.adb b/gcc/ada/a-coinho-shared.adb
index 9300c0b1dc6..222c2f14205 100644
--- a/gcc/ada/a-coinho-shared.adb
+++ b/gcc/ada/a-coinho-shared.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2013, Free Software Foundation, Inc. --
+-- Copyright (C) 2013-2014, 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- --
@@ -62,6 +62,13 @@ package body Ada.Containers.Indefinite_Holders is
Container.Busy := 0;
end Adjust;
+ overriding procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ if Control.Container /= null then
+ Reference (Control.Container);
+ end if;
+ end Adjust;
+
------------
-- Assign --
------------
@@ -99,6 +106,21 @@ package body Ada.Containers.Indefinite_Holders is
Container.Reference := null;
end Clear;
+ ------------------------
+ -- Constant_Reference --
+ ------------------------
+
+ function Constant_Reference
+ (Container : aliased Holder) return Constant_Reference_Type
+ is
+ Ref : constant Constant_Reference_Type :=
+ (Element => Container.Reference.Element,
+ Control => (Controlled with Container.Reference));
+ begin
+ Reference (Ref.Control.Container);
+ return Ref;
+ end Constant_Reference;
+
----------
-- Copy --
----------
@@ -106,11 +128,11 @@ package body Ada.Containers.Indefinite_Holders is
function Copy (Source : Holder) return Holder is
begin
if Source.Reference = null then
- return (AF.Controlled with null, 0);
+ return (Controlled with null, 0);
else
Reference (Source.Reference);
- return (AF.Controlled with Source.Reference, 0);
+ return (Controlled with Source.Reference, 0);
end if;
end Copy;
@@ -143,6 +165,15 @@ package body Ada.Containers.Indefinite_Holders is
end if;
end Finalize;
+ overriding procedure Finalize (Control : in out Reference_Control_Type) is
+ begin
+ if Control.Container /= null then
+ Unreference (Control.Container);
+ end if;
+
+ Control.Container := null;
+ end Finalize;
+
--------------
-- Is_Empty --
--------------
@@ -223,6 +254,22 @@ package body Ada.Containers.Indefinite_Holders is
end if;
end Read;
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Constant_Reference_Type)
+ is
+ begin
+ raise Program_Error with "attempt to stream reference";
+ end Read;
+
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Reference_Type)
+ is
+ begin
+ raise Program_Error with "attempt to stream reference";
+ end Read;
+
---------------
-- Reference --
---------------
@@ -232,6 +279,17 @@ package body Ada.Containers.Indefinite_Holders is
System.Atomic_Counters.Increment (Item.Counter);
end Reference;
+ function Reference
+ (Container : aliased in out Holder) return Reference_Type
+ is
+ Ref : constant Reference_Type :=
+ (Element => Container.Reference.Element,
+ Control => (Controlled with Container.Reference));
+ begin
+ Reference (Ref.Control.Container);
+ return Ref;
+ end Reference;
+
---------------------
-- Replace_Element --
---------------------
@@ -287,7 +345,7 @@ package body Ada.Containers.Indefinite_Holders is
begin
return
- (AF.Controlled with
+ (Controlled with
new Shared_Holder'
(Counter => <>,
Element => new Element_Type'(New_Item)), 0);
@@ -355,4 +413,20 @@ package body Ada.Containers.Indefinite_Holders is
end if;
end Write;
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Reference_Type)
+ is
+ begin
+ raise Program_Error with "attempt to stream reference";
+ end Write;
+
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Constant_Reference_Type)
+ is
+ begin
+ raise Program_Error with "attempt to stream reference";
+ end Write;
+
end Ada.Containers.Indefinite_Holders;