* config/xtensa/xtensa.c (function_arg): Generalize logic so that it
[official-gcc.git] / gcc / testsuite / gcc.dg / Wdeclaration-after-statement-2.c
blob5aa3e5d1388806a0bff82c4236bad2978bc761e6
1 /* Test for C99 mixed declarations and code giving warnings, not error with
2 -Wdeclaration-after-statement. See also c9?-mixdecl-*. */
3 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
4 /* { dg-do run } */
5 /* { dg-options "-std=c99 -pedantic-errors -Wdeclaration-after-statement" } */
7 extern void abort (void);
8 extern void exit (int);
10 int
11 main (void)
13 int i = 0;
14 if (i != 0)
15 abort ();
16 i++;
17 if (i != 1)
18 abort ();
19 int j = i; /* { dg-warning "warning" "declaration-after-statement" } */
20 if (j != 1)
21 abort ();
22 struct foo { int i0; } k = { 4 }; /* { dg-warning "warning" "declaration-after-statement" } */
23 if (k.i0 != 4)
24 abort ();
25 exit (0);