1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
-- F760A00.A
--
-- Grant of Unlimited Rights
--
-- The Ada Conformity Assessment Authority (ACAA) holds unlimited
-- rights in the software and documentation contained herein. Unlimited
-- rights are the same as those granted by the U.S. Government for older
-- parts of the Ada Conformity Assessment Test Suite, and are defined
-- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
-- intends to confer upon all recipients unlimited rights equal to those
-- held by the ACAA. These rights include rights to use, duplicate,
-- release or disclose the released technical data and computer software
-- in whole or in part, in any manner and for any purpose whatsoever, and
-- to have or permit others to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE ACAA MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--
-- Notice
--
-- The ACAA has created and maintains the Ada Conformity Assessment Test
-- Suite for the purpose of conformity assessments conducted in accordance
-- with the International Standard ISO/IEC 18009 - Ada: Conformity
-- assessment of a language processor. This test suite should not be used
-- to make claims of conformance unless used in accordance with
-- ISO/IEC 18009 and any applicable ACAA procedures.
--*
--
-- FOUNDATION DESCRIPTION:
-- This foundation declares a controlled type and limited types for use
-- in tests verifying that limited aggregates and function calls are
-- built-in-place.
--
-- CHANGE HISTORY:
-- 30 Apr 07 RLB Created.
-- 17 Aug 07 RLB Added Use_Cnst to fix test error.
-- 28 Feb 14 RLB Renamed test as rules have moved.
--
--!
with TCTouch, Report;
with Ada.Finalization;
package F760A00 is
type TC_Copy_Check is new Ada.Finalization.Controlled with private;
procedure Initialize (Object : in out TC_Copy_Check);
procedure Adjust (Object : in out TC_Copy_Check);
procedure Finalize (Object : in out TC_Copy_Check);
procedure Check_TC_Copy_Check;
-- Verify that TC_Copy_Check works properly.
procedure Use_It (Object : in out TC_Copy_Check);
procedure Use_Cnst (Object : in TC_Copy_Check);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
type Lim_Rec is limited record
A : Integer;
B : Boolean;
TC : TC_Copy_Check; -- Always default initialize.
end record;
procedure Check_Init (Object : in Lim_Rec; Message : in String);
procedure Check_Fin_Lim_Rec (Message : in String);
procedure Use_It (Object : in out Lim_Rec);
procedure Use_Cnst (Object : in Lim_Rec);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
type Lim_Array is array (Positive range <>) of Lim_Rec;
procedure Check_Init (Object : in Lim_Array; Message : in String);
procedure Check_Fin_Lim_Array (Length : in Natural; Message : in String);
procedure Use_It (Object : in out Lim_Array);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
type Lim_Tagged is tagged limited record
R : Lim_Rec;
TC : TC_Copy_Check; -- Always default initialize.
end record;
procedure Check_Init (Object : in Lim_Tagged'Class; Message : in String);
procedure Check_Fin_Lim_Tagged (Message : in String);
procedure Use_It (Object : in out Lim_Tagged'Class);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
protected type Prot is
function Get return Natural;
procedure Set (Val : in Natural);
procedure Use_It;
private
Value : Natural := 0;
TC : TC_Copy_Check;
end Prot;
procedure Check_Init (Object : in Prot; Message : in String);
procedure Check_Fin_Prot (Message : in String);
procedure Use_It (Object : in out Prot);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
type Lim_Comp is record
P : Prot;
N : Natural;
TC : TC_Copy_Check; -- Always default initialize.
end record;
procedure Check_Init (Object : in Lim_Comp; Message : in String);
procedure Check_Fin_Lim_Comp (Message : in String);
procedure Use_It (Object : in out Lim_Comp);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
private
type TC_Copy_Check is new Ada.Finalization.Controlled with record
Val : Natural := 10;
end record;
end F760A00;
with TCTouch, Report;
package F760A00.Child is
type Lim_Ext is new Lim_Tagged with record
G : Natural;
TC2 : TC_Copy_Check; -- Always default initialize.
end record;
procedure Check_Init (Object : in Lim_Ext; Message : in String);
procedure Check_Fin_Lim_Ext (Message : in String);
procedure Use_It (Object : in out Lim_Ext'Class);
-- Ensure that Object is not removed by optimization
-- as a dead variable.
end F760A00.Child;
package body F760A00 is
procedure Initialize (Object : in out TC_Copy_Check) is
begin
TCTouch.Touch( 'I' ); ----------------------------------------- I
end Initialize;
procedure Adjust (Object : in out TC_Copy_Check) is
begin
TCTouch.Touch( 'A' ); ----------------------------------------- A
end Adjust;
procedure Finalize (Object : in out TC_Copy_Check) is
begin
TCTouch.Touch( 'F' ); ----------------------------------------- F
end Finalize;
procedure Use_It (Object : in out TC_Copy_Check) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
if Report.Ident_Int (10) /= Object.Val then
Report.Failed ("Unusual value in TC_Copy_Check");
-- This should not be possible; we never change the component
-- from its default value of 10.
end if;
end Use_It;
procedure Use_Cnst (Object : in TC_Copy_Check) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
if Report.Ident_Int (10) /= Object.Val then
Report.Failed ("Unusual value in TC_Copy_Check");
-- This should not be possible; we never change the component
-- from its default value of 10.
end if;
end Use_Cnst;
procedure Check_TC_Copy_Check is
-- Verify the operation of TC_Copy_Check.
-- This checks that Adjust can be called.
begin
declare
Obj : TC_Copy_Check; -- I
Cnst : TC_Copy_Check; -- I
begin
Use_It (Obj);
Use_It (Cnst);
Obj := Cnst; -- FA
Use_It (Obj);
end; -- FF
TCTouch.Validate ("IIFAFF", "Check_TC_Copy_Check");
end Check_TC_Copy_Check;
procedure Check_Init (Object : in Lim_Rec; Message : in String) is
begin
TCTouch.Validate ("I", Message);
end Check_Init;
procedure Check_Fin_Lim_Rec (Message : in String) is
begin
TCTouch.Validate ("F", Message);
end Check_Fin_Lim_Rec;
procedure Use_It (Object : in out Lim_Rec) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
Use_It (Object.TC);
end Use_It;
procedure Use_Cnst (Object : in Lim_Rec) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
Use_Cnst (Object.TC);
end Use_Cnst;
procedure Check_Init (Object : in Lim_Array; Message : in String) is
begin
TCTouch.Validate ((1 .. Object'Length => 'I'), Message);
end Check_Init;
procedure Check_Fin_Lim_Array (Length : in Natural; Message : in String) is
begin
TCTouch.Validate ((1 .. Length => 'F'), Message);
end Check_Fin_Lim_Array;
procedure Use_It (Object : in out Lim_Array) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
for I in Object'range loop
Use_It (Object(I).TC);
end loop;
end Use_It;
procedure Check_Init (Object : in Lim_Tagged'Class; Message : in String) is
begin
TCTouch.Validate ("II", Message);
end Check_Init;
procedure Check_Fin_Lim_Tagged (Message : in String) is
begin
TCTouch.Validate ("FF", Message);
end Check_Fin_Lim_Tagged;
procedure Use_It (Object : in out Lim_Tagged'Class) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
Use_It (Object.TC);
Use_It (Object.R);
end Use_It;
procedure Check_Init (Object : in Prot; Message : in String) is
begin
TCTouch.Validate ("I", Message);
end Check_Init;
procedure Check_Fin_Prot (Message : in String) is
begin
TCTouch.Validate ("F", Message);
end Check_Fin_Prot;
procedure Use_It (Object : in out Prot) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
Object.Use_It;
end Use_It;
protected body Prot is
function Get return Natural is
begin
return Value;
end Get;
procedure Set (Val : in Natural) is
begin
Value := Val;
end Set;
procedure Use_It is
begin
Use_It (TC);
end Use_It;
end Prot;
procedure Check_Init (Object : in Lim_Comp; Message : in String) is
begin
TCTouch.Validate ("II", Message);
end Check_Init;
procedure Check_Fin_Lim_Comp (Message : in String) is
begin
TCTouch.Validate ("FF", Message);
end Check_Fin_Lim_Comp;
procedure Use_It (Object : in out Lim_Comp) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
Use_It (Object.TC);
Object.P.Use_It;
end Use_It;
end F760A00;
package body F760A00.Child is
procedure Check_Init (Object : in Lim_Ext; Message : in String) is
begin
TCTouch.Validate ("III", Message);
end Check_Init;
procedure Check_Fin_Lim_Ext (Message : in String) is
begin
TCTouch.Validate ("FFF", Message);
end Check_Fin_Lim_Ext;
procedure Use_It (Object : in out Lim_Ext'Class) is
-- Ensure that Object is not removed by optimization
-- as a dead variable.
begin
Use_It (Lim_Tagged (Object));
Use_It (Object.TC2);
end Use_It;
end F760A00.Child;
|