[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / pragma-pack.c
blob7b45e045b39ecaf1063d38a4dc12bd537c99137f
1 // Test this without pch.
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DSET
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DRESET
4 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DPUSH
5 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DPUSH_POP
6 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -Wno-pragma-pack -DPUSH_POP_LABEL
8 // Test with pch.
9 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DSET -emit-pch -o %t
10 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DSET -verify -include-pch %t
11 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DRESET -emit-pch -o %t
12 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DRESET -verify -include-pch %t
13 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DPUSH -emit-pch -o %t
14 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DPUSH -verify -include-pch %t
15 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DPUSH_POP -emit-pch -o %t
16 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DPUSH_POP -verify -include-pch %t
17 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DPUSH_POP_LABEL -emit-pch -o %t
18 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -Wno-pragma-pack -DPUSH_POP_LABEL -verify -include-pch %t
20 #ifndef HEADER
21 #define HEADER
23 #ifdef SET
24 #pragma pack(1)
25 #endif
27 #ifdef RESET
28 #pragma pack(2)
29 #pragma pack ()
30 #endif
32 #ifdef PUSH
33 #pragma pack(1)
34 #pragma pack (push, 2)
35 #endif
37 #ifdef PUSH_POP
38 #pragma pack (push, 4)
39 #pragma pack (push, 2)
40 #pragma pack (pop)
41 #endif
43 #ifdef PUSH_POP_LABEL
44 #pragma pack (push, a, 4)
45 #pragma pack (push, b, 1)
46 #pragma pack (push, c, 2)
47 #pragma pack (pop, b)
48 #endif
50 #else
52 #ifdef SET
53 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}}
54 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
55 #endif
57 #ifdef RESET
58 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
59 #pragma ()
60 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
61 #endif
63 #ifdef PUSH
64 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 2}}
65 #pragma pack(pop)
66 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}}
67 #pragma pack ()
68 #pragma pack (show) // expected-warning {{value of #pragma pack(show) == 8}}
69 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
70 #endif
72 #ifdef PUSH_POP
73 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
74 #pragma pack(pop)
75 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
76 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
77 #endif
79 #ifdef PUSH_POP_LABEL
80 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
81 #pragma pack(pop, c)
82 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
83 #pragma pack(pop, a)
84 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
85 #pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
86 #pragma pack(pop, b) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
87 #pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
88 #endif
90 #endif