aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-24 02:16:55 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-09 16:46:12 +0200
commit35c853cc17f32cac571480af6fd7883c9c128672 (patch)
tree0ef8afea60dcd20b904615887dd36ff8e3293e1e
parent9b4d0862315ec49673a5015bc79669f60eadff06 (diff)
downloadsparse-35c853cc17f32cac571480af6fd7883c9c128672.tar.gz
parse: improve error messages concerning storage specifiers
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/parse.c b/parse.c
index fad41d36..92ca1b66 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;