From: Luc Van Oostenryck <lucvoo@kernel.org>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] allow show_token() on TOKEN_ZERO_IDENT
Date: Tue, 7 Jun 2022 14:54:41 +0200 [thread overview]
Message-ID: <20220607125441.36757-1-lucvoo@kernel.org> (raw)
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
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>
---
tokenize.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tokenize.c b/tokenize.c
index ea7105438270..fdaea370cc48 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:
--
2.36.1
next reply other threads:[~2022-06-07 12:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 12:54 Luc Van Oostenryck [this message]
2022-06-07 18:26 ` [PATCH] allow show_token() on TOKEN_ZERO_IDENT Linus Torvalds
2022-06-07 20:48 ` Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220607125441.36757-1-lucvoo@kernel.org \
--to=lucvoo@kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).