aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/format/c23-strftime-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/format/c23-strftime-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/format/c23-strftime-1.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/c23-strftime-1.c b/gcc/testsuite/gcc.dg/format/c23-strftime-1.c
new file mode 100644
index 0000000..80f2788
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c23-strftime-1.c
@@ -0,0 +1,15 @@
+/* Test for strftime formats. Formats using C23 features. */
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (char *s, size_t m, const struct tm *tp)
+{
+ strftime (s, m, "%Ob", tp);
+ strftime (s, m, "%OB", tp);
+ /* It's not clear that %h equivalence to %b means %Oh is equivalent
+ to %Ob; here we expect %Oh to be diagnosed. */
+ strftime (s, m, "%Oh", tp); /* { dg-warning "flag|modifier" "bad %Oh" } */
+}