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 } */ 6/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ 7 8#include "format.h" 9 10void 11foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t) 12{ 13 /* Some tests already in c90-printf-1.c, e.g. %lf. */ 14 /* The widths hh, ll, j, z, t are new. */ 15 printf ("%hhd", i); /* { dg-warning "length|C" "%hh in C90" } */ 16 printf ("%lld", ll); /* { dg-warning "length|C" "%ll in C90" } */ 17 printf ("%jd", j); /* { dg-warning "length|C" "%j in C90" } */ 18 printf ("%zu", z); /* { dg-warning "length|C" "%z in C90" } */ 19 printf ("%td", t); /* { dg-warning "length|C" "%t in C90" } */ 20 /* The formats F, a, A are new. */ 21 printf ("%F", d); /* { dg-warning "C" "%F in C90" } */ 22 printf ("%a", d); /* { dg-warning "C" "%a in C90" } */ 23 printf ("%A", d); /* { dg-warning "C" "%A in C90" } */ 24} 25