summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pragma-pack-2.c
blob: f44f8dbba3330c5869407c59c0266ceca7f2265d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* On Solaris, #pragma pack should accept macro expansion.  */

/* { dg-do run { target *-*-solaris2.* } } */

extern void abort (void);

struct {
        char one;
        long two;
} defaultalign;

#define ALIGNHIGH 16

#pragma pack(ALIGNHIGH)
struct {
        char one;
        long two;
} sixteen;

#define ALIGN1(X) 1
#pragma pack(ALIGN1(4))
struct {
        char one;
        long two;
} two;

#define ALIGN2(X) X
#pragma pack(ALIGN2(2))
struct {
        char one;
        long two;
} three;

#define EMPTY
#pragma pack(EMPTY)
struct {
        char one;
        long two;
} resetalign;

main()
{
        if(sizeof(sixteen) < sizeof(defaultalign)) abort();
        if(sizeof(two) >= sizeof(defaultalign)) abort();
        if(sizeof(three) <= sizeof(two)) abort();
        if(sizeof(resetalign) != sizeof(defaultalign)) abort();
	return 0;
}