Skip to content

Commit 53e04b3

Browse files
committed
allow show_token() on TOKEN_ZERO_IDENT
TOKEN_ZERO_IDENTs are created during the evaluation of pre-processor expressions but which otherwise are normal idents and were first tokenized as TOKEN_IDENTs. As such, they could perfectly be displayed by show_token() but are not. So, in error messages they are displayed as "unhandled token type '4'", which is not at all informative. Fix this by letting show_token() process them like usual TOKEN_IDENTs. Idem for quote_token(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e44f724 commit 53e04b3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎tokenize.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ const char *show_token(const struct token *token)
201201
return "end-of-input";
202202

203203
case TOKEN_IDENT:
204+
case TOKEN_ZERO_IDENT:
204205
return show_ident(token->ident);
205206

206207
case TOKEN_NUMBER:
@@ -259,6 +260,7 @@ const char *quote_token(const struct token *token)
259260
return "syntax error";
260261

261262
case TOKEN_IDENT:
263+
case TOKEN_ZERO_IDENT:
262264
return show_ident(token->ident);
263265

264266
case TOKEN_NUMBER:

0 commit comments

Comments
 (0)