mirror of
https://github.com/mirror/tinycc.git
synced 2026-08-22 11:23:27 +08:00
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:
1
tccpp.c
1
tccpp.c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user