clarify post_type() VT_STORAGE handling by moving it out

master
Joe Soroka 2011-04-06 12:08:50 -07:00
parent ace0f7f259
commit 810aca9e68
1 changed files with 7 additions and 7 deletions

View File

@ -3168,11 +3168,9 @@ static void post_type(CType *type, AttributeDef *ad)
}
/* we push a anonymous symbol which will contain the function prototype */
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->next = first;
type->t = t1 | VT_FUNC;
type->t = VT_FUNC;
type->ref = s;
} else if (tok == '[') {
SValue *last_vtop = NULL;
@ -3182,6 +3180,7 @@ static void post_type(CType *type, AttributeDef *ad)
if (tok == TOK_RESTRICT1)
next();
n = -1;
t1 = 0;
if (tok != ']') {
gexpr();
if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
@ -3192,14 +3191,12 @@ static void post_type(CType *type, AttributeDef *ad)
} else {
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
error("size of variable length array should be an integer");
type->t |= VT_VLA;
t1 = VT_VLA;
last_vtop = vtop;
}
}
skip(']');
/* parse next post type */
t1 = type->t & (VT_STORAGE|VT_VLA);
type->t &= ~(VT_STORAGE|VT_VLA);
post_type(type, ad);
t1 |= type->t & VT_VLA;
@ -3227,7 +3224,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td)
{
Sym *s;
CType type1, *type2;
int qualifiers;
int qualifiers, storage;
while (tok == '*') {
qualifiers = 0;
@ -3279,7 +3276,10 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td)
*v = 0;
}
}
storage = type->t & VT_STORAGE;
type->t &= ~VT_STORAGE;
post_type(type, ad);
type->t |= storage;
if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)
parse_attribute(ad);