]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.c-torture/execute/vfprintf-1.c
Get rid of dg-skip-if etc. default args
[thirdparty/gcc.git] / gcc / testsuite / gcc.c-torture / execute / vfprintf-1.c
CommitLineData
4f4b0ab8 1/* { dg-skip-if "requires io" { freestanding } } */
a560e5d4 2
10a0d495
JJ
3#ifndef test
4#include <stdio.h>
5#include <stdlib.h>
6#include <stdarg.h>
7
8void
9inner (int x, ...)
10{
11 va_list ap, ap2;
12 va_start (ap, x);
13 va_start (ap2, x);
14
15 switch (x)
16 {
17#define test(n, ret, fmt, args) \
18 case n: \
19 vfprintf (stdout, fmt, ap); \
20 if (vfprintf (stdout, fmt, ap2) != ret) \
21 abort (); \
22 break;
23#include "vfprintf-1.c"
24#undef test
25 default:
26 abort ();
27 }
28
29 va_end (ap);
30 va_end (ap2);
31}
32
33int
34main (void)
35{
36#define test(n, ret, fmt, args) \
37 inner args;
38#include "vfprintf-1.c"
39#undef test
40 return 0;
41}
42
43#else
44 test (0, 5, "hello", (0));
45 test (1, 6, "hello\n", (1));
46 test (2, 1, "a", (2));
47 test (3, 0, "", (3));
48 test (4, 5, "%s", (4, "hello"));
49 test (5, 6, "%s", (5, "hello\n"));
50 test (6, 1, "%s", (6, "a"));
51 test (7, 0, "%s", (7, ""));
52 test (8, 1, "%c", (8, 'x'));
53 test (9, 7, "%s\n", (9, "hello\n"));
54 test (10, 2, "%d\n", (10, 0));
55#endif