[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / pragma-pack-2.c
blobe337953d362658d0ca2bda309ef2f0a4f173119a
1 // RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
2 // expected-no-diagnostics
4 #include <stddef.h>
6 #pragma pack(4)
8 // Baseline
9 struct s0 {
10 char f0;
11 int f1;
13 extern int a0[offsetof(struct s0, f1) == 4 ? 1 : -1];
15 #pragma pack(push, 2)
16 struct s1 {
17 char f0;
18 int f1;
20 extern int a1[offsetof(struct s1, f1) == 2 ? 1 : -1];
21 #pragma pack(pop)
23 #pragma pack(1)
24 struct s3_0 {
25 char f0;
26 int f1;
28 #pragma pack()
29 struct s3_1 {
30 char f0;
31 int f1;
33 extern int a3_0[offsetof(struct s3_0, f1) == 1 ? 1 : -1];
34 extern int a3_1[offsetof(struct s3_1, f1) == 4 ? 1 : -1];
36 // pack(0) is like pack()
37 #pragma pack(1)
38 struct s4_0 {
39 char f0;
40 int f1;
42 #pragma pack(0)
43 struct s4_1 {
44 char f0;
45 int f1;
47 extern int a4_0[offsetof(struct s4_0, f1) == 1 ? 1 : -1];
48 extern int a4_1[offsetof(struct s4_1, f1) == 4 ? 1 : -1];
50 void f(void) {
51 #pragma pack(push, 2)
52 struct s5_0 {
53 char f0;
54 struct s2_4_0 {
55 int f0;
56 } f1;
58 #pragma pack(pop)
59 extern int s5_0[offsetof(struct s5_0, f1) == 2 ? 1 : -1];