This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding -Wshadow to binutils builds


2009/12/11 Nick Clifton <nickc@redhat.com>:
> Hi Guys,
>
> ?Last week I ran across a nasty bug in the MN10300 port due to one
> ?local variable shadowing another. ?As I was fixing it I realised
> ?that the problem would have been found a lot earlier if we had
> ?-Wshadow specified on the gcc command line when building the
> ?binutils. ?So I have spent the rest of the week adding this switch
> ?and then fixing up all of the new warning messages that arise. ?The
> ?result is the attached patch (warning: large) which I plan to apply
> ?later on today.

Wait, stop.  Sorry I didn't look at the patch earlier--my mailer doesn't pull
apart LZMA files.  -Wshadow is far too aggressive.  It should not give a warning
when a local variable shadows a globally declared function.  That just exposes
our local variable names to the vagaries of global functions declared in header
files.

I just looked at some of the gold changes, and some of them seem to me to be
undesirable.  I don't want all my shndx local variables renamed to sec_shndx.
The name shndx is simple and there is no possible confusion when using it.

I appreciate that there is a real problem here but this solution is
going to make
our code harder to read, not easier, and it's going to be an ongoing issue as
system header files change.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]