comparison gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* PR 35058: -Werror= works only with some warnings. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c99 -pedantic -Werror=declaration-after-statement" } */
4 /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
5 extern void abort (void);
6 extern void exit (int);
7
8 int
9 main (void)
10 {
11 int i = 0;
12 if (i != 0)
13 abort ();
14 i++;
15 if (i != 1)
16 abort ();
17 int j = i; /* { dg-error "" "declaration-after-statement" } */
18 if (j != 1)
19 abort ();
20 struct foo { int i0; } k = { 4 }; /* { dg-error "" "declaration-after-statement" } */
21 if (k.i0 != 4)
22 abort ();
23 exit (0);
24 }