diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-25 23:03:23 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-09 16:46:14 +0200 |
commit | f31c401c5f036231e4e07bb08f57ce2d027b0831 (patch) | |
tree | bd7fb6ebcf8a7ec212e503c5ecb019f8c4048087 | |
parent | 35c853cc17f32cac571480af6fd7883c9c128672 (diff) | |
download | sparse-f31c401c5f036231e4e07bb08f57ce2d027b0831.tar.gz |
parse: simplify set_storage_class()
The second test is now made as the else part of the first test,
saving a 'return' that is otherwise not needed.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | parse.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -1385,12 +1385,9 @@ static struct token *storage_specifier(struct token *next, struct symbol *sym, s const char *storage = modifier_name(class); /* __thread can be used alone, or with extern or static */ - if (is_tls && (class & ~(MOD_STATIC|MOD_EXTERN))) { + if (is_tls && (class & ~(MOD_STATIC|MOD_EXTERN))) sparse_error(next->pos, "__thread cannot be used with '%s'", storage); - return next; - } - - if (!ctx->storage_class) + else if (!ctx->storage_class) ctx->storage_class = class; else if (ctx->storage_class == class) sparse_error(next->pos, "duplicate %s", storage); |