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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [vprintf-1.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
#ifndef test
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <stdarg.h>
5
 
6
void
7
inner (int x, ...)
8
{
9
  va_list ap, ap2;
10
  va_start (ap, x);
11
  va_start (ap2, x);
12
 
13
  switch (x)
14
    {
15
#define test(n, ret, fmt, args) \
16
    case n:                             \
17
      vprintf (fmt, ap);                \
18
      if (vprintf (fmt, ap2) != ret)    \
19
        abort ();                       \
20
      break;
21
#include "vprintf-1.c"
22
#undef test
23
    default:
24
      abort ();
25
    }
26
 
27
  va_end (ap);
28
  va_end (ap2);
29
}
30
 
31
int
32
main (void)
33
{
34
#define test(n, ret, fmt, args) \
35
  inner args;
36
#include "vprintf-1.c"
37
#undef test
38
  return 0;
39
}
40
 
41
#else
42
  test (0, 5, "hello", (0));
43
  test (1, 6, "hello\n", (1));
44
  test (2, 1, "a", (2));
45
  test (3, 0, "", (3));
46
  test (4, 5, "%s", (4, "hello"));
47
  test (5, 6, "%s", (5, "hello\n"));
48
  test (6, 1, "%s", (6, "a"));
49
  test (7, 0, "%s", (7, ""));
50
  test (8, 1, "%c", (8, 'x'));
51
  test (9, 7, "%s\n", (9, "hello\n"));
52
  test (10, 2, "%d\n", (10, 0));
53
#endif

powered by: WebSVN 2.1.0

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