1 /* Test variable number of arguments passed to functions. */
26 /* This tests the argumentlist to see if it matches the format string which
27 is printf-like. Nothing will be printed of course. It can handle ints,
28 doubles and void pointers. The given value will be tested against the
29 values given in arglist.
30 This test only assures that the variable argument passing is working.
31 No attempt is made to see if argument passing is done the right way. */
33 __attribute__ ((noinline
))
34 noprintf (char *format
, ...)
42 struct arg
*argp
= arglist
;
44 va_start (va_arglist
, format
);
45 for (c
= format
; *c
; c
++)
51 assert (argp
->type
== ARG_INT
);
52 ivalue
= va_arg (va_arglist
, int);
53 assert (argp
->value
.ivalue
== ivalue
);
56 assert (argp
->type
== ARG_DOUBLE
);
57 dvalue
= va_arg (va_arglist
, double);
58 assert (argp
->value
.dvalue
== dvalue
);
61 assert (argp
->type
== ARG_POINTER
);
62 pvalue
= va_arg (va_arglist
, void *);
63 assert (argp
->value
.pvalue
== pvalue
);
73 extern void iamcu_noprintf (char *, ...);
83 al
[0].value
.ivalue
= 256;
84 al
[1].type
= ARG_DOUBLE
;
85 al
[1].value
.dvalue
= 257.0;
86 al
[2].type
= ARG_POINTER
;
87 al
[2].value
.pvalue
= al
;
88 al
[3].type
= ARG_DOUBLE
;
89 al
[3].value
.dvalue
= f
;
91 al
[4].value
.ivalue
= 259;
94 noprintf("%d%f%p%f%d", 256, 257.0, al
, f
, 259);
96 iamcu_noprintf ((char *) 0xabadbeef, 256, 257.0,
97 (void *) 0xbbadbeef, f
, 259);