diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/format/ext-8.c | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/format/ext-8.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/format/ext-8.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/ext-8.c b/gcc/testsuite/gcc.dg/format/ext-8.c new file mode 100644 index 000000000..b50cc81d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/ext-8.c @@ -0,0 +1,56 @@ +/* Test for scanf formats. %m extensions. */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wformat" } */ + +#include "format.h" + +void +foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp) +{ + /* m assignment-allocation modifier, recognized in both C90 + and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ + scanf ("%ms", sp); + scanf ("%mS", lsp); + scanf ("%mls", lsp); + scanf ("%m[bcd]", sp); + scanf ("%ml[bcd]", lsp); + scanf ("%mc", sp); + scanf ("%mlc", lsp); + scanf ("%mC", lsp); + scanf ("%*ms"); + scanf ("%*mS"); + scanf ("%*mls"); /* { dg-warning "assignment suppression and length modifier" } */ + scanf ("%*m[bcd]"); + scanf ("%*ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ + scanf ("%*mc"); + scanf ("%*mlc"); /* { dg-warning "assignment suppression and length modifier" } */ + scanf ("%*mC"); + scanf ("%10ms", sp); + scanf ("%5mS", lsp); + scanf ("%9mls", lsp); + scanf ("%25m[bcd]", sp); + scanf ("%41ml[bcd]", lsp); + scanf ("%131mc", sp); + scanf ("%27mlc", lsp); + scanf ("%2mC", lsp); + scanf ("%*10ms"); + scanf ("%*5mS"); + scanf ("%*9mls"); /* { dg-warning "assignment suppression and length modifier" } */ + scanf ("%*25m[bcd]"); + scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ + scanf ("%*131mc"); + scanf ("%*27mlc"); /* { dg-warning "assignment suppression and length modifier" } */ + scanf ("%*2mC"); + + scanf ("%md", ip); /* { dg-warning "flag used with" } */ + scanf ("%mi", ip); /* { dg-warning "flag used with" } */ + scanf ("%mo", ip); /* { dg-warning "flag used with" } */ + scanf ("%mu", ip); /* { dg-warning "flag used with" } */ + scanf ("%mx", ip); /* { dg-warning "flag used with" } */ + scanf ("%ma", fp); /* { dg-warning "flag used with" } */ + scanf ("%mA", fp); /* { dg-warning "flag used with" } */ + scanf ("%me", fp); /* { dg-warning "flag used with" } */ + scanf ("%mf", fp); /* { dg-warning "flag used with" } */ + scanf ("%mg", fp); /* { dg-warning "flag used with" } */ + scanf ("%mp", pp); /* { dg-warning "flag used with" } */ +} |