aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorJoe Soroka <gits@joesoroka.com>2011-04-06 12:08:50 -0700
committerJoe Soroka <gits@joesoroka.com>2011-04-06 12:08:50 -0700
commit810aca9e68486eabe67ab8554817522ea9fe05ac (patch)
tree10c32e3b83018723078ed6f00e16b91e5540c43c /tccgen.c
parentace0f7f2598f5e9d9d2ad8999e3140b8535d9459 (diff)
downloadtinycc-810aca9e68486eabe67ab8554817522ea9fe05ac.tar.gz
tinycc-810aca9e68486eabe67ab8554817522ea9fe05ac.tar.bz2
clarify post_type() VT_STORAGE handling by moving it out
Diffstat (limited to 'tccgen.c')
-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);