OSDN Git Service

2011-08-25 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / Wshadow-3.c
1 /* Test warnings for shadowing in function prototype scope: generally
2    useless but of use if the parameter is used within the scope.  Bug
3    529.  */
4 /* Origin: Joseph Myers <joseph@codesourcery.com> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=gnu89 -Wshadow" } */
7
8 int v; /* { dg-warning "shadowed declaration" } */
9 int f1(int v);
10 int f2(int v, int x[v]); /* { dg-warning "declaration of 'v' shadows a global declaration" } */
11 int f3(int v, int y[sizeof(v)]); /* { dg-warning "declaration of 'v' shadows a global declaration" } */
12 int f4(int v) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */
13 int f5(int v, int x[v]) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */
14 int f6(int x) { return 0; }
15 int f7(v) int v; { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */
16 int f8(v, w) int v; int w[v]; { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */
17 int f9(x) int x; { return 0; }
18 int f10(v) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */
19 int f11(int a, int b(int a));
20 int f12(int a, int b(int a, int x[a])); /* { dg-warning "declaration of 'a' shadows a parameter" } */
21 /* { dg-warning "shadowed declaration" "outer parm" { target *-*-* } 20 } */