OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib/] [libgloss/] [testsuite/] [libgloss.all/] [varargs.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/* 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>
16
int     func(int, ...);
17
 
18
main()
19
{
20
        func(2, 1., 2., 3.);
21
}
22
 
23
func(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
 
36
dequals(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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.