Add gcc attribute cleanup support

The major difficulty was to handle cleanup when a goto happen
to do so, I've had a "ScopeTracker" struct.
I can't use local_scope because that would not work with code like below
as local_scope would be at the same level:

{
    char * __attribute__ ((cleanup(clean_function))) str = "hej";
    goto next;
}
{
    next:
}
This commit is contained in:
matthias
2018-12-20 10:55:22 +01:00
parent f6be0d483b
commit 0d91ba749c
4 changed files with 278 additions and 30 deletions

View File

@@ -1367,6 +1367,7 @@ ST_FUNC Sym *label_push(Sym **ptop, int v, int flags)
Sym *s, **ps;
s = sym_push2(ptop, v, 0, 0);
s->r = flags;
s->scope = scope_tracker;
ps = &table_ident[v - TOK_IDENT]->sym_label;
if (ptop == &global_label_stack) {
/* modify the top most local identifier, so that