1 /* Disable this test for 16-bit targets.  */
2 
3 #if __INT_MAX__ > 32767
4 
5 #include "compat-common.h"
6 #include "struct-align-2.h"
7 
8 #define SETUP(NAME,V1,V2,V3)					\
9 struct outer_##NAME {						\
10   int i;							\
11   struct epoll_event_##NAME ee;					\
12 };								\
13 								\
14 unsigned int v1_##NAME = V1;					\
15 unsigned int v2_##NAME = V2;					\
16 unsigned long long v3_##NAME = V3;				\
17 								\
18 struct outer_##NAME s_##NAME[2] =				\
19  { {V1, { V2, V3 } }, { V1, { V2, V3 } } };			\
20 								\
21 extern void test_##NAME (void);					\
22 extern void checkp_##NAME (struct outer_##NAME *);		\
23 extern void checkg_##NAME (void);				\
24 								\
25 void								\
26 pass_##NAME (struct outer_##NAME s)				\
27 {								\
28   checkp_##NAME (&s);						\
29 }								\
30 								\
31 struct outer_##NAME						\
32 return_##NAME (void)						\
33 {								\
34   return s_##NAME[0];						\
35 }
36 
37 #define CHECK(NAME)						\
38   test_##NAME()
39 
40 SETUP (orig,101, 102, 0x0101010101010101ULL)
41 SETUP (structmax, 103, 104, 0x1212121212121212ULL)
42 SETUP (struct4, 105, 106, 0x2323232323232323ULL)
43 SETUP (struct8, 107, 108, 0x3434343434343434ULL)
44 SETUP (data4, 109, 110, 0x4545454545454545ULL)
45 SETUP (data8, 111, 112, 0x5656565656565656ULL)
46 SETUP (p, 113, 114, 0x6767676767676767ULL)
47 SETUP (pstruct4, 115, 116, 0x7878787878787878ULL)
48 SETUP (pstruct8, 117, 118, 0x8989898989898989ULL)
49 SETUP (pdata4, 119, 120, 0x9A9A9A9A9A9A9A9AULL)
50 SETUP (pdata8, 121, 122, 0xABABABABABABABABULL)
51 
52 void
struct_align_2_x(void)53 struct_align_2_x (void)
54 {
55   DEBUG_INIT
56 
57   CHECK (orig);
58   CHECK (structmax);
59   CHECK (struct4);
60   CHECK (struct8);
61   CHECK (data4);
62   CHECK (data8);
63   CHECK (p);
64   CHECK (pstruct4);
65   CHECK (pstruct8);
66   CHECK (pdata4);
67   CHECK (pdata8);
68 
69   DEBUG_FINI
70 
71   if (fails != 0)
72     abort ();
73 }
74 
75 #else
76 
struct_align_2_x(void)77 void struct_align_2_x (void) {}
78 
79 #endif  /* __INT_MAX__ */
80