diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-06-07 14:22:13 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-06-09 11:06:53 +0200 |
commit | 53e04b3b780bbcf2dd3eb7990c17414742bbfef9 (patch) | |
tree | 4d270f603f533506d38f8b00c4cac3c7bb426c58 | |
parent | e44f724a5ce007ad789d4688a37d03c4845032c0 (diff) | |
download | sparse-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.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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: |