2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / compat / scalar-return-3_x.c
blob9dceccdd8902c17b7ee4b7036eea08deff1dcb0a
1 #include "compat-common.h"
3 /* Turn off checking for variable arguments with -DSKIPVA. */
4 #ifdef SKIPVA
5 const int test_va = 0;
6 #else
7 const int test_va = 1;
8 #endif
10 #define T(NAME, TYPE, INITVAL) \
11 TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
12 TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
13 TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
14 TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
16 extern void init##NAME (TYPE *p, TYPE v); \
17 extern void checkg##NAME (void); \
18 extern TYPE test0##NAME (void); \
19 extern TYPE test1##NAME (TYPE); \
20 extern TYPE testva##NAME (int n, ...); \
22 void \
23 check##NAME (TYPE x, TYPE v) \
24 { \
25 if (x != v) \
26 DEBUG_CHECK \
27 } \
29 void \
30 testit##NAME (void) \
31 { \
32 TYPE rslt; \
33 DEBUG_FPUTS (#NAME); \
34 DEBUG_FPUTS (" init: "); \
35 init##NAME (&g01##NAME, 1); \
36 init##NAME (&g02##NAME, 2); \
37 init##NAME (&g03##NAME, 3); \
38 init##NAME (&g04##NAME, 4); \
39 init##NAME (&g05##NAME, 5); \
40 init##NAME (&g06##NAME, 6); \
41 init##NAME (&g07##NAME, 7); \
42 init##NAME (&g08##NAME, 8); \
43 init##NAME (&g09##NAME, 9); \
44 init##NAME (&g10##NAME, 10); \
45 init##NAME (&g11##NAME, 11); \
46 init##NAME (&g12##NAME, 12); \
47 init##NAME (&g13##NAME, 13); \
48 init##NAME (&g14##NAME, 14); \
49 init##NAME (&g15##NAME, 15); \
50 init##NAME (&g16##NAME, 16); \
51 checkg##NAME (); \
52 DEBUG_NL; \
53 DEBUG_FPUTS (#NAME); \
54 DEBUG_FPUTS (" test0: "); \
55 rslt = test0##NAME (); \
56 check##NAME (rslt, g01##NAME); \
57 DEBUG_NL; \
58 DEBUG_FPUTS (#NAME); \
59 DEBUG_FPUTS (" test1: "); \
60 rslt = test1##NAME (g01##NAME); \
61 check##NAME (rslt, g01##NAME); \
62 if (test_va) \
63 { \
64 DEBUG_NL; \
65 DEBUG_FPUTS (#NAME); \
66 DEBUG_FPUTS (" testva: "); \
67 rslt = testva##NAME (1, g01##NAME); \
68 check##NAME (rslt, g01##NAME); \
69 rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \
70 g04##NAME, g05##NAME); \
71 check##NAME (rslt, g05##NAME); \
72 rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \
73 g04##NAME, g05##NAME, g06##NAME, \
74 g07##NAME, g08##NAME, g09##NAME); \
75 check##NAME (rslt, g09##NAME); \
76 rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \
77 g04##NAME, g05##NAME, g06##NAME, \
78 g07##NAME, g08##NAME, g09##NAME, \
79 g10##NAME, g11##NAME, g12##NAME, \
80 g13##NAME, g14##NAME, g15##NAME, \
81 g16##NAME); \
82 check##NAME (rslt, g16##NAME); \
83 } \
84 DEBUG_NL; \
87 T(ci, _Complex int, (2,3))
88 T(cl, _Complex long, (3,4))
89 T(cll, _Complex long long, (4,5))
90 T(cd, _Complex double, (2.0,3.0))
91 T(cld, _Complex long double, (3.0,4.0))
93 #undef T
95 void
96 scalar_return_3_x ()
98 DEBUG_INIT
100 #define T(NAME) testit##NAME ();
102 T(ci)
103 T(cl)
104 T(cll)
105 T(cd)
106 T(cld)
108 DEBUG_FINI
110 if (fails != 0)
111 abort ();
113 #undef T