Mercurial > hg > CbC > CbC_llvm
comparison clang/test/Sema/pragma-pack-5.c @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -verify -ffreestanding | |
2 // expected-no-diagnostics | |
3 // <rdar://problem/10494810> and PR9560 | |
4 // Check #pragma pack handling with bitfields. | |
5 | |
6 #include <stddef.h> | |
7 #pragma pack(2) | |
8 | |
9 struct s0 { | |
10 char f1; | |
11 unsigned f2 : 32; | |
12 char f3; | |
13 }; | |
14 extern int check[sizeof(struct s0) == 6 ? 1 : -1]; | |
15 | |
16 struct s1 { | |
17 char f1; | |
18 unsigned : 0; | |
19 char f3; | |
20 }; | |
21 extern int check[sizeof(struct s1) == 5 ? 1 : -1]; | |
22 | |
23 struct s2 { | |
24 char f1; | |
25 unsigned : 0; | |
26 unsigned f3 : 8; | |
27 char f4; | |
28 }; | |
29 extern int check[sizeof(struct s2) == 6 ? 1 : -1]; | |
30 | |
31 struct s3 { | |
32 char f1; | |
33 unsigned : 0; | |
34 unsigned f3 : 16; | |
35 char f4; | |
36 }; | |
37 extern int check[sizeof(struct s3) == 8 ? 1 : -1]; | |
38 extern int check[offsetof(struct s3, f4) == 6 ? 1 : -1]; | |
39 | |
40 struct s4 { | |
41 char f1; | |
42 unsigned f2 : 8; | |
43 char f3; | |
44 }; | |
45 extern int check[sizeof(struct s4) == 4 ? 1 : -1]; | |
46 extern int check[offsetof(struct s4, f3) == 2 ? 1 : -1]; |