[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / PCH / aix-pragma-pack.c
blob67dbbf6f5ab0c5b71ed9070266f9ffd8b315cf11
1 // Test this without pch.
2 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DSET
3 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DRESET
4 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DPUSH
5 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only \
6 // RUN: -Wno-pragma-pack -DPUSH_POP
7 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -include %s -fsyntax-only -fdump-record-layouts \
8 // RUN: -Wno-pragma-pack -DALIGN_NATURAL | \
9 // RUN: FileCheck %s
11 // Test with pch.
12 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DSET -emit-pch -o %t
13 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DSET -verify -include-pch %t
14 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DRESET -emit-pch -o %t
15 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DRESET -verify -include-pch %t
16 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH -emit-pch -o %t
17 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH -verify -include-pch %t
18 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH_POP -emit-pch -o %t
19 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH_POP -verify -include-pch %t
20 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DALIGN_NATURAL -emit-pch -o %t
21 // RUN: %clang_cc1 -triple powerpc-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DALIGN_NATURAL \
22 // RUN: -fdump-record-layouts -include-pch %t | \
23 // RUN: FileCheck %s
25 // Test this without pch.
26 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DSET
27 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DRESET
28 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DPUSH
29 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -include %s -verify -fsyntax-only \
30 // RUN: -Wno-pragma-pack -DPUSH_POP
31 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -include %s -fsyntax-only -fdump-record-layouts \
32 // RUN: -Wno-pragma-pack -DALIGN_NATURAL
34 // Test with pch.
35 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DSET -emit-pch -o %t
36 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DSET -verify -include-pch %t
37 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DRESET -emit-pch -o %t
38 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DRESET -verify -include-pch %t
39 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH -emit-pch -o %t
40 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH -verify -include-pch %t
41 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH_POP -emit-pch -o %t
42 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DPUSH_POP -verify -include-pch %t
43 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DALIGN_NATURAL -emit-pch -o %t
44 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -fxl-pragma-pack %s -Wno-pragma-pack -DALIGN_NATURAL \
45 // RUN: -fdump-record-layouts -include-pch %t | \
46 // RUN: FileCheck %s
48 #ifndef HEADER
49 #define HEADER
51 #ifdef SET
52 #pragma pack(1)
53 #endif
55 #ifdef RESET
56 #pragma pack(2)
57 #pragma pack()
58 #endif
60 #ifdef PUSH
61 #pragma pack(1)
62 #pragma pack(push, 2)
63 #endif
65 #ifdef PUSH_POP
66 #pragma pack(push, 4)
67 #pragma pack(push, 2)
68 #pragma pack(pop)
69 #endif
71 #ifdef ALIGN_NATURAL
72 #pragma align(natural)
73 #endif
75 #else
77 #ifdef SET
78 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}}
79 #pragma pack(pop)
80 #endif
82 #ifdef RESET
83 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
84 #pragma()
85 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
86 #endif
88 #ifdef PUSH
89 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 2}}
90 #pragma pack(pop)
91 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}}
92 #pragma pack()
93 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
94 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
95 #endif
97 #ifdef PUSH_POP
98 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
99 #pragma pack(pop)
100 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
101 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
102 #endif
104 #ifdef ALIGN_NATURAL
105 struct D {
106 int i;
107 double d;
108 } d;
110 int s = sizeof(d);
112 // CHECK: *** Dumping AST Record Layout
113 // CHECK: 0 | struct D
114 // CHECK: 0 | int i
115 // CHECK: 8 | double d
116 // CHECK: | [sizeof=16, align=4, preferredalign=8]
117 #endif
119 #endif