1 /* Test for printf formats. Formats using extensions to the standard
2 should be rejected in strict pedantic mode.
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile { target { *-*-mingw* } } } */
6 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
8 #define USE_SYSTEM_FORMATS
12 foo (int i
, long long ll
, size_t z
, wint_t lc
, wchar_t *ls
)
14 /* The length modifiers q, Z and L as applied to integer formats are
17 printf ("%qd", ll
); /* { dg-warning "unknown|format" "%q length is unsupported" } */
18 printf ("%Ld", ll
); /* { dg-warning "unknown|format" "%L length is unsupported" } */
19 printf ("%Zd", z
); /* { dg-warning "unknown|format" "%Z length is unsupported" } */
20 /* The conversion specifiers C and S are X/Open extensions; the
21 conversion specifier m is a GNU extension.
23 printf ("%m"); /* { dg-warning "unknown" "printf %m is unsupported" } */
24 printf ("%C", lc
); /* { dg-warning "C" "printf %C" } */
25 printf ("%S", ls
); /* { dg-warning "C" "printf %S" } */
26 /* The flag character ', and the use of operand number $ formats, are
29 printf ("%'d", i
); /* { dg-warning "C" "printf ' flag" } */
30 printf ("%1$d", i
); /* { dg-warning "C" "printf $ format" } */
31 printf ("%Ix", z
); /* { dg-warning "C" "printf I format" } */