1#include "struct-layout-1.h"
2
3#define F(n, x, v, w) 						\
4  if (info.flds[i] != &s##n.x)					\
5    FAIL (n, 50);						\
6  if (info.sizes[i] != sizeof (s##n.x))				\
7    FAIL (n, 51);						\
8  if (info.aligns[i] != __alignof__ (s##n.x))			\
9    FAIL (n, 52);						\
10  if (s##n.x != (__typeof__ (s##n.x)) v)			\
11    FAIL (n, 53);						\
12  if (a##n[2].x != (__typeof__ (s##n.x)) w)			\
13    FAIL (n, 54);						\
14  if (arg0.x != s##n.x)						\
15    FAIL (n, 55);						\
16  if (arg2.x != a##n[2].x)					\
17    FAIL (n, 56);						\
18  ret.x = s##n.x;						\
19  ++i;
20#define N(n, x) 						\
21  if (info.flds[i] != &s##n.x)					\
22    FAIL (n, 50);						\
23  if (info.sizes[i] != sizeof (s##n.x))				\
24    FAIL (n, 51);						\
25  if (info.aligns[i] != __alignof__ (s##n.x))			\
26    FAIL (n, 52);						\
27  ++i;
28#define B(n, x, v, w) 						\
29  b1.x = v; b2.x = w;						\
30  if (s##n.x != b1.x)						\
31    FAIL (n, 53);						\
32  if (a##n[2].x != b2.x)					\
33    FAIL (n, 54);						\
34  if (arg0.x != s##n.x)						\
35    FAIL (n, 55);						\
36  if (arg2.x != a##n[2].x)					\
37    FAIL (n, 56);						\
38  ret.x = s##n.x;						\
39  ++j;
40#define TX(n, type, attrs, fields, ops) 			\
41type S##n { fields } attrs;					\
42extern type S##n s##n;						\
43type S##n a##n[5];						\
44type S##n							\
45check##n (type S##n arg0, type S##n *arg1, type S##n arg2)	\
46{								\
47  type S##n ret;						\
48  type S##n b1, b2;						\
49  int i, j;							\
50								\
51  memset (&ret, 0, sizeof (ret));				\
52  memset (&b1, 0, sizeof (b1));					\
53  memset (&b2, 0, sizeof (b2));					\
54  if (info.sp != &s##n)						\
55    FAIL (n, 10);						\
56  if (info.a0p != &a##n[0])					\
57    FAIL (n, 11);						\
58  if (info.a3p != &a##n[3])					\
59    FAIL (n, 12);						\
60  if (info.sz != sizeof (s##n))					\
61    FAIL (n, 13);						\
62  if (info.als != __alignof__ (s##n))				\
63    FAIL (n, 14);						\
64  if (info.ala0 != __alignof__ (a##n[0]))			\
65    FAIL (n, 15);						\
66  if (info.ala3 != __alignof__ (a##n[3]))			\
67    FAIL (n, 16);						\
68  if (arg1 != &a##n[1])						\
69    FAIL (n, 17);						\
70  i = 0; j = 0;							\
71  ops								\
72  if (i != info.nfields || j != info.nbitfields)		\
73    FAIL (n, 18);						\
74								\
75  return ret;							\
76}
77