annotate gcc/testsuite/ada/acats/tests/cd/cd33002.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 -- CD33002.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 Component_Sizes that are multiples of the word
kono
parents:
diff changeset
28 -- size are supported.
kono
parents:
diff changeset
29 --
kono
parents:
diff changeset
30 -- Check that for such Component_Sizes arrays contain no gaps between
kono
parents:
diff changeset
31 -- components.
kono
parents:
diff changeset
32 --
kono
parents:
diff changeset
33 -- TEST DESCRIPTION:
kono
parents:
diff changeset
34 -- This test defines three array types and specifies their layouts
kono
parents:
diff changeset
35 -- using representation specifications for the 'Component_Size and
kono
parents:
diff changeset
36 -- pragma Packs for each. It then checks that the implied assumptions
kono
parents:
diff changeset
37 -- about the resulting layout actually can be made.
kono
parents:
diff changeset
38 --
kono
parents:
diff changeset
39 -- APPLICABILITY CRITERIA:
kono
parents:
diff changeset
40 -- All implementations must attempt to compile this test.
kono
parents:
diff changeset
41 --
kono
parents:
diff changeset
42 -- For implementations validating against Systems Programming Annex (C):
kono
parents:
diff changeset
43 -- this test must execute and report PASSED.
kono
parents:
diff changeset
44 --
kono
parents:
diff changeset
45 -- For implementations not validating against Annex C:
kono
parents:
diff changeset
46 -- this test may report compile time errors at one or more points
kono
parents:
diff changeset
47 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
kono
parents:
diff changeset
48 -- Otherwise, the test must execute and report PASSED.
kono
parents:
diff changeset
49 --
kono
parents:
diff changeset
50 --
kono
parents:
diff changeset
51 -- CHANGE HISTORY:
kono
parents:
diff changeset
52 -- 22 JUL 95 SAIC Initial version
kono
parents:
diff changeset
53 -- 07 MAY 96 SAIC Revised for 2.1
kono
parents:
diff changeset
54 -- 24 AUG 96 SAIC Additional 2.1 revisions
kono
parents:
diff changeset
55 -- 16 FEB 98 EDS Modify documentation.
kono
parents:
diff changeset
56 --!
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 ----------------------------------------------------------------- CD33002_0
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 with System;
kono
parents:
diff changeset
61 package CD33002_0 is
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 S_Units_per_Word : constant := System.Word_Size/System.Storage_Unit;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 type Nibble is mod 2**4;
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 type Byte is mod 2**8;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 type Word_Stuff is array(Natural range <>) of Byte;
kono
parents:
diff changeset
70 for Word_Stuff'Component_Size
kono
parents:
diff changeset
71 use System.Word_Size; -- ANX-C RQMT.
kono
parents:
diff changeset
72 pragma Pack(Word_Stuff); -- ANX-C RQMT.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 type Double_Stuff is array(Natural range <>) of Byte;
kono
parents:
diff changeset
75 for Double_Stuff'Component_Size
kono
parents:
diff changeset
76 use System.Word_Size * 2; -- multiple -- ANX-C RQMT.
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 type Address_Calculator is record
kono
parents:
diff changeset
79 Item_1 : Nibble;
kono
parents:
diff changeset
80 Item_2 : Nibble;
kono
parents:
diff changeset
81 end record;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 for Address_Calculator use record
kono
parents:
diff changeset
84 Item_1 at 0 range 0..3;
kono
parents:
diff changeset
85 Item_2 at 1 range 0..3;
kono
parents:
diff changeset
86 end record;
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- by definition (13.5.2(2)) abs(Item_2'Address - Item_1'Address) = 1
kono
parents:
diff changeset
89 -- it therefore follows that:
kono
parents:
diff changeset
90 -- Address_Calculator'Size = 2 * Addressable_Unit'Size
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 end CD33002_0;
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 -- there is no package body CD33002_0
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 ------------------------------------------------------------------- CD33002
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 with Report;
kono
parents:
diff changeset
101 with TCTouch;
kono
parents:
diff changeset
102 with System.Storage_Elements;
kono
parents:
diff changeset
103 with CD33002_0;
kono
parents:
diff changeset
104 procedure CD33002 is
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 use type System.Storage_Elements.Storage_Offset;
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 A_Word : CD33002_0.Word_Stuff(0..15);
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 A_Double : CD33002_0.Double_Stuff(0..15);
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 procedure Unexpected( Message : String; Wanted, Got: Integer ) is
kono
parents:
diff changeset
113 begin
kono
parents:
diff changeset
114 Report.Failed ( Message & " Wanted:"
kono
parents:
diff changeset
115 & Integer'Image(Wanted) & " Got:" & Integer'Image(Got) );
kono
parents:
diff changeset
116 end Unexpected;
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 begin -- Main test procedure.
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 Report.Test ("CD33002", "Check that Component_Sizes that are multiples "
kono
parents:
diff changeset
121 & "of the word size are supported. Check that for "
kono
parents:
diff changeset
122 & "such Component_Sizes arrays contain no gaps "
kono
parents:
diff changeset
123 & "between components" );
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 if A_Word'Size /= CD33002_0.Word_Stuff'Component_Size * 16 then
kono
parents:
diff changeset
126 Unexpected("Word Size",
kono
parents:
diff changeset
127 CD33002_0.Word_Stuff'Component_Size * 16,
kono
parents:
diff changeset
128 A_Word'Size );
kono
parents:
diff changeset
129 end if;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 if A_Double'Size /= CD33002_0.Double_Stuff'Component_Size * 16 then
kono
parents:
diff changeset
132 Unexpected("Double word Size",
kono
parents:
diff changeset
133 CD33002_0.Double_Stuff'Component_Size * 16,
kono
parents:
diff changeset
134 A_Double'Size );
kono
parents:
diff changeset
135 end if;
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 Report.Result;
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 end CD33002;