| 1 |
/* { dg-skip-if "requires io" { freestanding } } */ |
| 2 |
/* { dg-xfail-run-if {unexpected PTX 'vprintf' return value} { nvptx-*-* } } */ |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
#include <stdlib.h> |
| 6 |
|
| 7 |
int |
| 8 |
main (void) |
| 9 |
{ |
| 10 |
#define test(ret, args...) \ |
| 11 |
printf (args); \ |
| 12 |
if (printf (args) != ret) \ |
| 13 |
abort (); |
| 14 |
test (5, "hello"); |
| 15 |
test (6, "hello\n"); |
| 16 |
test (1, "a"); |
| 17 |
test (0, ""); |
| 18 |
test (5, "%s", "hello"); |
| 19 |
test (6, "%s", "hello\n"); |
| 20 |
test (1, "%s", "a"); |
| 21 |
test (0, "%s", ""); |
| 22 |
test (1, "%c", 'x'); |
| 23 |
test (7, "%s\n", "hello\n"); |
| 24 |
test (2, "%d\n", 0); |
| 25 |
return 0; |
| 26 |
} |