summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c
blob: 6f1cdc86014dc4ef17ba33eacb9537a73c86f22f (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef SKIP_VLA_IN_STRUCT

#ifndef T
#include "compat-common.h"
#include "mixed-struct-defs.h"
#include "mixed-struct-init.h"

#define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST)			\
extern void testva##NAME (int n, ...);					\
									\
void									\
testit##NAME (int n)							\
{									\
  struct S { FIELDS TYPE a[n]; } s;					\
  int i;								\
  FIELDINIT;								\
  for (i = 0; i < n; ++i)						\
    s.a[i] = 12 + n - i;						\
  testva##NAME (n, s, n, s);						\
}

#include "struct-by-value-22_x.c"

#undef T

void
struct_by_value_22_x ()
{
  int n;
DEBUG_INIT

#define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) testit##NAME (n);

  for (n = 0; n < 16; ++n)
    {
#include "struct-by-value-22_x.c"
      DEBUG_NL;
    }
  for (; n < 110; n += 13)
    {
#include "struct-by-value-22_x.c"
      DEBUG_NL;
    }

DEBUG_FINI

if (fails != 0)
  abort ();
}

#else

#define S(NAME, FIELDS, FIELDINIT, FIELDTEST)				\
  T(c##NAME, FIELDS, char, FIELDINIT, FIELDTEST)			\
  T(s##NAME, FIELDS, short, FIELDINIT, FIELDTEST)			\
  T(u##NAME, FIELDS, unsigned, FIELDINIT, FIELDTEST)			\
  T(d##NAME, FIELDS, double, FIELDINIT, FIELDTEST)
S(E, , do {} while (0), DEBUG_DOT)
S(n, int n;, s.n = n, if (s.n != n) DEBUG_CHECK)
#define U(TYPE)								\
S(TYPE, TYPE s;, init##TYPE (&s.s, n), check##TYPE (s.s, n))
U(Scd)
U(Scdc)
U(Sd)
U(Sdi)
U(Scsds)
U(Scsdsc)
U(Scsdis)
U(Scsdisc)
U(Ssds)
U(Ssdsc)
U(Scssdss)
U(Scssdssc)
U(Sfi)
U(Sfii)
U(Sfifi)
U(Sfiifii)
#undef S
#undef U

#endif

#endif