This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Function pointer parameters and -Wshadow
- From: Ferenc KovÃcs <derefer at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 15 Mar 2009 13:29:20 +0100
- Subject: Function pointer parameters and -Wshadow
Hi,
When I compile a header with g++ trunk on x86_64 using -Wshadow containing
function declarations like this:
int g(int a, int (*b)(int a));
/* Originally, I found it in openssl's bn.h BN_BLINDING_create_param() and I
got a bunch of warnings from all .cc files including this header. */
I get:
shadow.h:2: warning: declaration of 'int a' shadows a parameter
shadow.h:2: warning: shadowed declaration is here
I don't see the reason for this warning, because the parameters of the second
parameter `b' AFAIK have nothing to do with parameters of the original
function `g'. (With gcc -Wshadow it compiles with no warnings.)
It seems to me, that the warning is present from g++ 4.4 revision 140120,
which was a fix for PR37302.
Is it the expected behavior? I haven't checked the standard yet...
Thanks in advance.
Regards,
Ferenc