annotate gcc/testsuite/ada/acats/tests/cd/cd10001.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 -- CD10001.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 that representation items may contain nonstatic expressions
kono
parents:
diff changeset
28 -- in the case that each expression in the representation item is a
kono
parents:
diff changeset
29 -- name that statically denotes a constant declared before the entity.
kono
parents:
diff changeset
30 --
kono
parents:
diff changeset
31 --
kono
parents:
diff changeset
32 -- TEST DESCRIPTION:
kono
parents:
diff changeset
33 -- For each of the specific items in the objective, this test checks
kono
parents:
diff changeset
34 -- an example of each of the categories of representation specification
kono
parents:
diff changeset
35 -- that are applicable to that objective, to wit:
kono
parents:
diff changeset
36 -- address clause ....................... Expressions need not be static
kono
parents:
diff changeset
37 -- alignment clause ..................... Expressions must be static
kono
parents:
diff changeset
38 -- bit order clause ..................... Not tested
kono
parents:
diff changeset
39 -- component size clause ................ Expressions must be static
kono
parents:
diff changeset
40 -- enumeration representation clause .... Expressions must be static
kono
parents:
diff changeset
41 -- external tag clause .................. Expressions must be static
kono
parents:
diff changeset
42 -- Import, Export and Convention pragmas Not tested
kono
parents:
diff changeset
43 -- input clause ......................... Not tested
kono
parents:
diff changeset
44 -- output clause ........................ Not tested
kono
parents:
diff changeset
45 -- Pack pragma .......................... Not tested
kono
parents:
diff changeset
46 -- read clause .......................... Not tested
kono
parents:
diff changeset
47 -- record representation clause ......... Expressions must be static
kono
parents:
diff changeset
48 -- size clause .......................... Expressions must be static
kono
parents:
diff changeset
49 -- small clause ......................... Expressions must be static
kono
parents:
diff changeset
50 -- storage pool clause .................. Not tested
kono
parents:
diff changeset
51 -- storage size clause .................. Expressions must be static
kono
parents:
diff changeset
52 -- write clause ......................... Not tested
kono
parents:
diff changeset
53 --
kono
parents:
diff changeset
54 -- APPLICABILITY CRITERIA:
kono
parents:
diff changeset
55 -- All implementations must attempt to compile this test.
kono
parents:
diff changeset
56 --
kono
parents:
diff changeset
57 -- For implementations validating against Systems Programming Annex (C):
kono
parents:
diff changeset
58 -- this test must execute.
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 -- For implementations not validating against Annex C:
kono
parents:
diff changeset
61 -- if this test compiles without error messages at compilation,
kono
parents:
diff changeset
62 -- it must bind and execute.
kono
parents:
diff changeset
63 --
kono
parents:
diff changeset
64 -- PASS/FAIL CRITERIA:
kono
parents:
diff changeset
65 -- For implementations validating against Systems Programming Annex (C):
kono
parents:
diff changeset
66 -- this test must execute, report PASSED, and complete normally,
kono
parents:
diff changeset
67 -- otherwise the test FAILS
kono
parents:
diff changeset
68 --
kono
parents:
diff changeset
69 -- For implementations not validating against Annex C:
kono
parents:
diff changeset
70 -- PASSING behavior is:
kono
parents:
diff changeset
71 -- this test executes, reports PASSED, and completes normally
kono
parents:
diff changeset
72 -- or
kono
parents:
diff changeset
73 -- this test executes and reports NOT_APPLICABLE
kono
parents:
diff changeset
74 -- or
kono
parents:
diff changeset
75 -- this test produces at least one error message at compilation, and
kono
parents:
diff changeset
76 -- the error message is associated with one of the items marked:
kono
parents:
diff changeset
77 -- -- N/A => ERROR.
kono
parents:
diff changeset
78 --
kono
parents:
diff changeset
79 -- All other behaviors are FAILING.
kono
parents:
diff changeset
80 --
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 -- CHANGE HISTORY:
kono
parents:
diff changeset
83 -- 11 JUL 95 SAIC Initial version
kono
parents:
diff changeset
84 -- 10 MAR 97 PWB.CTA Made Nonstatic_Entity nonstatic; changed
kono
parents:
diff changeset
85 -- Tenths'Small from 1.0/32.0 to 1.0/10.0,
kono
parents:
diff changeset
86 -- as expected by the later check; improved
kono
parents:
diff changeset
87 -- internal documentation.
kono
parents:
diff changeset
88 -- 16 FEB 98 EDS Modified test documentation.
kono
parents:
diff changeset
89 -- 24 NOV 98 RLB Changed Tenths'Small to 1.0/32.0, as this is
kono
parents:
diff changeset
90 -- necessary so that all implementations can
kono
parents:
diff changeset
91 -- process this test. (3.5.9(21) means non-binary
kono
parents:
diff changeset
92 -- smalls are optional.)
kono
parents:
diff changeset
93 -- 11 MAR 99 RLB Merged versions. Most EDS changes removed (as
kono
parents:
diff changeset
94 -- they made the test less applicable than the ACAA
kono
parents:
diff changeset
95 -- version).
kono
parents:
diff changeset
96 --!
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 ----------------------------------------------------------------- CD10001_0
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 with System;
kono
parents:
diff changeset
101 with System.Storage_Elements;
kono
parents:
diff changeset
102 with Impdef;
kono
parents:
diff changeset
103 with SPPRT13;
kono
parents:
diff changeset
104 package CD10001_0 is
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 -- a few types and objects to work with.
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 type Int is range -2048 .. 2047;
kono
parents:
diff changeset
109 My_Int : Int := 1024;
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 type Enumeration is (First, Second, Third, Fourth, Fifth);
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 -- a few names that statically denote constants:
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 Nonstatic_Entity : constant System.Address := -- Non-static
kono
parents:
diff changeset
116 System.Storage_Elements."+"
kono
parents:
diff changeset
117 ( SPPRT13.Variable_Address,
kono
parents:
diff changeset
118 System.Storage_Elements.Storage_Offset'(0) );
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 Tag_String : constant String := Impdef.External_Tag_Value; -- Static
kono
parents:
diff changeset
121 -- Check to ensure that Tag_String is static
kono
parents:
diff changeset
122 Tag_String_Length : constant := Tag_String'Length;
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 A_Reasonable_Size_Value : constant := System.Storage_Unit; -- Static
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 Zero : constant := 0; -- Static
kono
parents:
diff changeset
127 One : constant := 1; -- Static
kono
parents:
diff changeset
128 Two : constant := 2; -- Static
kono
parents:
diff changeset
129 Three : constant := 3; -- Static
kono
parents:
diff changeset
130 Four : constant := 4; -- Static
kono
parents:
diff changeset
131 Five : constant := 5; -- Static
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 K : constant Int := My_Int; -- Non-Static
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -- Check that representation items containing nonstatic expressions are
kono
parents:
diff changeset
136 -- supported in the case that the representation item is a name that
kono
parents:
diff changeset
137 -- statically denotes a constant declared before the entity.
kono
parents:
diff changeset
138 --
kono
parents:
diff changeset
139 -- address clause
kono
parents:
diff changeset
140 -- Expression must be static - RM 13.3(12)
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 Object_Address : Enumeration;
kono
parents:
diff changeset
143 for Object_Address'Address use Nonstatic_Entity; -- N/A => ERROR.
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 -- alignment clause
kono
parents:
diff changeset
146 -- Expression must be static - RM 13.3(25)
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 Object_Alignment : Enumeration;
kono
parents:
diff changeset
149 for Object_Alignment'Alignment use One; -- N/A => ERROR.
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 -- bit order clause
kono
parents:
diff changeset
152 -- no interesting test can be specified
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 -- component size clause
kono
parents:
diff changeset
155 -- Expression must be static - RM 13.3(69)
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 type Array_With_Components is array(1..10) of Enumeration;
kono
parents:
diff changeset
158 for Array_With_Components'Component_Size
kono
parents:
diff changeset
159 use A_Reasonable_Size_Value; -- N/A => ERROR.
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 -- enumeration representation clause
kono
parents:
diff changeset
162 -- Expressions must be static - RM 13.4(6)
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 type Enumeration_1 is (First, Second, Third);
kono
parents:
diff changeset
165 for Enumeration_1 use (First => One, Second => Two, Third => Three);
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 -- external tag clause
kono
parents:
diff changeset
168 -- Expression must be static - RM 13.3(75)
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 type Some_Tagged_Type is tagged null record;
kono
parents:
diff changeset
171 for Some_Tagged_Type'External_Tag use Tag_String; -- N/A => ERROR.
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 -- Import, Export and Convention pragmas
kono
parents:
diff changeset
174 -- no interesting test can be specified
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 -- input clause
kono
parents:
diff changeset
177 -- no interesting test can be specified
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 -- output clause
kono
parents:
diff changeset
180 -- no interesting test can be specified
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 -- Pack pragma
kono
parents:
diff changeset
183 -- no interesting test can be specified
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 -- read clause
kono
parents:
diff changeset
186 -- no interesting test can be specified
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 -- record representation clause
kono
parents:
diff changeset
189 -- Expressions must be static - RM 13.3(10)
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 type Record_To_Layout is record
kono
parents:
diff changeset
192 Bit_0 : Boolean;
kono
parents:
diff changeset
193 Bit_1 : Boolean;
kono
parents:
diff changeset
194 end record;
kono
parents:
diff changeset
195 for Record_To_Layout use record -- N/A => ERROR.
kono
parents:
diff changeset
196 Bit_0 at Zero range Zero..Zero; -- N/A => ERROR.
kono
parents:
diff changeset
197 Bit_1 at Zero range Four..Four; -- N/A => ERROR.
kono
parents:
diff changeset
198 end record; -- N/A => ERROR.
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 -- size clause
kono
parents:
diff changeset
201 -- Expression must be static - RM 13.3(41)
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 Object_Size : Enumeration;
kono
parents:
diff changeset
204 for Object_Size'Size use A_Reasonable_Size_Value; -- N/A => ERROR.
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 -- small clause
kono
parents:
diff changeset
207 -- Expression must be static - RM 3.5.10(2)
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 type Tenths is delta 0.1 range 0.0..10.0;
kono
parents:
diff changeset
210 for Tenths'Small use 1.0 / (Two ** Five); -- N/A => ERROR.
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 -- storage pool clause
kono
parents:
diff changeset
213 -- Not tested
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 -- storage size clause
kono
parents:
diff changeset
216 -- Expression may be non-static - RM 13.11(15)
kono
parents:
diff changeset
217 type Reference is access Record_To_Layout;
kono
parents:
diff changeset
218 for Reference'Storage_Size use Four * K; -- N/A => ERROR.
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220
kono
parents:
diff changeset
221 -- write clause
kono
parents:
diff changeset
222 -- no interesting test can be specified
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 procedure TC_Check_Values;
kono
parents:
diff changeset
225
kono
parents:
diff changeset
226 end CD10001_0;
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 with TCTouch;
kono
parents:
diff changeset
231 package body CD10001_0 is
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 use type System.Address;
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 procedure Assert( Truth : Boolean; Message: String ) is
kono
parents:
diff changeset
236 begin
kono
parents:
diff changeset
237 if not Truth then
kono
parents:
diff changeset
238 TCTouch.Implementation_Check( Message );
kono
parents:
diff changeset
239 end if;
kono
parents:
diff changeset
240 end Assert;
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 procedure TC_Check_Values is
kono
parents:
diff changeset
243 Record_Object : Record_To_Layout;
kono
parents:
diff changeset
244 begin
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 Assert(Object_Address'Address = Nonstatic_Entity,
kono
parents:
diff changeset
247 "Object not at specified address");
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 Assert(Object_Alignment'Alignment >= One,
kono
parents:
diff changeset
250 "Object not at specified alignment");
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 Assert(Array_With_Components'Component_Size = A_Reasonable_Size_Value,
kono
parents:
diff changeset
253 "Array Components not specified size");
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 -- I don't see how to reliably check this one:
kono
parents:
diff changeset
256 --
kono
parents:
diff changeset
257 -- type Enumeration_1 is (First, Second, Third);
kono
parents:
diff changeset
258 -- for Enumeration_1 use (First => One, Second => Two, Third => Three);
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 Assert(Some_Tagged_Type'External_Tag = Tag_String,
kono
parents:
diff changeset
261 "External_Tag not specified value");
kono
parents:
diff changeset
262 Assert(Record_Object.Bit_0'First_Bit = Zero,
kono
parents:
diff changeset
263 "Record object First_Bit not zero");
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 Assert(Record_Object.Bit_1'Last_Bit = Four,
kono
parents:
diff changeset
266 "Record object Last_Bit not four");
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 Assert(Object_Size'Size = A_Reasonable_Size_Value,
kono
parents:
diff changeset
269 "Object size not specified value");
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 Assert(Tenths'Small = 1.0 / Two ** Five,
kono
parents:
diff changeset
272 "Tenths small not specified value");
kono
parents:
diff changeset
273
kono
parents:
diff changeset
274 Assert(Reference'Storage_Size = 4096, -- Four * K,
kono
parents:
diff changeset
275 "Reference storage size not specified value");
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 end TC_Check_Values;
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 end CD10001_0;
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 ------------------------------------------------------------------- CD10001
kono
parents:
diff changeset
282
kono
parents:
diff changeset
283 with Report;
kono
parents:
diff changeset
284 with CD10001_0;
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 procedure CD10001 is
kono
parents:
diff changeset
287
kono
parents:
diff changeset
288 begin -- Main test procedure.
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290 Report.Test ("CD10001", "Check that representation items containing " &
kono
parents:
diff changeset
291 "nonstatic expressions are supported in the " &
kono
parents:
diff changeset
292 "case that the representation item is a name " &
kono
parents:
diff changeset
293 "that statically denotes a constant declared " &
kono
parents:
diff changeset
294 "before the entity" );
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 CD10001_0.TC_Check_Values;
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 Report.Result;
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 end CD10001;