From: Bruno Larsen <blarsen@redhat.com>
To: Tom Tromey <tom@tromey.com>,
Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/2] gdb/c++: Detect ambiguous variables in imported namespaces
Date: Fri, 11 Nov 2022 16:34:50 +0100 [thread overview]
Message-ID: <eef5e684-008f-309f-baf4-0b11273c7234@redhat.com> (raw)
In-Reply-To: <878rkk2gtt.fsf@tromey.com>
On 09/11/2022 18:11, Tom Tromey wrote:
>>>>>> "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?
Do you mean a message like the one below?
reference to "x" is ambiguous, possiblities are M::x and N::x
--
Cheers,
Bruno
>
> Tom
>
next prev parent reply other threads:[~2022-11-11 15:34 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
2022-11-11 15:34 ` Bruno Larsen [this message]
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=eef5e684-008f-309f-baf4-0b11273c7234@redhat.com \
--to=blarsen@redhat.com \
--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).