annotate gcc/testsuite/ada/acats/tests/cxh/cxh3001.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- CXH3001.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE
kono
parents:
diff changeset
27 -- Check pragma Reviewable.
kono
parents:
diff changeset
28 -- Check that pragma Reviewable is accepted as a configuration pragma.
kono
parents:
diff changeset
29 --
kono
parents:
diff changeset
30 -- TEST DESCRIPTION
kono
parents:
diff changeset
31 -- The test requires that the configuration pragma Reviewable
kono
parents:
diff changeset
32 -- be processed. The following package contains a simple "one of each
kono
parents:
diff changeset
33 -- construct in the language" to check that the configuration pragma has
kono
parents:
diff changeset
34 -- not disallowed some feature of the language. This test should generate
kono
parents:
diff changeset
35 -- no errors.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- APPLICABILITY CRITERIA:
kono
parents:
diff changeset
38 -- This test is only applicable for a compiler attempting validation
kono
parents:
diff changeset
39 -- for the Safety and Security Annex.
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 -- PASS/FAIL CRITERIA:
kono
parents:
diff changeset
42 -- This test passes if it correctly compiles, executes, and reports PASS.
kono
parents:
diff changeset
43 -- It fails if the pragma is rejected. The effect of the pragma should
kono
parents:
diff changeset
44 -- be to produce a listing with information, including warnings, as
kono
parents:
diff changeset
45 -- required in H.3.1. Specific form and contents of this listing are not
kono
parents:
diff changeset
46 -- required by this test and are not part of the PASS/FAIL criteria.
kono
parents:
diff changeset
47 --
kono
parents:
diff changeset
48 -- SPECIAL REQUIREMENTS
kono
parents:
diff changeset
49 -- The implementation must process a configuration pragma which is not
kono
parents:
diff changeset
50 -- part of any Compilation Unit; the method employed is implementation
kono
parents:
diff changeset
51 -- defined.
kono
parents:
diff changeset
52 --
kono
parents:
diff changeset
53 -- Pragma Reviewable requires that the implementation provide the
kono
parents:
diff changeset
54 -- following information for the compilation units in this test:
kono
parents:
diff changeset
55 --
kono
parents:
diff changeset
56 -- o Where compiler-generated run-time checks remain (6)
kono
parents:
diff changeset
57 --
kono
parents:
diff changeset
58 -- o Identification of any construct with a language-defined check
kono
parents:
diff changeset
59 -- that is recognized prior to runtime as certain to fail if
kono
parents:
diff changeset
60 -- executed (7)
kono
parents:
diff changeset
61 --
kono
parents:
diff changeset
62 -- o For each reference to a scalar object, an identification of
kono
parents:
diff changeset
63 -- the reference as either "known to be initialized,"
kono
parents:
diff changeset
64 -- or "possibly uninitialized" (8)
kono
parents:
diff changeset
65 --
kono
parents:
diff changeset
66 -- o Where run-time support routines are implicitly invoked (9)
kono
parents:
diff changeset
67 --
kono
parents:
diff changeset
68 -- o An object code listing including: (10)
kono
parents:
diff changeset
69 --
kono
parents:
diff changeset
70 -- o Machine instructions with relative offsets (11)
kono
parents:
diff changeset
71 --
kono
parents:
diff changeset
72 -- o Where each data object is stored during its lifetime (12)
kono
parents:
diff changeset
73 --
kono
parents:
diff changeset
74 -- o Correspondence with the source program (13)
kono
parents:
diff changeset
75 --
kono
parents:
diff changeset
76 -- o Identification of each construct for which the implementation
kono
parents:
diff changeset
77 -- detects the possibility of erroneous execution (14)
kono
parents:
diff changeset
78 --
kono
parents:
diff changeset
79 -- o For each subprogram, block, task or other construct implemented by
kono
parents:
diff changeset
80 -- reserving and subsequently freezing an area of the run-time stack,
kono
parents:
diff changeset
81 -- an identification of the length of the fixed-size portion of
kono
parents:
diff changeset
82 -- the area and an indication of whether the non-fixed size portion
kono
parents:
diff changeset
83 -- is reserved on the stack or in a dynamically managed storage
kono
parents:
diff changeset
84 -- region (15)
kono
parents:
diff changeset
85 --
kono
parents:
diff changeset
86 --
kono
parents:
diff changeset
87 -- CHANGE HISTORY:
kono
parents:
diff changeset
88 -- 26 OCT 95 SAIC Initial version
kono
parents:
diff changeset
89 -- 12 NOV 96 SAIC Revised for 2.1
kono
parents:
diff changeset
90 -- 27 AUG 99 RLB Removed result dependence on uninitialized object.
kono
parents:
diff changeset
91 -- 30 AUG 99 RLB Repaired the above.
kono
parents:
diff changeset
92 --
kono
parents:
diff changeset
93 --!
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 ---------------------------- CONFIGURATION PRAGMAS -----------------------
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 pragma Reviewable; -- OK
kono
parents:
diff changeset
98 -- configuration pragma
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 ------------------------ END OF CONFIGURATION PRAGMAS --------------------
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 ----------------------------------------------------------------- CXH3001_0
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 package CXH3001_0 is
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 type Enum is (Item,Stuff,Things);
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 type Int is range 0..256;
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 type Unt is mod 256;
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 type Flt is digits 5;
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 type Fix is delta 0.5 range -1.0..1.0;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 type Root(Disc: Enum) is tagged record
kono
parents:
diff changeset
118 I: Int; U:Unt;
kono
parents:
diff changeset
119 end record;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 type List is array(Unt) of Root(Stuff);
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 type A_List is access List;
kono
parents:
diff changeset
124 type A_Proc is access procedure(R:Root);
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 procedure P(R:Root);
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 function F return A_Proc;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 protected PT is
kono
parents:
diff changeset
131 entry Set(Switch: Boolean);
kono
parents:
diff changeset
132 function Enquire return Boolean;
kono
parents:
diff changeset
133 private
kono
parents:
diff changeset
134 Toggle : Boolean;
kono
parents:
diff changeset
135 end PT;
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 task TT is
kono
parents:
diff changeset
138 entry Release;
kono
parents:
diff changeset
139 end TT;
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 Global_Variable : Boolean := False;
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 end CXH3001_0;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 with Report;
kono
parents:
diff changeset
148 package body CXH3001_0 is
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 procedure P(R:Root) is
kono
parents:
diff changeset
151 Warnable : Positive := 0; -- (7) -- OPTIONAL WARNING
kono
parents:
diff changeset
152 -- this would raise Constraint_Error if P were ever called, however
kono
parents:
diff changeset
153 -- this test never calls P.
kono
parents:
diff changeset
154 begin
kono
parents:
diff changeset
155 case R.Disc is
kono
parents:
diff changeset
156 when Item => Report.Comment("Got Item");
kono
parents:
diff changeset
157 when Stuff => Report.Comment("Got Stuff");
kono
parents:
diff changeset
158 when Things => Report.Comment("Got Things");
kono
parents:
diff changeset
159 end case;
kono
parents:
diff changeset
160 if Report.Ident_Int( Warnable ) = 0 then
kono
parents:
diff changeset
161 Global_Variable := not Global_Variable; -- (8) known to be initialized
kono
parents:
diff changeset
162 end if;
kono
parents:
diff changeset
163 end P;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 function F return A_Proc is
kono
parents:
diff changeset
166 begin
kono
parents:
diff changeset
167 return P'Access;
kono
parents:
diff changeset
168 end F;
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 protected body PT is
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 entry Set(Switch: Boolean) when True is
kono
parents:
diff changeset
173 begin
kono
parents:
diff changeset
174 Toggle := Switch;
kono
parents:
diff changeset
175 end Set;
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 function Enquire return Boolean is
kono
parents:
diff changeset
178 begin
kono
parents:
diff changeset
179 return Toggle;
kono
parents:
diff changeset
180 end Enquire;
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 end PT;
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 task body TT is
kono
parents:
diff changeset
185 begin
kono
parents:
diff changeset
186 loop
kono
parents:
diff changeset
187 accept Release;
kono
parents:
diff changeset
188 exit when Global_Variable;
kono
parents:
diff changeset
189 end loop;
kono
parents:
diff changeset
190 end TT;
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 -- (9) TT activation
kono
parents:
diff changeset
193 end CXH3001_0;
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 ------------------------------------------------------------------- CXH3001
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 with Report;
kono
parents:
diff changeset
198 with CXH3001_0;
kono
parents:
diff changeset
199 procedure CXH3001 is
kono
parents:
diff changeset
200 begin
kono
parents:
diff changeset
201 Report.Test("CXH3001", "Check pragma Reviewable as a configuration pragma");
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 Block: declare
kono
parents:
diff changeset
204 A_Truth : Boolean;
kono
parents:
diff changeset
205 Message : String := Report.Ident_Str( "Bad value encountered" );
kono
parents:
diff changeset
206 begin
kono
parents:
diff changeset
207 begin
kono
parents:
diff changeset
208 A_Truth := Report.Ident_Bool( True ) or A_Truth; -- (8) not initialized
kono
parents:
diff changeset
209 if not A_Truth then
kono
parents:
diff changeset
210 Report.Comment ("True or Uninit = False");
kono
parents:
diff changeset
211 A_Truth := Report.Ident_Bool (True);
kono
parents:
diff changeset
212 else
kono
parents:
diff changeset
213 A_Truth := Report.Ident_Bool (True);
kono
parents:
diff changeset
214 -- We do this separately on each branch in order to insure that a
kono
parents:
diff changeset
215 -- clever optimizer can find out little about this value. Ident_Bool
kono
parents:
diff changeset
216 -- is supposed to be opaque to any optimizer.
kono
parents:
diff changeset
217 end if;
kono
parents:
diff changeset
218 exception
kono
parents:
diff changeset
219 when Constraint_Error | Program_Error =>
kono
parents:
diff changeset
220 -- Possible results of accessing an uninitialized object.
kono
parents:
diff changeset
221 A_Truth := Report.Ident_Bool (True);
kono
parents:
diff changeset
222 end;
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 CXH3001_0.PT.Set( A_Truth );
kono
parents:
diff changeset
225
kono
parents:
diff changeset
226 CXH3001_0.Global_Variable := A_Truth;
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 CXH3001_0.TT.Release; -- (9) rendezvous with TT
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 while CXH3001_0.TT'Callable loop
kono
parents:
diff changeset
231 delay 1.0; -- wait for TT to become non-callable
kono
parents:
diff changeset
232 end loop;
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 if not CXH3001_0.PT.Enquire
kono
parents:
diff changeset
235 or not CXH3001_0.Global_Variable
kono
parents:
diff changeset
236 or CXH3001_0.TT'Callable then
kono
parents:
diff changeset
237 Report.Failed(Message);
kono
parents:
diff changeset
238 end if;
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 end Block;
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 Report.Result;
kono
parents:
diff changeset
243 end CXH3001;