From b496110b16a66d0a28be3994284013374e5f9645 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 18 May 2020 22:26:28 +0200 Subject: attribute: 'inline' is just another 'declaration' modifier Now that the distinction is made between type modifiers and 'declaration' modifiers, there is no more reasons to parse this attribute differently than other attributes/modifiers. So, use the the generic code for 'declaration modifiers' to parse this attribute. Signed-off-by: Luc Van Oostenryck --- parse.c | 4 ++-- symbol.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/parse.c b/parse.c index 81b2116f..8e4be227 100644 --- a/parse.c +++ b/parse.c @@ -1399,7 +1399,7 @@ static unsigned long decl_modifiers(struct decl_state *ctx) }; unsigned long mods = ctx->ctype.modifiers & MOD_DECLARE; ctx->ctype.modifiers &= ~MOD_DECLARE; - return mod[ctx->storage_class] | (ctx->is_inline ? MOD_INLINE : 0) + return mod[ctx->storage_class] | (ctx->is_ext_visible ? MOD_EXT_VISIBLE : 0) | mods; } @@ -1475,7 +1475,7 @@ static struct token *attribute_force(struct token *token, struct symbol *attr, s static struct token *inline_specifier(struct token *next, struct decl_state *ctx) { - ctx->is_inline = 1; + apply_qualifier(&next->pos, &ctx->ctype, MOD_INLINE); return next; } diff --git a/symbol.h b/symbol.h index 95f90a5c..26f92ca7 100644 --- a/symbol.h +++ b/symbol.h @@ -108,7 +108,7 @@ struct decl_state { struct ident **ident; struct symbol_op *mode; unsigned long f_modifiers; // function attributes - unsigned char prefer_abstract, is_inline, storage_class; + unsigned char prefer_abstract, storage_class; unsigned char is_ext_visible; unsigned char autotype; }; @@ -264,7 +264,7 @@ struct symbol { /* do not warn when these are duplicated */ #define MOD_DUP_OK (MOD_UNUSED|MOD_GNU_INLINE) /* must be part of the declared symbol, not its type */ -#define MOD_DECLARE (MOD_STORAGE|MOD_TLS|MOD_GNU_INLINE|MOD_UNUSED|MOD_PURE|MOD_NORETURN|MOD_EXT_VISIBLE) +#define MOD_DECLARE (MOD_STORAGE|MOD_INLINE|MOD_TLS|MOD_GNU_INLINE|MOD_UNUSED|MOD_PURE|MOD_NORETURN|MOD_EXT_VISIBLE) -- cgit 1.2.3-korg