diff options
author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-28 20:15:44 +0000 |
---|---|---|
committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-28 20:15:44 +0000 |
commit | c756cf835319b375aaec75b7cd686b5eda0d3224 (patch) | |
tree | 6274f9375b997efc3eddbe02d1129eb9900a95a9 /gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c | |
parent | aa267cf692d8164823858115027a41f20eb35b46 (diff) | |
download | gcc-c756cf835319b375aaec75b7cd686b5eda0d3224.tar.gz |
* gcc.dg/Wdeclaration-after-statement-1.c,
gcc.dg/Wdeclaration-after-statement-2.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69900 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c b/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c new file mode 100644 index 00000000000..0b573915ffe --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c @@ -0,0 +1,26 @@ +/* Test for -Wdeclaration-after-statement emitting warnings when no + standard-specifying option is given. See also c9?-mixdecl-*. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do run } */ +/* { dg-options "-Wdeclaration-after-statement" } */ + +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + int i = 0; + if (i != 0) + abort (); + i++; + if (i != 1) + abort (); + int j = i; /* { dg-warning "warning" "declaration after statement" } */ + if (j != 1) + abort (); + struct foo { int i0; } k = { 4 }; /* { dg-warning "warning" "declaration after statement" } */ + if (k.i0 != 4) + abort (); + exit (0); +} |