The function attribute 'externally_visible' is processed like a sort of storage modifiers but there is no reason for it (other than to avoid the problem with function attributes when returning a pointer) and can now be processed like the other function attributes. Fix this by processing it like other attributes modifiers and adding MOD_EXT_VISIBLE to MOD_FUN_ATTR. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- parse.c | 18 +++--------------- symbol.h | 3 +-- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/parse.c b/parse.c index 37ffede72..6cd420972 100644 --- a/parse.c +++ b/parse.c @@ -82,7 +82,6 @@ typedef struct token *attr_t(struct token *, struct symbol *, static attr_t attribute_packed, attribute_aligned, attribute_modifier, - attribute_ext_visible, attribute_bitwise, attribute_address_space, attribute_context, attribute_designated_init, @@ -375,10 +374,6 @@ static struct symbol_op attr_mod_op = { .attribute = attribute_modifier, }; -static struct symbol_op ext_visible_op = { - .attribute = attribute_ext_visible, -}; - static struct symbol_op attr_bitwise_op = { .attribute = attribute_bitwise, }; @@ -573,8 +568,8 @@ static struct init_keyword { {"const", NS_KEYWORD, MOD_PURE, .op = &attr_mod_op }, {"__const", NS_KEYWORD, MOD_PURE, .op = &attr_mod_op }, {"__const__", NS_KEYWORD, MOD_PURE, .op = &attr_mod_op }, - {"externally_visible", NS_KEYWORD, .op = &ext_visible_op }, - {"__externally_visible__", NS_KEYWORD, .op = &ext_visible_op }, + {"externally_visible", NS_KEYWORD, MOD_EXT_VISIBLE, .op = &attr_mod_op }, + {"__externally_visible__", NS_KEYWORD, MOD_EXT_VISIBLE, .op = &attr_mod_op }, { "mode", NS_KEYWORD, .op = &mode_op }, { "__mode__", NS_KEYWORD, .op = &mode_op }, @@ -1117,12 +1112,6 @@ static struct token *attribute_modifier(struct token *token, struct symbol *attr return token; } -static struct token *attribute_ext_visible(struct token *token, struct symbol *attr, struct decl_state *ctx) -{ - ctx->is_ext_visible = 1; - return token; -} - static struct token *attribute_bitwise(struct token *token, struct symbol *attr, struct decl_state *ctx) { if (Wbitwise) @@ -1360,8 +1349,7 @@ static unsigned long storage_modifiers(struct decl_state *ctx) [SRegister] = MOD_REGISTER }; return mod[ctx->storage_class] | (ctx->is_inline ? MOD_INLINE : 0) - | (ctx->is_tls ? MOD_TLS : 0) - | (ctx->is_ext_visible ? MOD_EXT_VISIBLE : 0); + | (ctx->is_tls ? MOD_TLS : 0); } static void set_storage_class(struct position *pos, struct decl_state *ctx, int class) diff --git a/symbol.h b/symbol.h index 516b61361..cc8ffd63b 100644 --- a/symbol.h +++ b/symbol.h @@ -108,7 +108,6 @@ struct decl_state { struct ident **ident; struct symbol_op *mode; unsigned char prefer_abstract, is_inline, storage_class, is_tls; - unsigned char is_ext_visible; }; struct symbol_op { @@ -252,7 +251,7 @@ struct symbol { /* modifiers preserved by typeof() operator */ #define MOD_TYPEOF (MOD_QUALIFIER | MOD_NOCAST | MOD_SPECIFIER) /* modifiers for funtion attributes */ -#define MOD_FUN_ATTR (MOD_PURE|MOD_NORETURN) +#define MOD_FUN_ATTR (MOD_PURE|MOD_NORETURN|MOD_EXT_VISIBLE) /* Current parsing/evaluation function */ -- 2.24.0