| 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 <[email protected]> */ |
| 5 |
/* { dg-do compile } */ |
| 6 |
/* { dg-options "-std=gnu89 -Wshadow" } */ |
| 7 |
|
| 8 |
int v; /* { dg-message "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-message "shadowed declaration" "outer parm" { target *-*-* } .-1 } */ |