diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-24 02:16:55 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-09 16:46:12 +0200 |
commit | 35c853cc17f32cac571480af6fd7883c9c128672 (patch) | |
tree | 0ef8afea60dcd20b904615887dd36ff8e3293e1e | |
parent | 9b4d0862315ec49673a5015bc79669f60eadff06 (diff) | |
download | sparse-35c853cc17f32cac571480af6fd7883c9c128672.tar.gz |
parse: improve error messages concerning storage specifiers
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | parse.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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; |