History

clarify post_type() VT_STORAGE handling by moving it out

Joe Soroka committed 15 years ago

Commit 810aca91 parent ace0f7f1 file · +7 −7Browse files

Unified · Split

tccgen.c+7−7
@@ -3168,11 +3168,9 @@ static void post_type(CType *type, AttributeDef *ad) · 3167 unmodified lines
3168 }3168 }
3169 /* we push a anonymous symbol which will contain the function prototype */3169 /* we push a anonymous symbol which will contain the function prototype */
3170 ad->func_args = arg_size;3170 ad->func_args = arg_size;
3171 t1 = type->t & VT_STORAGE;
3172 type->t &= ~VT_STORAGE;
3173 s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);3171 s = sym_push(SYM_FIELD, type, INT_ATTR(ad), l);
3174 s->next = first;3172 s->next = first;
3175 type->t = t1 | VT_FUNC;3173 type->t = VT_FUNC;
3176 type->ref = s;3174 type->ref = s;
3177 } else if (tok == '[') {3175 } else if (tok == '[') {
3178 SValue *last_vtop = NULL;3176 SValue *last_vtop = NULL;
@@ -3182,6 +3180,7 @@ static void post_type(CType *type, AttributeDef *ad) · 3 unmodified lines
3182 if (tok == TOK_RESTRICT1)3180 if (tok == TOK_RESTRICT1)
3183 next();3181 next();
3184 n = -1;3182 n = -1;
3183 t1 = 0;
3185 if (tok != ']') {3184 if (tok != ']') {
3186 gexpr();3185 gexpr();
3187 if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {3186 if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
@@ -3192,14 +3191,12 @@ static void post_type(CType *type, AttributeDef *ad) · 4 unmodified lines
3192 } else {3191 } else {
3193 if (!is_integer_btype(vtop->type.t & VT_BTYPE))3192 if (!is_integer_btype(vtop->type.t & VT_BTYPE))
3194 error("size of variable length array should be an integer");3193 error("size of variable length array should be an integer");
3195 type->t |= VT_VLA;3194 t1 = VT_VLA;
3196 last_vtop = vtop;3195 last_vtop = vtop;
3197 }3196 }
3198 }3197 }
3199 skip(']');3198 skip(']');
3200 /* parse next post type */3199 /* parse next post type */
3201 t1 = type->t & (VT_STORAGE|VT_VLA);
3202 type->t &= ~(VT_STORAGE|VT_VLA);
3203 post_type(type, ad);3200 post_type(type, ad);
3204 t1 |= type->t & VT_VLA;3201 t1 |= type->t & VT_VLA;
3205 3202
@@ -3227,7 +3224,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) · 21 unmodified lines
3227{3224{
3228 Sym *s;3225 Sym *s;
3229 CType type1, *type2;3226 CType type1, *type2;
3230 int qualifiers;3227 int qualifiers, storage;
3231 3228
3232 while (tok == '*') {3229 while (tok == '*') {
3233 qualifiers = 0;3230 qualifiers = 0;
@@ -3279,7 +3276,10 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) · 45 unmodified lines
3279 *v = 0;3276 *v = 0;
3280 }3277 }
3281 }3278 }
3279 storage = type->t & VT_STORAGE;
3280 type->t &= ~VT_STORAGE;
3282 post_type(type, ad);3281 post_type(type, ad);
3282 type->t |= storage;
3283 if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)3283 if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)
3284 parse_attribute(ad);3284 parse_attribute(ad);
3285 3285

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t