[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / pragma-align.c
blob4c0138b5f89d0a9ec3ecef30d3b5c33cf1fc1154
1 /* Prove that pragma alignment handling works somewhat. */
3 /* { dg-do run { target { ! default_packed } } } */
5 extern void abort (void);
7 struct {
8 char one;
9 long two;
10 } defaultalign;
12 #if defined(__LP64__)
13 #pragma pack(8)
14 #else
15 #pragma pack(4)
16 #endif
17 struct {
18 char one;
19 long two;
20 } sixteen;
22 #pragma pack(1)
23 struct {
24 char one;
25 long two;
26 } two;
28 #pragma pack(2)
29 struct {
30 char one;
31 long two;
32 } three;
34 #pragma pack()
35 struct {
36 char one;
37 long two;
38 } resetalign;
40 main()
42 if(sizeof(sixteen) < sizeof(defaultalign)) abort();
43 if(sizeof(two) >= sizeof(defaultalign)) abort();
44 if(sizeof(three) <= sizeof(two)) abort();
45 if(sizeof(resetalign) != sizeof(defaultalign)) abort();
46 return 0;