source: trunk/libs/newlib/src/libgloss/testsuite/libgloss.all/varargs.c @ 575

Last change on this file since 575 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 812 bytes
Line 
1/* Oki bug report [OKI013]
2 
3   Variable argments test failed.
4
5   Execution result.
6   val1, val2 = 1, 0
7   val1, val2 = 2, 0
8   val1, val2 = 3, 0
9
10   Note, this tests for ANSI style varargs.
11
12 */
13
14#include <stdio.h>
15#include <stdarg.h>
16int     func(int, ...);
17
18main()
19{
20        func(2, 1., 2., 3.);
21}
22
23func(int i, ...)
24{
25        va_list p;
26        int j;
27
28        va_start(p, i);
29        for (j = 1; j <= 3; ++j){
30                dequals(__LINE__, (double)j, va_arg(p, double));
31        }
32        va_end(p);
33        return (i);
34}
35
36dequals(int line, double val1, double val2)
37{
38        iprintf ("val1, val2 = %d, %d\n", (int)val1, (int)val2);
39        if(val1 == val2)
40                pass ("varargs [OKI013]");
41        else
42                fail ("varargs [OKI013]");
43
44        fflush (stdout);
45        return;
46}
Note: See TracBrowser for help on using the repository browser.