On Fri, Sep 9, 2016 at 5:06 PM, Mark Wielaard <m...@redhat.com> wrote:
> valgrind contains a copy of the libiberty demangler which gets compiled
> with -Wshadow. That shows the following warning:
>
> cp-demangle.c: In function ‘d_substitution’:
> cp-demangle.c:3772:35: warning: declaration of ‘c’ shadows a previous local
>         struct demangle_component *c;
>                                    ^
> cp-demangle.c:3708:8: note: shadowed declaration is here
>    char c;
>         ^
>
> Fix that by renaming the struct demangle_component variable to dc
> and add -Wshadow to ac_libiberty_warn_cflags (the only warning is this one).
>
> libiberty/ChangeLog:
>
>         * cp-demangle.c (d_substitution): Change struct demangle_component
>         variable name from c to dc.
>         * configure.ac (ac_libiberty_warn_cflags): Add -Wshadow.
>         * configure: Regenerate.

The patch to cp-demangle.c is OK.  Thanks.

I'm not sure about the patch to configure.ac/configure.  The last I
looked -Wshadow would warn if a local variable shadows a global
variable.  That can cause a pointless build break if some system
header file defines a global variable that happens to have the same
name as a local variable.  It's not a likely scenario but I don't see
a need to court a build breakage.

Ian

Reply via email to