1 /* Test for printf formats. Formats using C99 features should be rejected
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
8 typedef __SIZE_TYPE__ size_t;
9 typedef __PTRDIFF_TYPE__ ptrdiff_t;
11 __extension__ typedef long long int llong;
13 /* This next definition is broken. When GCC has a <stdint.h> and
14 an internal understanding of intmax_t, it should be
15 replaced by an include of <stdint.h> or by a definition for internal
18 __extension__ typedef long long int intmax_t;
20 extern int printf (const char *, ...);
23 foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t)
25 /* Some tests already in c90-printf-1.c, e.g. %lf. */
26 /* The widths hh, ll, j, z, t are new. */
27 printf ("%hhd", i); /* { dg-warning "length|C" "%hh in C90" } */
28 printf ("%lld", ll); /* { dg-warning "length|C" "%ll in C90" } */
29 printf ("%jd", j); /* { dg-warning "length|C" "%j in C90" } */
30 printf ("%zu", z); /* { dg-warning "length|C" "%z in C90" } */
31 printf ("%td", t); /* { dg-warning "length|C" "%t in C90" } */
32 /* The formats F, a, A are new. */
33 printf ("%F", d); /* { dg-warning "C" "%F in C90" } */
34 printf ("%a", d); /* { dg-warning "C" "%a in C90" } */
35 printf ("%A", d); /* { dg-warning "C" "%A in C90" } */