This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Do not classify C struct members as a filename
- From: Tom Tromey <tom at tromey dot com>
- To: "Leszek Swirski via gdb-patches" <gdb-patches at sourceware dot org>
- Cc: Leszek Swirski <leszeks at google dot com>
- Date: Thu, 25 Jan 2018 09:00:01 -0700
- Subject: Re: [PATCH v2] Do not classify C struct members as a filename
- Authentication-results: sourceware.org; auth=none
- References: <20180124165107.186980-1-leszeks@google.com>
>>>>> "Leszek" == Leszek Swirski via gdb-patches <gdb-patches@sourceware.org> writes:
Leszek> There is existing logic in C/C++ expression parsing to avoid classifying
Leszek> names as a filename when they are a field on the this object. This
Leszek> change extends this logic to also avoid classifying names after a
Leszek> struct-op (-> or .) as a filename, which otherwise causes a syntax
Leszek> error.
Nice, thanks for doing this.
Leszek> - if (parse_completion && tokentab2[i].token == ARROW)
Leszek> + if (tokentab2[i].token == ARROW)
Leszek> - if (parse_completion)
Leszek> - last_was_structop = 1;
Leszek> + last_was_structop = 1;
This change makes sense (and thanks for updating that comment as well),
but I wonder whether this changes the behavior in some case. Elsewhere
in lex_one_token there is a check of saw_structop:
else if (saw_structop)
return COMPLETE;
Previously this return could only be taken if parse_completion was set,
but now I think it could be taken in other situations.
So, I suspect "parse_completion &&" should be stuck in there.
Tom