Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / format / ms_c90-printf-2.c
blobb5395588120da67774e0a090b13d6e2f911b5e17
1 /* Test for printf 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 { target { *-*-mingw* } } } */
6 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
8 #define USE_SYSTEM_FORMATS
9 #include "format.h"
11 void
12 foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t)
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" } */