gcc/testsuite/gcc.dg/format/c23-strftime-1.c
raw| 1 | /* Test for strftime formats. Formats using C23 features. */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-std=c23 -pedantic -Wformat" } */ |
| 4 | |
| 5 | #include "format.h" |
| 6 | |
| 7 | void |
| 8 | foo (char *s, size_t m, const struct tm *tp) |
| 9 | { |
| 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" } */ |
| 15 | } |