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