This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Do not classify C struct members as a filename


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]