| 1 |
// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s |
| 2 |
|
| 3 |
#define ATTR __attribute__((__ms_struct__)) |
| 4 |
|
| 5 |
struct { |
| 6 |
unsigned int bf_1 : 12; |
| 7 |
unsigned int : 0; |
| 8 |
unsigned int bf_2 : 12; |
| 9 |
} ATTR t1; |
| 10 |
static int a1[(sizeof(t1) == 8) -1]; |
| 11 |
|
| 12 |
struct |
| 13 |
{ |
| 14 |
char foo : 4; |
| 15 |
short : 0; |
| 16 |
char bar; |
| 17 |
} ATTR t2; |
| 18 |
static int a2[(sizeof(t2) == 4) -1]; |
| 19 |
|
| 20 |
#pragma ms_struct on |
| 21 |
struct |
| 22 |
{ |
| 23 |
char foo : 4; |
| 24 |
short : 0; |
| 25 |
char bar; |
| 26 |
} t3; |
| 27 |
#pragma ms_struct off |
| 28 |
static int a3[(sizeof(t3) == 4) -1]; |
| 29 |
|
| 30 |
struct |
| 31 |
{ |
| 32 |
char foo : 6; |
| 33 |
long : 0; |
| 34 |
} ATTR t4; |
| 35 |
static int a4[(sizeof(t4) == 8) -1]; |
| 36 |
|
| 37 |
struct |
| 38 |
{ |
| 39 |
char foo : 4; |
| 40 |
short : 0; |
| 41 |
char bar : 8; |
| 42 |
} ATTR t5; |
| 43 |
static int a5[(sizeof(t5) == 4) -1]; |
| 44 |
|
| 45 |
struct |
| 46 |
{ |
| 47 |
char foo : 4; |
| 48 |
short : 0; |
| 49 |
long : 0; |
| 50 |
char bar; |
| 51 |
} ATTR t6; |
| 52 |
static int a6[(sizeof(t6) == 4) -1]; |
| 53 |
|
| 54 |
struct |
| 55 |
{ |
| 56 |
char foo : 4; |
| 57 |
long : 0; |
| 58 |
short : 0; |
| 59 |
char bar; |
| 60 |
} ATTR t7; |
| 61 |
static int a7[(sizeof(t7) == 16) -1]; |
| 62 |
|
| 63 |
struct |
| 64 |
{ |
| 65 |
char foo : 4; |
| 66 |
short : 0; |
| 67 |
long : 0; |
| 68 |
char bar:7; |
| 69 |
} ATTR t8; |
| 70 |
static int a8[(sizeof(t8) == 4) -1]; |
| 71 |
|
| 72 |
struct |
| 73 |
{ |
| 74 |
char foo : 4; |
| 75 |
long : 0; |
| 76 |
short : 0; |
| 77 |
char bar: 8; |
| 78 |
} ATTR t9; |
| 79 |
static int a9[(sizeof(t9) == 16) -1]; |
| 80 |
|
| 81 |
struct |
| 82 |
{ |
| 83 |
char foo : 4; |
| 84 |
char : 0; |
| 85 |
short : 0; |
| 86 |
int : 0; |
| 87 |
long :0; |
| 88 |
char bar; |
| 89 |
} ATTR t10; |
| 90 |
static int a10[(sizeof(t10) == 2) -1]; |