| 1 |
/* Test for printf formats. Formats using C99 features should be rejected |
| 2 |
outside of C99 mode. |
| 3 |
*/ |
| 4 |
/* Origin: Joseph Myers <[email protected]> */ |
| 5 |
/* { dg-do compile { target { *-*-mingw* } } } */ |
| 6 |
/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ |
| 7 |
|
| 8 |
#define USE_SYSTEM_FORMATS |
| 9 |
#include "format.h" |
| 10 |
|
| 11 |
void |
| 12 |
foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t) |
| 13 |
{ |
| 14 |
/* Some tests already in c90-printf-1.c, e.g. %lf. */ |
| 15 |
/* The widths hh, ll, j, z, t are new. */ |
| 16 |
printf ("%hhd", i); /* { dg-warning "unknown|format" "%hh is unsupported" } */ |
| 17 |
printf ("%I64d", ll); /* { dg-warning "length|C" "%I64 in C90" } */ |
| 18 |
printf ("%jd", j); /* { dg-warning "unknown|format" "%j is unsupported" } */ |
| 19 |
printf ("%zu", z); /* { dg-warning "unknown|format" "%z is unsupported" } */ |
| 20 |
printf ("%td", t); /* { dg-warning "unknown|format" "%t is unsupported" } */ |
| 21 |
/* The formats F, a, A are new. */ |
| 22 |
printf ("%F", d); /* { dg-warning "unknown|format" "%F is unsupported" } */ |
| 23 |
printf ("%a", d); /* { dg-warning "unknown|format" "%a is unsupported" } */ |
| 24 |
printf ("%A", d); /* { dg-warning "unknown|format" "%A is unsupported" } */ |
| 25 |
} |