c-family: Support format checking C2X %b, %B formats
[official-gcc.git] / gcc / testsuite / gcc.dg / format / c2x-strftime-1.c
blobc6e7619e8a455bd68809e07451a4b8ef0bafa30f
1 /* Test for strftime formats. Formats using C2x features. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c2x -pedantic -Wformat" } */
5 #include "format.h"
7 void
8 foo (char *s, size_t m, const struct tm *tp)
10 strftime (s, m, "%Ob", tp);
11 strftime (s, m, "%OB", tp);
12 /* It's not clear that %h equivalence to %b means %Oh is equivalent
13 to %Ob; here we expect %Oh to be diagnosed. */
14 strftime (s, m, "%Oh", tp); /* { dg-warning "flag|modifier" "bad %Oh" } */