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
|
-- CXH3002.A
--
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- 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 GOVERNMENT 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.
--*
--
-- OBJECTIVE
-- Check that pragma Inspection_Point is allowed whereever a declarative
-- item or statement is allowed. Check that pragma Inspection_Point may
-- have zero or more arguments. Check that the execution of pragma
-- Inspection_Point has no effect.
--
-- TEST DESCRIPTION
-- Check pragma Inspection_Point applied to:
-- A no objects,
-- B one object,
-- C multiple objects.
-- Check pragma Inspection_Point applied to:
-- D Enumeration type objects,
-- E Integer type objects (signed and unsigned),
-- F access type objects,
-- G Floating Point type objects,
-- H Fixed point type objects,
-- I array type objects,
-- J record type objects,
-- K tagged type objects,
-- L protected type objects,
-- M controlled type objects,
-- N task type objects.
-- Check pragma Inspection_Point applied in:
-- O declarations (package, procedure)
-- P statements (incl package elaboration)
-- Q subprogram (procedure, function, finalization)
-- R package
-- S specification
-- T body (PO entry, task body, loop body, accept body, select body)
-- U task
-- V protected object
--
--
-- APPLICABILITY CRITERIA:
-- This test is only applicable for a compiler attempting validation
-- for the Safety and Security Annex.
--
--
-- CHANGE HISTORY:
-- 26 OCT 95 SAIC Initial version
-- 12 NOV 96 SAIC Revised for 2.1
--
--!
----------------------------------------------------------------- CXH3002_0
package CXH3002_0 is
type Enum is (Item,Stuff,Things);
type Int is range 0..256;
type Unt is mod 256;
type Flt is digits 5;
type Fix is delta 0.5 range -1.0..1.0;
type Root(Disc: Enum) is record
I: Int;
U: Unt;
end record;
type List is array(Unt) of Root(Stuff);
type A_List is access all List;
type A_Proc is access procedure(R:Root);
procedure Proc(R:Root);
function Func return A_Proc;
protected type PT is
entry Prot_Entry(Switch: Boolean);
private
Toggle : Boolean := False;
end PT;
task type TT is
entry Task_Entry(Items: in A_List);
end TT;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- AORS
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
end CXH3002_0;
----------------------------------------------------------------- CXH3002_1
with Ada.Finalization;
package CXH3002_0.CXH3002_1 is
type Final is new Ada.Finalization.Controlled with
record
Value : Natural;
end record;
procedure Initialize( F: in out Final );
procedure Adjust( F: in out Final );
procedure Finalize( F: in out Final );
end CXH3002_0.CXH3002_1;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- CXH3002_0
package body CXH3002_0 is
Global_Variable : Character := 'A';
procedure Proc(R:Root) is
begin
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
pragma Inspection_Point( Global_Variable ); -- BDPQT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
case R.Disc is
when Item => Global_Variable := 'I';
when Stuff => Global_Variable := 'S';
when Things => Global_Variable := 'T';
end case;
end Proc;
function Func return A_Proc is
begin
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- APQT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
return Proc'Access;
end Func;
protected body PT is
entry Prot_Entry(Switch: Boolean) when True is
begin
Toggle := Switch;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- APVT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
end Prot_Entry;
end PT;
task body TT is
List_Copy : A_List;
begin
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- APUT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
loop
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- APUT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
select
accept Task_Entry(Items: in A_List) do
List_Copy := Items;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
pragma Inspection_Point( List_Copy ); -- BFPUT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
end Task_Entry;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- APUT
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
or terminate;
end select;
end loop;
end TT;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
pragma Inspection_Point; -- ARTO
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
end CXH3002_0;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- CXH3002_1
with Report;
package body CXH3002_0.CXH3002_1 is
Embedded_Final_Object : Final
:= (Ada.Finalization.Controlled with Value => 1);
-- attempt to call Initialize here would P_E!
procedure Initialize( F: in out Final ) is
begin
F.Value := 1;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
pragma Inspection_Point( Embedded_Final_Object ); -- BKQP
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
end Initialize;
procedure Adjust( F: in out Final ) is
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
pragma Inspection_Point; -- AQO
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
begin
F.Value := 2;
end Adjust;
procedure Finalize( F: in out Final ) is
begin
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- AQP
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
if F.Value not in 1..10 then
Report.Failed("Bad value in controlled object at finalization");
end if;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
pragma Inspection_Point; -- AQP
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---====
end Finalize;
begin
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---======
pragma Inspection_Point( Embedded_Final_Object ); -- BKRTP
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---======
null;
end CXH3002_0.CXH3002_1;
------------------------------------------------------------------- CXH3002
with Report;
with CXH3002_0.CXH3002_1;
procedure CXH3002 is
use type CXH3002_0.Enum, CXH3002_0.Int, CXH3002_0.Unt, CXH3002_0.Flt,
CXH3002_0.Fix, CXH3002_0.Root;
Main_Enum : CXH3002_0.Enum := CXH3002_0.Item;
Main_Int : CXH3002_0.Int;
Main_Unt : CXH3002_0.Unt;
Main_Flt : CXH3002_0.Flt;
Main_Fix : CXH3002_0.Fix;
Main_Rec : CXH3002_0.Root(CXH3002_0.Stuff)
:= (CXH3002_0.Stuff, I => 1, U => 2);
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
pragma Inspection_Point( Main_Rec ); -- BJQO
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---=====
Main_List : CXH3002_0.List := ( others => Main_Rec );
Main_A_List : CXH3002_0.A_List := new CXH3002_0.List'( others => Main_Rec );
Main_A_Proc : CXH3002_0.A_Proc := CXH3002_0.Func;
-- CXH3002_0.Proc'Access
Main_PT : CXH3002_0.PT;
Main_TT : CXH3002_0.TT;
type Test_Range is (First, Second);
procedure Assert( Truth : Boolean; Message : String ) is
begin
if not Truth then
Report.Failed( "Unexpected value found in " & Message );
end if;
end Assert;
begin -- Main test procedure.
Report.Test ("CXH3002", "Check pragma Inspection_Point" );
Enclosure:declare
Main_Final : CXH3002_0.CXH3002_1.Final;
Xtra_Final : CXH3002_0.CXH3002_1.Final;
begin
for Test_Case in Test_Range loop
case Test_Case is
when First =>
Main_Final.Value := 5;
Xtra_Final := Main_Final; -- call Adjust
Main_Enum := CXH3002_0.Things;
Main_Int := CXH3002_0.Int'First;
Main_Unt := CXH3002_0.Unt'Last;
Main_Flt := 3.14;
Main_Fix := 0.5;
Main_Rec := (CXH3002_0.Stuff, I => 3, U => 4);
Main_List(Main_Unt) := Main_Rec;
Main_A_List(CXH3002_0.Unt'First) := (CXH3002_0.Stuff, I => 5, U => 6);
Main_A_Proc( Main_A_List(2) );
Main_PT.Prot_Entry(True);
Main_TT.Task_Entry( null );
when Second =>
Assert( Main_Final.Value = 5, "Main_Final" );
Assert( Xtra_Final.Value = 2, "Xtra_Final" );
Assert( Main_Enum = CXH3002_0.Things, "Main_Enum" );
Assert( Main_Int = CXH3002_0.Int'First, "Main_Int" );
Assert( Main_Unt = CXH3002_0.Unt'Last, "Main_Unt" );
Assert( Main_Flt in 3.0..3.5, "Main_Flt" );
Assert( Main_Fix = 0.5, "Main_Fix" );
Assert( Main_Rec = (CXH3002_0.Stuff, I => 3, U => 4), "Main_Rec" );
Assert( Main_List(Main_Unt) = Main_Rec, "Main_List" );
Assert( Main_A_List(CXH3002_0.Unt'First)
= (CXH3002_0.Stuff, I => 5, U => 6), "Main_A_List" );
end case;
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---==
pragma Inspection_Point( -- CQP
Main_Final, -- M
Main_Enum, -- D
Main_Int, -- E
Main_Unt, -- E
Main_Flt, -- G
Main_Fix, -- H
Main_Rec, -- J
Main_List, -- I
Main_A_List, -- F
Main_A_Proc, -- F
Main_PT, -- L
Main_TT ); -- N
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ---==
end loop;
end Enclosure;
Report.Result;
end CXH3002;
|