summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compat/struct-layout-1_y2.h
blob: 02a341e1ccf2436055adde289c1bc945dc7e170a (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#undef F
#undef N
#undef B
#undef TX

#ifdef SKIP_VA
const int test_va = 0;
#else
const int test_va = 1;
#endif

#define F(n, x, v, w) 						\
  if (p->x != arg.x) FAIL (n, 74);
#define N(n, x)
#define B(n, x, v, w) 						\
  if (p->x != arg.x) FAIL (n, 74);
#define TX(n, type, attrs, fields, ops) 			\
void								\
check##n##va (int z, ...)					\
{								\
  type S##n arg, *p;						\
  va_list ap;							\
  int i;							\
								\
  if (test_va)							\
    {								\
      va_start (ap, z);						\
      for (i = 0; i < 5; ++i)					\
	{							\
	  p = NULL;						\
	  switch ((z << 4) | i)					\
	    {							\
	    case 0x10:						\
	      if (va_arg (ap, double) != 1.0)			\
		FAIL (n, 70);					\
	      break;						\
	    case 0x12:						\
	      if (va_arg (ap, long long) != 2LL)		\
		FAIL (n, 71);					\
	      break;						\
	    case 0x22:						\
	      if (va_arg (ap, long double) != 2.0L)		\
		FAIL (n, 72);					\
	      break;						\
	    case 0x11:						\
	    case 0x20:						\
	    case 0x21:						\
	    case 0x24:						\
	      p = &s##n;					\
	      arg = va_arg (ap, type S##n);			\
	      break;						\
	    case 0x13:						\
	    case 0x14:						\
	    case 0x23:						\
	      p = &a##n[2];					\
	      arg = va_arg (ap, type S##n);			\
	      break;						\
	    default:						\
	      FAIL (n, 73);					\
	      break;						\
	    }							\
	  if (p)						\
	    {							\
	      ops						\
	    }							\
	}							\
      va_end (ap);						\
    }								\
}