summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c b/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c
new file mode 100644
index 000000000..b9d3e38bc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c
@@ -0,0 +1,20 @@
+/* Test for scanf formats. Formats using extensions to the standard
+ should be rejected in strict pedantic mode.
+*/
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+/* { dg-do compile { target { *-*-mingw* } } } */
+/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
+
+#define USE_SYSTEM_FORMATS
+#include "format.h"
+
+void
+foo (char **sp, wchar_t **lsp)
+{
+ /* %a formats for allocation, only recognized in C90 mode, are a
+ GNU extension.
+ */
+ scanf ("%as", sp); /* { dg-warning "flag" "%as is unsupported" } */
+ scanf ("%aS", lsp); /* { dg-warning "format|flag" "%aS is unsupported" } */
+ scanf ("%a[bcd]", sp); /* { dg-warning "flag" "%a[] is unsupported" } */
+}