Re: Function pointer parameters and -Wshadow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ferenc Kovács <derefer@xxxxxxxxx> writes:

> 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...

There is no standard for -Wshadow.

I agree that this particular instance of the -Wshadow warning is
useless.  I encourage you to file a bug report about it.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux