| 1 |
// RUN: %clang_cc1 -fsyntax-only -Wno-pragma-pack -verify %s |
| 2 |
|
| 3 |
// Note that this puts the expected lines before the directives to work around |
| 4 |
// limitations in the -verify mode. |
| 5 |
|
| 6 |
/* expected-warning {{missing '(' after '#pragma pack'}}*/ #pragma pack 10 |
| 7 |
#pragma pack() |
| 8 |
#pragma pack(8) |
| 9 |
|
| 10 |
/*expected-warning {{unknown action for '#pragma pack'}}*/ #pragma pack(hello) |
| 11 |
#pragma pack(push) |
| 12 |
#pragma pack(pop) |
| 13 |
|
| 14 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,) |
| 15 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,) |
| 16 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(pop,) |
| 17 |
|
| 18 |
#pragma pack(push,i) |
| 19 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i, |
| 20 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,) |
| 21 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,help) |
| 22 |
|
| 23 |
#pragma pack(push,8) |
| 24 |
/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,8, |
| 25 |
/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,8,) |
| 26 |
/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,i,8 |
| 27 |
#pragma pack(push,i,8) |
| 28 |
|
| 29 |
/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push |
| 30 |
|
| 31 |
_Pragma("pack(push)") |
| 32 |
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ _Pragma("pack(push,)") |
| 33 |
|
| 34 |
// PR13580 |
| 35 |
struct S |
| 36 |
{ |
| 37 |
char a[3]; |
| 38 |
#pragma pack(1) |
| 39 |
struct T |
| 40 |
{ |
| 41 |
char b; |
| 42 |
int c; |
| 43 |
} d; |
| 44 |
#pragma pack() |
| 45 |
int e; |
| 46 |
}; |
| 47 |
|
| 48 |
_Pragma("pack(push, 1)") struct PR28094 { |
| 49 |
int a; |
| 50 |
} _Pragma("pack(pop)"); |