[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Sema / pragma-pack-and-options-align.c
blob5bc7c83594cd6fa6b53990985eff6936e4cff4ff
1 // RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
3 // Check that #pragma pack and #pragma options share the same stack.
5 #pragma pack(push, 1)
6 struct s0 {
7 char c;
8 int x;
9 };
10 extern int a[sizeof(struct s0) == 5 ? 1 : -1];
12 #pragma options align=natural
13 struct s1 {
14 char c;
15 int x;
17 extern int a[sizeof(struct s1) == 8 ? 1 : -1];
19 #pragma options align=reset
20 #pragma options align=native
21 struct s1_1 {
22 char c;
23 int x;
25 extern int a[sizeof(struct s1_1) == 8 ? 1 : -1];
27 #pragma pack(pop)
28 struct s2 {
29 char c;
30 int x;
32 extern int a[sizeof(struct s2) == 5 ? 1 : -1];
33 #pragma pack(pop)
35 struct s3 {
36 char c;
37 int x;
39 extern int a[sizeof(struct s3) == 8 ? 1 : -1];
41 #pragma pack(push,2)
42 #pragma options align=power
43 struct s4 {
44 char c;
45 int x;
47 #pragma pack(pop)
48 #pragma options align=reset
49 extern int a[sizeof(struct s4) == 8 ? 1 : -1];
51 /* expected-warning {{#pragma options align=reset failed: stack empty}} */ #pragma options align=reset
52 /* expected-warning {{#pragma pack(pop, ...) failed: stack empty}} */ #pragma pack(pop)