2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / compat / struct-by-value-20_y.c
blob6e02e7d0a009e38f28f85ecb63a8dfee73dda327
1 #include <stdarg.h>
3 #include "compat-common.h"
5 /* Turn off checking for variable arguments with -DSKIPVA. */
6 #ifdef SKIPVA
7 const int test_va = 0;
8 #else
9 const int test_va = 1;
10 #endif
12 #include "mixed-struct-defs.h"
14 extern void checkScd (Scd x, int i);
15 extern void checkScdc (Scdc x, int i);
16 extern void checkSd (Sd x, int i);
17 extern void checkSdi (Sdi x, int i);
18 extern void checkScsds (Scsds x, int i);
19 extern void checkScsdsc (Scsdsc x, int i);
20 extern void checkScsdis (Scsdis x, int i);
21 extern void checkScsdisc (Scsdisc x, int i);
22 extern void checkSsds (Ssds x, int i);
23 extern void checkSsdsc (Ssdsc x, int i);
24 extern void checkScssdss (Scssdss x, int i);
25 extern void checkScssdssc (Scssdssc x, int i);
27 #include "mixed-struct-init.h"
29 #define T(TYPE) \
30 extern TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
31 extern TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
32 extern TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
33 extern TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
35 void \
36 checkg##TYPE (void) \
37 { \
38 check##TYPE ( g1s##TYPE, 1); \
39 check##TYPE ( g2s##TYPE, 2); \
40 check##TYPE ( g3s##TYPE, 3); \
41 check##TYPE ( g4s##TYPE, 4); \
42 check##TYPE ( g5s##TYPE, 5); \
43 check##TYPE ( g6s##TYPE, 6); \
44 check##TYPE ( g7s##TYPE, 7); \
45 check##TYPE ( g8s##TYPE, 8); \
46 check##TYPE ( g9s##TYPE, 9); \
47 check##TYPE ( g10s##TYPE, 10); \
48 check##TYPE ( g11s##TYPE, 11); \
49 check##TYPE ( g12s##TYPE, 12); \
50 check##TYPE ( g13s##TYPE, 13); \
51 check##TYPE ( g14s##TYPE, 14); \
52 check##TYPE ( g15s##TYPE, 15); \
53 check##TYPE ( g16s##TYPE, 16); \
54 } \
56 void \
57 test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
58 TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
59 TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
60 TYPE s13, TYPE s14, TYPE s15, TYPE s16) \
61 { \
62 check##TYPE (s1, 1); \
63 check##TYPE (s2, 2); \
64 check##TYPE (s3, 3); \
65 check##TYPE (s4, 4); \
66 check##TYPE (s5, 5); \
67 check##TYPE (s6, 6); \
68 check##TYPE (s7, 7); \
69 check##TYPE (s8, 8); \
70 check##TYPE (s9, 9); \
71 check##TYPE (s10, 10); \
72 check##TYPE (s11, 11); \
73 check##TYPE (s12, 12); \
74 check##TYPE (s13, 13); \
75 check##TYPE (s14, 14); \
76 check##TYPE (s15, 15); \
77 check##TYPE (s16, 16); \
78 } \
80 void \
81 testva##TYPE (int n, ...) \
82 { \
83 int i; \
84 va_list ap; \
85 if (test_va) \
86 { \
87 va_start (ap, n); \
88 for (i = 0; i < n; i++) \
89 { \
90 TYPE t = va_arg (ap, TYPE); \
91 check##TYPE (t, i+1); \
92 } \
93 va_end (ap); \
94 } \
97 T(Scd)
98 T(Scsds)
99 T(Scssdss)