diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/format/ext-4.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/format/ext-4.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/ext-4.c b/gcc/testsuite/gcc.dg/format/ext-4.c new file mode 100644 index 0000000..c0cf740 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/ext-4.c @@ -0,0 +1,20 @@ +/* Test for scanf formats. %a extensions. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu89 -Wformat" } */ + +typedef __WCHAR_TYPE__ wchar_t; + +extern int scanf (const char *, ...); + +void +foo (char **sp, wchar_t **lsp) +{ + /* %a formats for allocation, only recognised in C90 mode, are a + GNU extension. Followed by other characters, %a is not treated + specially. + */ + scanf ("%as", sp); + scanf ("%aS", lsp); + scanf ("%a[bcd]", sp); +} |