1 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
2 // RUN: -fxl-pragma-pack -verify -fsyntax-only -x c++ %s | \
5 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
6 // RUN: -fxl-pragma-pack -verify -fsyntax-only -x c++ %s | \
10 #pragma align(natural)
20 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
22 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
31 // CHECK: *** Dumping AST Record Layout
32 // CHECK-NEXT: 0 | struct test1::A
33 // CHECK-NEXT: 0 | int i
34 // CHECK-NEXT: 4 | double d
35 // CHECK-NEXT: | [sizeof=12, dsize=12, align=2, preferredalign=2,
36 // CHECK-NEXT: | nvsize=12, nvalign=2, preferrednvalign=2]
38 // CHECK: *** Dumping AST Record Layout
39 // CHECK-NEXT: 0 | struct test1::B
40 // CHECK-NEXT: 0 | int i
41 // CHECK-NEXT: 8 | double d
42 // CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=8,
43 // CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=8]
48 #pragma align(natural)
65 // CHECK: *** Dumping AST Record Layout
66 // CHECK-NEXT: 0 | struct test2::A
67 // CHECK-NEXT: 0 | int i
68 // CHECK-NEXT: 4 | double d
69 // CHECK-NEXT: | [sizeof=12, dsize=12, align=2, preferredalign=2,
70 // CHECK-NEXT: | nvsize=12, nvalign=2, preferrednvalign=2]
72 // CHECK: *** Dumping AST Record Layout
73 // CHECK-NEXT: 0 | struct test2::B
74 // CHECK-NEXT: 0 | int i
75 // CHECK-NEXT: 4 | double d
76 // CHECK-NEXT: | [sizeof=12, dsize=12, align=4, preferredalign=4,
77 // CHECK-NEXT: | nvsize=12, nvalign=4, preferrednvalign=4]
83 #pragma align(natural)
92 // CHECK: *** Dumping AST Record Layout
93 // CHECK-NEXT: 0 | struct test3::A
94 // CHECK-NEXT: 0 | double d
95 // CHECK-NEXT: | [sizeof=8, dsize=8, align=4, preferredalign=8,
96 // CHECK-NEXT: | nvsize=8, nvalign=4, preferrednvalign=8]
102 #pragma align(natural)
114 // CHECK: *** Dumping AST Record Layout
115 // CHECK-NEXT: 0 | struct test4::A
116 // CHECK-NEXT: 0 | int i
117 // CHECK-NEXT: 8 | double d
118 // CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=8,
119 // CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=8]
125 #pragma align(natural)
136 // CHECK: *** Dumping AST Record Layout
137 // CHECK-NEXT: 0 | struct test5::A
138 // CHECK-NEXT: 0 | int i
139 // CHECK-NEXT: 4 | double d
140 // CHECK-NEXT: | [sizeof=12, dsize=12, align=4, preferredalign=4,
141 // CHECK-NEXT: | nvsize=12, nvalign=4, preferrednvalign=4]
146 #pragma align(natural)
147 #pragma pack(0) // expected-error {{expected #pragma pack parameter to be '1', '2', '4', '8', or '16'}}
148 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
158 // CHECK: *** Dumping AST Record Layout
159 // CHECK-NEXT: 0 | struct test6::A
160 // CHECK-NEXT: 0 | int i
161 // CHECK-NEXT: 8 | double d
162 // CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=8,
163 // CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=8]
168 #pragma align = natural // expected-warning {{missing '(' after '#pragma align' - ignoring}}
169 #pragma align(reset) // expected-warning {{#pragma options align=reset failed: stack empty}}
173 #pragma align(packed)
175 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 2}}
184 // CHECK: *** Dumping AST Record Layout
185 // CHECK-NEXT: 0 | struct test8::A
186 // CHECK-NEXT: 0 | int i
187 // CHECK-NEXT: 4 | double d
188 // CHECK-NEXT: | [sizeof=12, dsize=12, align=2, preferredalign=2,
189 // CHECK-NEXT: | nvsize=12, nvalign=2, preferrednvalign=2]
194 #pragma pack(push, r1, 2) // expected-error {{specifying an identifier within `#pragma pack` is not supported on this target}}
199 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
203 // CHECK: *** Dumping AST Record Layout
204 // CHECK-NEXT: 0 | struct test9::A
205 // CHECK-NEXT: 0 | int i
206 // CHECK-NEXT: 4 | double d
207 // CHECK-NEXT: | [sizeof=12, dsize=12, align=4, preferredalign=4,
208 // CHECK-NEXT: | nvsize=12, nvalign=4, preferrednvalign=4]
222 // CHECK: *** Dumping AST Record Layout
223 // CHECK-NEXT: 0 | struct test10::A
224 // CHECK-NEXT: 0 | int i
225 // CHECK-NEXT: 4 | double d
226 // CHECK-NEXT: | [sizeof=12, dsize=12, align=4, preferredalign=4,
227 // CHECK-NEXT: | nvsize=12, nvalign=4, preferrednvalign=4]
229 } // namespace test10