mirror of
https://github.com/frida/tinycc
synced 2024-11-30 19:43:07 +03:00
clarify post_type() VT_STORAGE handling by moving it out
This commit is contained in:
parent
ace0f7f259
commit
810aca9e68
14
tccgen.c
14
tccgen.c
@ -3168,11 +3168,9 @@ static void post_type(CType *type, AttributeDef *ad)
|
|||||||
}
|
}
|
||||||
/* we push a anonymous symbol which will contain the function prototype */
|
/* we push a anonymous symbol which will contain the function prototype */
|
||||||
ad->func_args = arg_size;
|
ad->func_args = arg_size;
|
||||||
t1 = type->t & VT_STORAGE;
|
|
||||||
type->t &= ~VT_STORAGE;
|
|
||||||
s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);
|
s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);
|
||||||
s->next = first;
|
s->next = first;
|
||||||
type->t = t1 | VT_FUNC;
|
type->t = VT_FUNC;
|
||||||
type->ref = s;
|
type->ref = s;
|
||||||
} else if (tok == '[') {
|
} else if (tok == '[') {
|
||||||
SValue *last_vtop = NULL;
|
SValue *last_vtop = NULL;
|
||||||
@ -3182,6 +3180,7 @@ static void post_type(CType *type, AttributeDef *ad)
|
|||||||
if (tok == TOK_RESTRICT1)
|
if (tok == TOK_RESTRICT1)
|
||||||
next();
|
next();
|
||||||
n = -1;
|
n = -1;
|
||||||
|
t1 = 0;
|
||||||
if (tok != ']') {
|
if (tok != ']') {
|
||||||
gexpr();
|
gexpr();
|
||||||
if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
|
if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
|
||||||
@ -3192,14 +3191,12 @@ static void post_type(CType *type, AttributeDef *ad)
|
|||||||
} else {
|
} else {
|
||||||
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
|
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
|
||||||
error("size of variable length array should be an integer");
|
error("size of variable length array should be an integer");
|
||||||
type->t |= VT_VLA;
|
t1 = VT_VLA;
|
||||||
last_vtop = vtop;
|
last_vtop = vtop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
skip(']');
|
skip(']');
|
||||||
/* parse next post type */
|
/* parse next post type */
|
||||||
t1 = type->t & (VT_STORAGE|VT_VLA);
|
|
||||||
type->t &= ~(VT_STORAGE|VT_VLA);
|
|
||||||
post_type(type, ad);
|
post_type(type, ad);
|
||||||
t1 |= type->t & VT_VLA;
|
t1 |= type->t & VT_VLA;
|
||||||
|
|
||||||
@ -3227,7 +3224,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td)
|
|||||||
{
|
{
|
||||||
Sym *s;
|
Sym *s;
|
||||||
CType type1, *type2;
|
CType type1, *type2;
|
||||||
int qualifiers;
|
int qualifiers, storage;
|
||||||
|
|
||||||
while (tok == '*') {
|
while (tok == '*') {
|
||||||
qualifiers = 0;
|
qualifiers = 0;
|
||||||
@ -3279,7 +3276,10 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td)
|
|||||||
*v = 0;
|
*v = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
storage = type->t & VT_STORAGE;
|
||||||
|
type->t &= ~VT_STORAGE;
|
||||||
post_type(type, ad);
|
post_type(type, ad);
|
||||||
|
type->t |= storage;
|
||||||
if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)
|
if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)
|
||||||
parse_attribute(ad);
|
parse_attribute(ad);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user