public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
Cc: Bruno Larsen <blarsen@redhat.com>
Subject: Re: [PATCH 2/2] gdb/c++: Detect ambiguous variables in imported namespaces
Date: Wed, 09 Nov 2022 10:11:42 -0700	[thread overview]
Message-ID: <878rkk2gtt.fsf@tromey.com> (raw)
In-Reply-To: <20221026155053.3394792-3-blarsen@redhat.com> (Bruno Larsen via Gdb-patches's message of "Wed, 26 Oct 2022 17:50:54 +0200")

>>>>> "Bruno" == Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:

Bruno> This commit makes it so instead of exiting early when finding any symbol
Bruno> with the correct name, GDB continues searching through include
Bruno> directives until it finds another symbol with the same name but a
Bruno> different mangled name - returning an ambiguous variable - or goes
Bruno> through all imported namespaces and returns zero or one matching symbols.

Thanks.  This idea makes sense to me.

Bruno> +  const char* sym_name = nullptr;

Wrong "*" placement.

Bruno> +		  if(sym_name == nullptr)

Missing space.

Bruno> +		    {
Bruno> +		      saved_sym = sym;
Bruno> +		      sym_name = saved_sym.symbol->m_name;
Bruno> +		      sym = {};
Bruno> +		    }
Bruno> +		  else if (strcmp(sym_name, sym.symbol->m_name) != 0)

Here too.  There is at least one more of these as well.

Bruno> +		    error (_("reference to \"%s\" is ambiguous"), name);

It would be more friendly to users if it printed the full names of the
ambiguous symbols... is that possible?

Tom

  reply	other threads:[~2022-11-09 17:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 15:50 [PATCH 0/2] Improve handling of using directives Bruno Larsen
2022-10-26 15:50 ` [PATCH 1/2] gdb/c++: validate 'using' directives based on the current line Bruno Larsen
2022-11-09 17:03   ` Tom Tromey
2022-11-11 14:44   ` Andrew Burgess
2022-10-26 15:50 ` [PATCH 2/2] gdb/c++: Detect ambiguous variables in imported namespaces Bruno Larsen
2022-11-09 17:11   ` Tom Tromey [this message]
2022-11-11 15:34     ` Bruno Larsen
2022-11-11 16:37       ` Tom Tromey
2022-11-11 14:30   ` Andrew Burgess

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=878rkk2gtt.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=blarsen@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).