public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] Change location_to_sals to a method
Date: Wed, 1 Jun 2022 17:38:46 +0100	[thread overview]
Message-ID: <321dffd0-2c41-7c78-a24f-a920ff30afd6@palves.net> (raw)
In-Reply-To: <87a6ax6l75.fsf@tromey.com>

On 2022-06-01 05:50, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
> 
>>> int thread, task;
> 
> Pedro> These thread/task are masking the breakpoint fields, and then ...
> 
> Ugh, I even looked for this.
> 
> I looked at turning on -Wshadow instead of -Wshadow=local, since that
> would fix this problem.  It's a bit of a slog, and we'd be at the mercy
> of system headers too, but maybe we want to do this?

ISTR that we tried -Wshadow early on, and it ran into lots of issues with
system headers.  Like, e.g., there's a system function named "index" in strings.h,
which is easy to run into.  

And then there were also with issues with variables shadowing functions.

ISTR Alan filing a GCC bug about it, to ask to not warn about shadowing
system header stuff, or maybe it was about not warning about variables
shadowing functions.  

/me searches.

Ah, here, it was actually a GCC fix:

  https://gcc.gnu.org/legacy-ml/gcc-patches/2011-08/msg02017.html

That predates gcc 4.8, I think, our oldest supported GCC version,
so we can assume all GCCs have that.  

OTOH, I'm not sure that patch affects only the C frontend, or whether
that code is shared with the C++ frontend.  g++ maybe behaves differently,
but hopefully not.

AFAICS, bfd uses -Wshadow, not -Wshadow=local.

Searching in my gdb-patches folder, I found a ton of -Wshadow patches,
from Andrey Smirnov from back in 2011.  I had forgotten how many those were.
It was a series with over 300 patches.  I think in the end most were dropped,
for handling system header conflicts, which was found not worth it.

Maybe we could give -Wshadow another try.

> 
> Meanwhile I filed a gcc feature request to add a new -Wshadow that is
> like local but also handles data members:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105798
> 
> Tom
> 


  reply	other threads:[~2022-06-01 16:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28  2:42 [PATCH 0/3] More minor breakpoint cleanups Tom Tromey
2022-05-28  2:42 ` [PATCH 1/3] Change breakpoint_re_set_default to a method Tom Tromey
2022-05-30 15:32   ` Pedro Alves
2022-05-28  2:42 ` [PATCH 2/3] Change location_to_sals " Tom Tromey
2022-05-30 15:32   ` Pedro Alves
2022-06-01  4:50     ` Tom Tromey
2022-06-01 16:38       ` Pedro Alves [this message]
2022-06-10 21:34         ` Tom Tromey
2022-06-13 14:36           ` Pedro Alves
2022-08-14  0:44     ` Tom Tromey
2022-05-28  2:42 ` [PATCH 3/3] Move decode_location to code_breakpoint Tom Tromey
2022-05-30 15:42   ` Pedro Alves
2022-08-14  0:41     ` Tom Tromey
2022-08-14  0:45 ` [PATCH 0/3] More minor breakpoint cleanups Tom Tromey

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=321dffd0-2c41-7c78-a24f-a920ff30afd6@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).