libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / compat / struct-by-value-22_x.c
blob6f1cdc86014dc4ef17ba33eacb9537a73c86f22f
1 #ifndef SKIP_VLA_IN_STRUCT
3 #ifndef T
4 #include "compat-common.h"
5 #include "mixed-struct-defs.h"
6 #include "mixed-struct-init.h"
8 #define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) \
9 extern void testva##NAME (int n, ...); \
11 void \
12 testit##NAME (int n) \
13 { \
14 struct S { FIELDS TYPE a[n]; } s; \
15 int i; \
16 FIELDINIT; \
17 for (i = 0; i < n; ++i) \
18 s.a[i] = 12 + n - i; \
19 testva##NAME (n, s, n, s); \
22 #include "struct-by-value-22_x.c"
24 #undef T
26 void
27 struct_by_value_22_x ()
29 int n;
30 DEBUG_INIT
32 #define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) testit##NAME (n);
34 for (n = 0; n < 16; ++n)
36 #include "struct-by-value-22_x.c"
37 DEBUG_NL;
39 for (; n < 110; n += 13)
41 #include "struct-by-value-22_x.c"
42 DEBUG_NL;
45 DEBUG_FINI
47 if (fails != 0)
48 abort ();
51 #else
53 #define S(NAME, FIELDS, FIELDINIT, FIELDTEST) \
54 T(c##NAME, FIELDS, char, FIELDINIT, FIELDTEST) \
55 T(s##NAME, FIELDS, short, FIELDINIT, FIELDTEST) \
56 T(u##NAME, FIELDS, unsigned, FIELDINIT, FIELDTEST) \
57 T(d##NAME, FIELDS, double, FIELDINIT, FIELDTEST)
58 S(E, , do {} while (0), DEBUG_DOT)
59 S(n, int n;, s.n = n, if (s.n != n) DEBUG_CHECK)
60 #define U(TYPE) \
61 S(TYPE, TYPE s;, init##TYPE (&s.s, n), check##TYPE (s.s, n))
62 U(Scd)
63 U(Scdc)
64 U(Sd)
65 U(Sdi)
66 U(Scsds)
67 U(Scsdsc)
68 U(Scsdis)
69 U(Scsdisc)
70 U(Ssds)
71 U(Ssdsc)
72 U(Scssdss)
73 U(Scssdssc)
74 U(Sfi)
75 U(Sfii)
76 U(Sfifi)
77 U(Sfiifii)
78 #undef S
79 #undef U
81 #endif
83 #endif