2 /* { dg-options "-std=gnu99" } */
4 /* C99 6.5.2.2 Function calls.
5 Test passing varargs of fixed-point types.
6 Based on the test from ../dfp/. */
10 extern void abort (void);
13 vararg_int (unsigned arg
, ...)
18 result_i
= va_arg (ap
, int);
23 vararg_fract (unsigned arg
, ...)
29 result_i
= va_arg (ap
, int);
30 result_fr
= va_arg (ap
, _Fract
); \
35 vararg_double (unsigned arg
, ...)
42 result_i
= va_arg (ap
, int);
43 result_fr
= va_arg (ap
, _Fract
); \
44 result_d
= va_arg (ap
, double); \
48 #define FUNC(TYPE, NAME) \
50 vararg_ ## NAME (unsigned arg, ...) \
58 result_i = va_arg (ap, int); \
59 result_fr = va_arg (ap, _Fract); \
60 result_d = va_arg (ap, double); \
61 result = va_arg (ap, TYPE); \
66 FUNC (short _Fract
, sf
)
68 FUNC (long _Fract
, lf
)
69 FUNC (long long _Fract
, llf
)
70 FUNC (unsigned short _Fract
, usf
)
71 FUNC (unsigned _Fract
, uf
)
72 FUNC (unsigned long _Fract
, ulf
)
73 FUNC (unsigned long long _Fract
, ullf
)
74 FUNC (_Sat
short _Fract
, Ssf
)
75 FUNC (_Sat _Fract
, Sf
)
76 FUNC (_Sat
long _Fract
, Slf
)
77 FUNC (_Sat
long long _Fract
, Sllf
)
78 FUNC (_Sat
unsigned short _Fract
, Susf
)
79 FUNC (_Sat
unsigned _Fract
, Suf
)
80 FUNC (_Sat
unsigned long _Fract
, Sulf
)
81 FUNC (_Sat
unsigned long long _Fract
, Sullf
)
82 FUNC (short _Accum
, sa
)
84 FUNC (long _Accum
, la
)
85 FUNC (long long _Accum
, lla
)
86 FUNC (unsigned short _Accum
, usa
)
87 FUNC (unsigned _Accum
, ua
)
88 FUNC (unsigned long _Accum
, ula
)
89 FUNC (unsigned long long _Accum
, ulla
)
90 FUNC (_Sat
short _Accum
, Ssa
)
91 FUNC (_Sat _Accum
, Sa
)
92 FUNC (_Sat
long _Accum
, Sla
)
93 FUNC (_Sat
long long _Accum
, Slla
)
94 FUNC (_Sat
unsigned short _Accum
, Susa
)
95 FUNC (_Sat
unsigned _Accum
, Sua
)
96 FUNC (_Sat
unsigned long _Accum
, Sula
)
97 FUNC (_Sat
unsigned long long _Accum
, Sulla
)
101 #define TEST(NAME,PF) \
102 if (vararg_int (0, 100, 0.9r, 55.0, 0.2 ## PF) != 100) \
104 if (vararg_fract (1, 100, 0.9r, 55.0, 0.2 ## PF) != 0.9r) \
106 if (vararg_double (2, 100, 0.9r, 55.0, 0.2 ## PF) != 55.0) \
108 if (vararg_ ## NAME (3, 100, 0.9r, 55.0, 0.2 ## PF) != 0.2 ## PF) \