2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / compat / scalar-return-1_x.c
blob6525e5e5666571d8c3b1af99a10129e4eeadf619
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(ui, unsigned int, 51)
88 T(si, int, (-55))
89 T(ul, unsigned long, 61)
90 T(sl, long, (-66))
91 T(ull, unsigned long long, 71)
92 T(sll, long long, (-77))
93 T(d, double, 91.0)
94 T(ld, long double, 92.0)
96 #undef T
98 void
99 scalar_return_1_x ()
101 DEBUG_INIT
103 #define T(NAME) testit##NAME ();
105 T(ui)
106 T(si)
107 T(ul)
108 T(sl)
109 T(ull)
110 T(sll)
111 T(d)
112 T(ld)
114 DEBUG_FINI
116 if (fails != 0)
117 abort ();
119 #undef T