aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-07 14:22:13 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-09 11:06:53 +0200
commit53e04b3b780bbcf2dd3eb7990c17414742bbfef9 (patch)
tree4d270f603f533506d38f8b00c4cac3c7bb426c58
parente44f724a5ce007ad789d4688a37d03c4845032c0 (diff)
downloadsparse-53e04b3b780bbcf2dd3eb7990c17414742bbfef9.tar.gz
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>
-rw-r--r--tokenize.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tokenize.c b/tokenize.c
index ea710543..fdaea370 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -201,6 +201,7 @@ const char *show_token(const struct token *token)
return "end-of-input";
case TOKEN_IDENT:
+ case TOKEN_ZERO_IDENT:
return show_ident(token->ident);
case TOKEN_NUMBER:
@@ -259,6 +260,7 @@ const char *quote_token(const struct token *token)
return "syntax error";
case TOKEN_IDENT:
+ case TOKEN_ZERO_IDENT:
return show_ident(token->ident);
case TOKEN_NUMBER: