Hello,
On Thu, 22 Feb 2024, Jakub Jelinek wrote:
> So, the following patch adds a flag during preprocessing at the point
> where we normally create CPP_SCOPE tokens out of 2 consecutive colons
> on the first CPP_COLON to mark the consecutive case (as we are tight
> on the bits, I've reused the PURE_ZERO flag, which is used just by the
> C++ FE and only ever set (both C and C++) on CPP_NUMBER tokens, this
> new flag has the same value and is only ever used on CPP_COLON tokens)
Hmm, shouldn't you be able to use (nonexistence of) the PREV_WHITE flag on
the second COLON token to see that it's indeed a '::' without intervening
whitespace? Instead of setting a new flag on the first COLON token?
I.e. something like this:
if (c_parser_next_token_is (parser, CPP_SCOPE)
- || (loose_scope_p
- && c_parser_next_token_is (parser, CPP_COLON)
&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
+ && !(c_parser_peek_2nd_token (parser)->flags & PREV_WHITE)))
?
Ciao,
Michael.