| 1 |
/* On Solaris, #pragma pack should accept macro expansion. */ |
| 2 |
|
| 3 |
/* { dg-do run { target *-*-solaris2.* } } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
struct { |
| 8 |
char one; |
| 9 |
long two; |
| 10 |
} defaultalign; |
| 11 |
|
| 12 |
#define ALIGNHIGH 16 |
| 13 |
|
| 14 |
#pragma pack(ALIGNHIGH) |
| 15 |
struct { |
| 16 |
char one; |
| 17 |
long two; |
| 18 |
} sixteen; |
| 19 |
|
| 20 |
#define ALIGN1(X) 1 |
| 21 |
#pragma pack(ALIGN1(4)) |
| 22 |
struct { |
| 23 |
char one; |
| 24 |
long two; |
| 25 |
} two; |
| 26 |
|
| 27 |
#define ALIGN2(X) X |
| 28 |
#pragma pack(ALIGN2(2)) |
| 29 |
struct { |
| 30 |
char one; |
| 31 |
long two; |
| 32 |
} three; |
| 33 |
|
| 34 |
#define EMPTY |
| 35 |
#pragma pack(EMPTY) |
| 36 |
struct { |
| 37 |
char one; |
| 38 |
long two; |
| 39 |
} resetalign; |
| 40 |
|
| 41 |
main() |
| 42 |
{ |
| 43 |
if(sizeof(sixteen) < sizeof(defaultalign)) abort(); |
| 44 |
if(sizeof(two) >= sizeof(defaultalign)) abort(); |
| 45 |
if(sizeof(three) <= sizeof(two)) abort(); |
| 46 |
if(sizeof(resetalign) != sizeof(defaultalign)) abort(); |
| 47 |
return 0; |
| 48 |
} |