Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / format / c90-scanf-2.c
blob52c08921ef9daf4b93ec5a7788af09cac5b501bb
1 /* Test for scanf formats. Formats using C99 features should be rejected
2 outside of C99 mode.
3 */
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
8 #include "format.h"
10 void
11 foo (signed char *hhp, float *fp, llong *llp, intmax_t *jp,
12 size_t *zp, ptrdiff_t *tp)
14 /* Some tests already in c90-scanf-1.c. */
15 /* The widths hh, ll, j, z, t are new. */
16 scanf ("%hhd", hhp); /* { dg-warning "length|C" "%hh in C90" } */
17 scanf ("%lld", llp); /* { dg-warning "length|C" "%ll in C90" } */
18 scanf ("%jd", jp); /* { dg-warning "length|C" "%j in C90" } */
19 scanf ("%zu", zp); /* { dg-warning "length|C" "%z in C90" } */
20 scanf ("%td", tp); /* { dg-warning "length|C" "%t in C90" } */
21 /* The formats F, a, A are new. */
22 scanf ("%F", fp); /* { dg-warning "C" "%F in C90" } */
23 scanf ("%a", fp); /* { dg-warning "C" "%a in C90" } */
24 scanf ("%A", fp); /* { dg-warning "C" "%A in C90" } */