[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / pragma-pack-3.c
blobe7a6cee55057b91d79e05fe7619904ffdac3efa4
1 // RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
2 // expected-no-diagnostics
4 // Stack: [], Alignment: 8
6 #pragma pack(push, 1)
7 // Stack: [8], Alignment: 1
9 #pragma pack(push, 4)
10 // Stack: [8, 1], Alignment: 4
12 // Note that this differs from gcc; pack() in gcc appears to pop the
13 // top stack entry and resets the current alignment. This is both
14 // inconsistent with MSVC, and the gcc documentation. In other cases,
15 // for example changing this to pack(8), I don't even understand what gcc
16 // is doing.
18 #pragma pack()
19 // Stack: [8, 1], Alignment: 8
21 #pragma pack(pop)
22 // Stack: [8], Alignment: 1
23 struct s0 {
24 char f0;
25 short f1;
27 int a[sizeof(struct s0) == 3 ? 1 : -1];
29 #pragma pack(pop)
30 // Stack: [], Alignment: 8
31 struct s1 {
32 char f0;
33 short f1;
35 int b[sizeof(struct s1) == 4 ? 1 : -1];