PR testsuite/79036 - gcc.dg/tree-ssa/builtin-sprintf.c fails starting with r244037
[official-gcc.git] / gcc / ada / a-coinho.ads
blob7cfd193ca3c60e51527f7529922fa0eca12b1814
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- A D A . C O N T A I N E R S . I N D E F I N I T E _ H O L D E R S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2011-2015, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
21 -- --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
25 -- --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
30 ------------------------------------------------------------------------------
32 private with Ada.Finalization;
33 private with Ada.Streams;
35 generic
36 type Element_Type (<>) is private;
37 with function "=" (Left, Right : Element_Type) return Boolean is <>;
39 package Ada.Containers.Indefinite_Holders is
40 pragma Annotate (CodePeer, Skip_Analysis);
41 pragma Preelaborate (Indefinite_Holders);
42 pragma Remote_Types (Indefinite_Holders);
44 type Holder is tagged private;
45 pragma Preelaborable_Initialization (Holder);
47 Empty_Holder : constant Holder;
49 function "=" (Left, Right : Holder) return Boolean;
51 function To_Holder (New_Item : Element_Type) return Holder;
53 function Is_Empty (Container : Holder) return Boolean;
55 procedure Clear (Container : in out Holder);
57 function Element (Container : Holder) return Element_Type;
59 procedure Replace_Element
60 (Container : in out Holder;
61 New_Item : Element_Type);
63 procedure Query_Element
64 (Container : Holder;
65 Process : not null access procedure (Element : Element_Type));
67 procedure Update_Element
68 (Container : in out Holder;
69 Process : not null access procedure (Element : in out Element_Type));
71 type Constant_Reference_Type
72 (Element : not null access constant Element_Type) is private
73 with
74 Implicit_Dereference => Element;
76 type Reference_Type
77 (Element : not null access Element_Type) is private
78 with
79 Implicit_Dereference => Element;
81 function Constant_Reference
82 (Container : aliased Holder) return Constant_Reference_Type;
83 pragma Inline (Constant_Reference);
85 function Reference
86 (Container : aliased in out Holder) return Reference_Type;
87 pragma Inline (Reference);
89 procedure Assign (Target : in out Holder; Source : Holder);
91 function Copy (Source : Holder) return Holder;
93 procedure Move (Target : in out Holder; Source : in out Holder);
95 private
97 use Ada.Finalization;
98 use Ada.Streams;
100 type Element_Access is access all Element_Type;
102 type Holder_Access is access all Holder;
103 for Holder_Access'Storage_Size use 0;
105 procedure Read
106 (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
107 Container : out Holder);
109 procedure Write
110 (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
111 Container : Holder);
113 type Holder is new Ada.Finalization.Controlled with record
114 Element : Element_Access;
115 Busy : Natural := 0;
116 end record;
117 for Holder'Read use Read;
118 for Holder'Write use Write;
120 overriding procedure Adjust (Container : in out Holder);
121 overriding procedure Finalize (Container : in out Holder);
123 type Reference_Control_Type is new Controlled with
124 record
125 Container : Holder_Access;
126 end record;
128 overriding procedure Adjust (Control : in out Reference_Control_Type);
129 pragma Inline (Adjust);
131 overriding procedure Finalize (Control : in out Reference_Control_Type);
132 pragma Inline (Finalize);
134 type Constant_Reference_Type
135 (Element : not null access constant Element_Type) is
136 record
137 Control : Reference_Control_Type :=
138 raise Program_Error with "uninitialized reference";
139 -- The RM says, "The default initialization of an object of
140 -- type Constant_Reference_Type or Reference_Type propagates
141 -- Program_Error."
142 end record;
144 procedure Write
145 (Stream : not null access Root_Stream_Type'Class;
146 Item : Constant_Reference_Type);
148 for Constant_Reference_Type'Write use Write;
150 procedure Read
151 (Stream : not null access Root_Stream_Type'Class;
152 Item : out Constant_Reference_Type);
154 for Constant_Reference_Type'Read use Read;
156 type Reference_Type (Element : not null access Element_Type) is record
157 Control : Reference_Control_Type :=
158 raise Program_Error with "uninitialized reference";
159 -- The RM says, "The default initialization of an object of
160 -- type Constant_Reference_Type or Reference_Type propagates
161 -- Program_Error."
162 end record;
164 procedure Write
165 (Stream : not null access Root_Stream_Type'Class;
166 Item : Reference_Type);
168 for Reference_Type'Write use Write;
170 procedure Read
171 (Stream : not null access Root_Stream_Type'Class;
172 Item : out Reference_Type);
174 for Reference_Type'Read use Read;
176 Empty_Holder : constant Holder := (Controlled with null, 0);
178 end Ada.Containers.Indefinite_Holders;