From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 7/8] parse: improve error messages concerning storage specifiers
Date: Sun, 9 Aug 2020 18:52:28 +0200 [thread overview]
Message-ID: <20200809165229.36677-8-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200809165229.36677-1-luc.vanoostenryck@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
parse.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/parse.c b/parse.c
index fad41d36dda6..92ca1b66e140 100644
--- a/parse.c
+++ b/parse.c
@@ -1382,12 +1382,11 @@ static struct token *storage_specifier(struct token *next, struct symbol *sym, s
{
int is_tls = ctx->ctype.modifiers & MOD_TLS;
unsigned long class = sym->ctype.modifiers;
- const char *storage = modifier_string(class);
+ const char *storage = modifier_name(class);
/* __thread can be used alone, or with extern or static */
if (is_tls && (class & ~(MOD_STATIC|MOD_EXTERN))) {
- sparse_error(next->pos, "__thread can only be used alone, or with "
- "extern or static");
+ sparse_error(next->pos, "__thread cannot be used with '%s'", storage);
return next;
}
@@ -1406,8 +1405,8 @@ static struct token *thread_specifier(struct token *next, struct symbol *sym, st
if (!(ctx->storage_class & ~(MOD_STATIC|MOD_EXTERN))) {
apply_qualifier(&next->pos, &ctx->ctype, MOD_TLS);
} else {
- sparse_error(next->pos, "__thread can only be used alone, or "
- "with extern or static");
+ sparse_error(next->pos, "__thread cannot be used with '%s'",
+ modifier_name(ctx->storage_class));
}
return next;
--
2.28.0
next prev parent reply other threads:[~2020-08-09 16:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-09 16:52 [PATCH 0/8] simplify parsing of storage modifiers Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 1/8] show-mod: add helper to show the modifiers but without ending space Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 2/8] show-mod: no ending space when showing a single modifier Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 3/8] show-mod: no extra space when showing modifiers + ident Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 4/8] parse: rework handling of storage_class Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 5/8] parse: associate modifiers with their keyword Luc Van Oostenryck
2020-08-09 16:52 ` [PATCH 6/8] parse: let asm_modifier() use the keyword modifier Luc Van Oostenryck
2020-08-09 16:52 ` Luc Van Oostenryck [this message]
2020-08-09 16:52 ` [PATCH 8/8] parse: simplify set_storage_class() 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=20200809165229.36677-8-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/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 NNTP newsgroup(s).