Accept attributes after labels

newer GCC can associate attributes with statements and labels,
this implements only the latter (and ignores the attributes).
This commit is contained in:
Michael Matz 2022-07-08 17:06:05 +02:00
parent b077bc8ff7
commit 1da92cdd93
2 changed files with 11 additions and 0 deletions

View file

@ -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;

View file

@ -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()