aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--symbol.c9
-rw-r--r--validation/function-redecl-funattr.c (renamed from validation/function-attribute-omitted.c)3
-rw-r--r--validation/function-redecl2.c3
3 files changed, 10 insertions, 5 deletions
diff --git a/symbol.c b/symbol.c
index 90149e5a..bafa7c43 100644
--- a/symbol.c
+++ b/symbol.c
@@ -588,6 +588,14 @@ struct symbol *befoul(struct symbol *type)
return NULL;
}
+static void inherit_declaration(struct symbol *sym, struct symbol *prev)
+{
+ unsigned long mods = prev->ctype.modifiers;
+
+ // inherit function attributes
+ sym->ctype.modifiers |= mods & MOD_FUN_ATTR;
+}
+
void check_declaration(struct symbol *sym)
{
int warned = 0;
@@ -598,6 +606,7 @@ void check_declaration(struct symbol *sym)
continue;
if (sym->scope == next->scope) {
sym->same_symbol = next;
+ inherit_declaration(sym, next);
return;
}
/* Extern in block level matches a TOPLEVEL non-static symbol */
diff --git a/validation/function-attribute-omitted.c b/validation/function-redecl-funattr.c
index 43b301d8..b1e2fb19 100644
--- a/validation/function-attribute-omitted.c
+++ b/validation/function-redecl-funattr.c
@@ -9,6 +9,5 @@ void __noreturn n(void);
void n(void) { while (1) ; }
/*
- * check-name: function-attribute-omitted
- * check-known-to-fail
+ * check-name: function-redecl-funattr
*/
diff --git a/validation/function-redecl2.c b/validation/function-redecl2.c
index 3435aa00..ef396137 100644
--- a/validation/function-redecl2.c
+++ b/validation/function-redecl2.c
@@ -25,7 +25,4 @@ void func2(int a)
/*
* check-name: function-redecl2
- *
- * check-known-to-fail
- *
*/