annotate gcc/testsuite/gcc.dg/format/c99-strftime-2.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for strftime formats. Rejection of extensions in pedantic mode. */
kono
parents:
diff changeset
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
kono
parents:
diff changeset
3 /* { dg-do compile } */
kono
parents:
diff changeset
4 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 #include "format.h"
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 void
kono
parents:
diff changeset
9 foo (char *s, size_t m, const struct tm *tp)
kono
parents:
diff changeset
10 {
kono
parents:
diff changeset
11 /* %P is a lowercase version of %p. */
kono
parents:
diff changeset
12 strftime (s, m, "%P", tp); /* { dg-warning "C" "strftime %P" } */
kono
parents:
diff changeset
13 /* %k is %H but padded with a space rather than 0 if necessary. */
kono
parents:
diff changeset
14 strftime (s, m, "%k", tp); /* { dg-warning "C" "strftime %k" } */
kono
parents:
diff changeset
15 /* %l is %I but padded with a space rather than 0 if necessary. */
kono
parents:
diff changeset
16 strftime (s, m, "%l", tp); /* { dg-warning "C" "strftime %l" } */
kono
parents:
diff changeset
17 /* %s is the number of seconds since the Epoch. */
kono
parents:
diff changeset
18 strftime (s, m, "%s", tp); /* { dg-warning "C" "strftime %s" } */
kono
parents:
diff changeset
19 /* Extensions using %O already tested in c99-strftime-1.c. */
kono
parents:
diff changeset
20 /* Width and flags are GNU extensions for strftime. */
kono
parents:
diff changeset
21 strftime (s, m, "%20Y", tp); /* { dg-warning "C" "strftime width" } */
kono
parents:
diff changeset
22 strftime (s, m, "%^A", tp); /* { dg-warning "C" "strftime flags" } */
kono
parents:
diff changeset
23 }