This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix -Wshadow warning in libiberty/cp-demangle.c
- From: Mark Wielaard <mjw at redhat dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Paolo Bonzini <bonzini at gnu dot org>
- Date: Sat, 10 Sep 2016 12:39:32 +0200
- Subject: Re: [PATCH] Fix -Wshadow warning in libiberty/cp-demangle.c
- Authentication-results: sourceware.org; auth=none
- References: <1473466003-19517-1-git-send-email-mjw@redhat.com> <CAKOQZ8zU6NOkwo+9_p=Dn_xp9eh-NuqzAiWDfM6fBrejn=hqyg@mail.gmail.com>
On Sat, Sep 10, 2016 at 01:57:54AM -0700, Ian Lance Taylor wrote:
> On Fri, Sep 9, 2016 at 5:06 PM, Mark Wielaard <mjw@redhat.com> wrote:
> > 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.
OK, pushed with just the cp-demangle.c fix.
We'll pick up and shadow warnings when we update the valgrind copy again.
Cheers,
Mark