This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH 18/348] Fix -Wsahdow warnings
>>>>> "Joel" == Joel Brobecker <firstname.lastname@example.org> writes:
Joel> As to the final decision of enabling -Wshadow by default, I agree
Joel> a little more to the idea, although not quite convinced yet. So far,
Joel> Eli is pro. Mark is against. I'm 50/50. Unless we get more feedback
Joel> from other GMs, you've done the work, we could at least try it and
Joel> see where that gets us.
I'm generally in favor of it.
I think it is unfortunate that it causes us to rename variables when
they clash in a way that is unimportant in practice. This is the
function-version-scalar issue that Mark points out.
However, I have also run across code in gdb where there is local
shadowing which has confused me (no example at hand though, sorry). I
would like to see these cleaned up.
On balance I don't really care that we have to rename some variables in
order to get rid of the bad code. There are plenty of names that are
equally clear as the ones already in the code.
Could we possibly mandate that -Wshadow only be used with a GCC that has
Alan Modra's patch in it?
Joel pinged it, and it went in, though I didn't see the actual patch:
Still, what it does is prevent the warning when shadowing something from
a system header. This seems decent to me and in particular will, I
think, largely address Mark's concerns.
All we'd need then is a bit of configury.