diff --git a/tccgen.c b/tccgen.c index cc7cc9eb..daf489cf 100644 --- a/tccgen.c +++ b/tccgen.c @@ -7048,6 +7048,11 @@ again: s->cleanupstate = cur_scope->cl.s; block_after_label: + { + /* Accept attributes after labels (e.g. 'unused') */ + AttributeDef ad_tmp; + parse_attribute(&ad_tmp); + } vla_restore(cur_scope->vla.loc); if (tok != '}') goto again; diff --git a/tests/tests2/82_attribs_position.c b/tests/tests2/82_attribs_position.c index fd3f2c4e..d8c9fe5f 100644 --- a/tests/tests2/82_attribs_position.c +++ b/tests/tests2/82_attribs_position.c @@ -30,6 +30,12 @@ int ATTR actual_function() { return 42; } +int label_attribute (void) +{ +lab1: __attribute__((__unused__)); + return 0; +} + extern int printf (const char *, ...); static int globalvar; int main()