aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-18 22:26:28 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-19 01:25:53 +0200
commitb496110b16a66d0a28be3994284013374e5f9645 (patch)
tree7057e98eec6431e8d26f15cb022ba2cbdc7afaed
parent185572dd1d9eb2afb5d3f33000ad149d96b16ec0 (diff)
downloadsparse-b496110b16a66d0a28be3994284013374e5f9645.tar.gz
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 <luc.vanoostenryck@gmail.com>
-rw-r--r--parse.c4
-rw-r--r--symbol.h4
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)