annotate gcc/testsuite/gcc.dg/Wdeclaration-after-statement-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for -Wdeclaration-after-statement emitting warnings when no
kono
parents:
diff changeset
2 standard-specifying option is given. See also c9?-mixdecl-*. */
kono
parents:
diff changeset
3 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
kono
parents:
diff changeset
4 /* { dg-do run } */
kono
parents:
diff changeset
5 /* { dg-options "-Wdeclaration-after-statement" } */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 extern void abort (void);
kono
parents:
diff changeset
8 extern void exit (int);
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 int
kono
parents:
diff changeset
11 main (void)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 int i = 0;
kono
parents:
diff changeset
14 if (i != 0)
kono
parents:
diff changeset
15 abort ();
kono
parents:
diff changeset
16 i++;
kono
parents:
diff changeset
17 if (i != 1)
kono
parents:
diff changeset
18 abort ();
kono
parents:
diff changeset
19 int j = i; /* { dg-warning "" "declaration after statement" } */
kono
parents:
diff changeset
20 if (j != 1)
kono
parents:
diff changeset
21 abort ();
kono
parents:
diff changeset
22 struct foo { int i0; } k = { 4 }; /* { dg-warning "" "declaration after statement" } */
kono
parents:
diff changeset
23 if (k.i0 != 4)
kono
parents:
diff changeset
24 abort ();
kono
parents:
diff changeset
25 exit (0);
kono
parents:
diff changeset
26 }