2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / format / c99-strftime-2.c
blob747faa2c22caa73cf2a24d071630c54ed64d5069
1 /* Test for strftime formats. Rejection of extensions in pedantic mode. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
6 #include "format.h"
8 void
9 foo (char *s, size_t m, const struct tm *tp)
11 /* %P is a lowercase version of %p. */
12 strftime (s, m, "%P", tp); /* { dg-warning "C" "strftime %P" } */
13 /* %k is %H but padded with a space rather than 0 if necessary. */
14 strftime (s, m, "%k", tp); /* { dg-warning "C" "strftime %k" } */
15 /* %l is %I but padded with a space rather than 0 if necessary. */
16 strftime (s, m, "%l", tp); /* { dg-warning "C" "strftime %l" } */
17 /* %s is the number of seconds since the Epoch. */
18 strftime (s, m, "%s", tp); /* { dg-warning "C" "strftime %s" } */
19 /* Extensions using %O already tested in c99-strftime-1.c. */
20 /* Width and flags are GNU extensions for strftime. */
21 strftime (s, m, "%20Y", tp); /* { dg-warning "C" "strftime width" } */
22 strftime (s, m, "%^A", tp); /* { dg-warning "C" "strftime flags" } */