Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
	       gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 18/348] Fix -Wsahdow warnings
Date: Wed, 30 Nov 2011 14:59:00 -0000	[thread overview]
Message-ID: <m3ty5lirlh.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAHQ1cqEBOw9hYZxUKXH+hZiusXM+09vbSsNTMz32QgvrdPd5hw@mail.gmail.com>	(Andrey Smirnov's message of "Wed, 30 Nov 2011 09:47:47 +0600")

>>>>> "Andrey" == Andrey Smirnov <andrew.smirnov@gmail.com> writes:

Andrey> I know I probably should go to GCC mailing list and ask that question
Andrey> there, but anyways, would this patch cause gcc to stop generating the
Andrey> warning about local variable shadowing global one from system headers?

Yeah, that's what it does.

Andrey> I hope that kinds of shadowing would still be detectable even with this
Andrey> patch applied.

Why is that?

I do think the GCC patch could probably be better.  That is, I think a
slightly different rule would be an improvement, something like
"generally do not warn about shadowing things declared in system
headers, except if a local function pointer variable shadows a system
function".  That would eliminate the potential for some kinds of bugs.

Tom> Still, what it does is prevent the warning when shadowing something from
Tom> a system header.  This seems decent to me and in particular will, I
Tom> think, largely address Mark's concerns.

Andrey> It would pretty much solve that problem, yes, but still it would
Andrey> divide patch submitters into two groups those who have newest gcc and
Andrey> -Wshadow enabled by default, and those who don't. And the people
Andrey> without -Wshadow enabled compilers would be, on occasion, breaking the
Andrey> build because they have no means to check for -Wshadow caused errors.
Andrey> I hope I missing something and it is not the case, but that how the
Andrey> things seems to me now.

Yes, I think it would result in some periodic breakage until the newer
GCC is widely distributed.  I'm willing to put up with that.  We already
put up with it, in a way, due to other GCC differences... see the
uninitialized variable patches or FORTIFY_SOURCE patches that go in from
time to time.

If the configury part is set up properly, then this warning will simply
auto-enable for people when they upgrade GCC.  So, it isn't like we'll
just forget about it; more like at some point we'll all be joining in :)

Tom


  reply	other threads:[~2011-11-30 14:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 13:01 Andrey Smirnov
2011-11-22 18:03 ` Tom Tromey
2011-11-23 16:36 ` Mark Kettenis
2011-11-23 16:41   ` Ulrich Weigand
2011-11-23 18:21     ` Pedro Alves
2011-11-23 18:42       ` Joel Brobecker
2011-11-23 20:24       ` Mark Kettenis
2011-11-24  4:16         ` Andrey Smirnov
2011-11-24 11:36           ` Eli Zaretskii
2011-11-24 22:01           ` Joel Brobecker
2011-11-25  0:48             ` Andrey Smirnov
2011-11-25 14:26               ` Joel Brobecker
2011-11-25 15:52                 ` About adding -Wshadow option by default (was Re: [PATCH 18/348] Fix -Wsahdow warnings) Pierre Muller
2011-11-25 16:36                   ` Mark Kettenis
2011-11-29 19:18                 ` [PATCH 18/348] Fix -Wsahdow warnings Tom Tromey
2011-11-30  3:48                   ` Andrey Smirnov
2011-11-30 14:59                     ` Tom Tromey [this message]
2011-12-01  4:15                       ` Andrey Smirnov
2011-12-02 17:08                         ` Tom Tromey
2011-11-25 12:03             ` Eli Zaretskii
2011-11-25 15:11               ` Mark Kettenis
2011-11-25 15:41                 ` Eli Zaretskii
2011-11-25 16:26                   ` Mark Kettenis
2011-11-25 18:20                     ` Eli Zaretskii
2011-11-27 13:53                       ` Mark Kettenis
2011-11-27 14:55                         ` Pedro Alves
2011-11-27 16:35                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ty5lirlh.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox