Minor bug in -Wshadow
Not Your Average Joe
im14u2c@primenet.com
Mon Dec 7 00:07:00 GMT 1998
Hello,
I seem to have found a minor problem with -Wshadow in egcs 1.1b.
The following code evokes a warning, but I don't believe it should:
#include <stdio.h>
int main(void)
{
int var;
int foo(int var); /* this causes a warning, but shouldn't */
var = foo(42);
printf("var = %d\n", var);
return 0;
}
int foo(int var)
{
return var;
}
When I run this through "egcs -Wshadow", I get the following warning:
foo.c: In function `main':
foo.c:6: warning: declaration of `var' shadows previous local
The parameter name "var" in the prototype for "foo()" is not actually
a declaration, and so this warning is in error.
Regards,
--Joe
--
------------------------------------------------------------------------------
Joseph Zbiciak http://www.primenet.com/~im14u2c Not your average "Joe"
R$+@$=W <-- sendmail.cf {$/{{.+ <-- modem noise
!@#!@@! <-- Mr. Dithers swearing Zbiciak <-- Joe's last name
------------------------------------------------------------------------------
More information about the Gcc-bugs
mailing list