| 1 |
/* Test for scanf 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 (signed char *hhp, float *fp, llong *llp, intmax_t *jp, |
| 13 |
size_t *zp, ptrdiff_t *tp) |
| 14 |
{ |
| 15 |
/* Some tests already in c90-scanf-1.c. */ |
| 16 |
/* The widths hh, ll, j, z, t are new. */ |
| 17 |
scanf ("%hhd", hhp); /* { dg-warning "unknown|format" "%hh is unsupported" } */ |
| 18 |
scanf ("%I64d", llp); /* { dg-warning "length|C" "%I64 in C90" } */ |
| 19 |
scanf ("%jd", jp); /* { dg-warning "unknown|format" "%j is unsupported" } */ |
| 20 |
scanf ("%zu", zp); /* { dg-warning "unknown|format" "%z is unsupported" } */ |
| 21 |
scanf ("%td", tp); /* { dg-warning "unknown|format" "%t is unsupported" } */ |
| 22 |
/* The formats F, a, A are new. */ |
| 23 |
scanf ("%F", fp); /* { dg-warning "unknown|format" "%F is unsupported" } */ |
| 24 |
scanf ("%a", fp); /* { dg-warning "unknown|format" "%a is unsupported" } */ |
| 25 |
scanf ("%A", fp); /* { dg-warning "unknown|format" "%A is unsupported" } */ |
| 26 |
} |