xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/pragma-align-packed.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #pragma pack(push, 1)
5*f4a2713aSLionel Sambuc struct s0 {
6*f4a2713aSLionel Sambuc   char f0;
7*f4a2713aSLionel Sambuc   int  f1 __attribute__((aligned(4)));
8*f4a2713aSLionel Sambuc };
9*f4a2713aSLionel Sambuc extern int a[sizeof(struct s0) == 5 ? 1 : -1];
10*f4a2713aSLionel Sambuc #pragma pack(pop)
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc struct __attribute__((packed)) s1 {
13*f4a2713aSLionel Sambuc   char f0;
14*f4a2713aSLionel Sambuc   int  f1 __attribute__((aligned(4)));
15*f4a2713aSLionel Sambuc };
16*f4a2713aSLionel Sambuc extern int a[sizeof(struct s1) == 8 ? 1 : -1];
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc #pragma options align=packed
19*f4a2713aSLionel Sambuc struct s2 {
20*f4a2713aSLionel Sambuc   char f0;
21*f4a2713aSLionel Sambuc   int  f1 __attribute__((aligned(4)));
22*f4a2713aSLionel Sambuc };
23*f4a2713aSLionel Sambuc extern int a[sizeof(struct s2) == 5 ? 1 : -1];
24*f4a2713aSLionel Sambuc #pragma options align=reset
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc #pragma pack(1)
27*f4a2713aSLionel Sambuc struct s3_0 { unsigned char f0; unsigned int f1; };
28*f4a2713aSLionel Sambuc int t3_0[sizeof(struct s3_0) == 5 ? 1 : -1];
29*f4a2713aSLionel Sambuc #pragma options align=reset
30*f4a2713aSLionel Sambuc struct s3_1 { unsigned char f0; unsigned int f1; };
31*f4a2713aSLionel Sambuc int t3_1[sizeof(struct s3_1) == 8 ? 1 : -1];
32