aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccgen.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tccgen.c b/tccgen.c
index c9629d4..48efdc3 100644
--- a/tccgen.c
+++ b/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 */
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);