Unified · Split
| @@ -81,12 +81,10 @@ static void block(int *bsym, int *csym, int is_expr); · 80 unmodified lines | |||
| 81 | static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope); | 81 | static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope); |
| 82 | static int decl0(int l, int is_for_loop_init); | 82 | static int decl0(int l, int is_for_loop_init); |
| 83 | static void expr_eq(void); | 83 | static void expr_eq(void); |
| 84 | static void unary_type(CType *type); | ||
| 85 | static void vla_runtime_type_size(CType *type, int *a); | 84 | static void vla_runtime_type_size(CType *type, int *a); |
| 86 | static void vla_sp_restore(void); | 85 | static void vla_sp_restore(void); |
| 87 | static void vla_sp_restore_root(void); | 86 | static void vla_sp_restore_root(void); |
| 88 | static int is_compatible_parameter_types(CType *type1, CType *type2); | 87 | static int is_compatible_parameter_types(CType *type1, CType *type2); |
| 89 | static void expr_type(CType *type); | ||
| 90 | static inline int64_t expr_const64(void); | 88 | static inline int64_t expr_const64(void); |
| 91 | ST_FUNC void vpush64(int ty, unsigned long long v); | 89 | ST_FUNC void vpush64(int ty, unsigned long long v); |
| 92 | ST_FUNC void vpush(CType *type); | 90 | ST_FUNC void vpush(CType *type); |
| @@ -4255,6 +4253,20 @@ static void gfunc_param_typed(Sym *func, Sym *arg) · 4162 unmodified lines | |||
| 4255 | } | 4253 | } |
| 4256 | } | 4254 | } |
| 4257 | 4255 | ||
| 4256 | /* parse an expression and return its type without any side effect. | ||
| 4257 | If UNRY we parse an unary expression, otherwise a full one. */ | ||
| 4258 | static void expr_type(CType *type, int unry) | ||
| 4259 | { | ||
| 4260 | nocode_wanted++; | ||
| 4261 | if (unry) | ||
| 4262 | unary(); | ||
| 4263 | else | ||
| 4264 | gexpr(); | ||
| 4265 | *type = vtop->type; | ||
| 4266 | vpop(); | ||
| 4267 | nocode_wanted--; | ||
| 4268 | } | ||
| 4269 | |||
| 4258 | /* parse an expression of the form '(type)' or '(expr)' and return its | 4270 | /* parse an expression of the form '(type)' or '(expr)' and return its |
| 4259 | type */ | 4271 | type */ |
| 4260 | static void parse_expr_type(CType *type) | 4272 | static void parse_expr_type(CType *type) |
| @@ -4266,7 +4278,7 @@ static void parse_expr_type(CType *type) · 5 unmodified lines | |||
| 4266 | if (parse_btype(type, &ad)) { | 4278 | if (parse_btype(type, &ad)) { |
| 4267 | type_decl(type, &ad, &n, TYPE_ABSTRACT); | 4279 | type_decl(type, &ad, &n, TYPE_ABSTRACT); |
| 4268 | } else { | 4280 | } else { |
| 4269 | expr_type(type); | 4281 | expr_type(type, 0); |
| 4270 | } | 4282 | } |
| 4271 | skip(')'); | 4283 | skip(')'); |
| 4272 | } | 4284 | } |
| @@ -4501,7 +4513,7 @@ ST_FUNC void unary(void) · 228 unmodified lines | |||
| 4501 | t = tok; | 4513 | t = tok; |
| 4502 | next(); | 4514 | next(); |
| 4503 | in_sizeof++; | 4515 | in_sizeof++; |
| 4504 | unary_type(&type); // Perform a in_sizeof = 0; | 4516 | expr_type(&type, 1); // Perform a in_sizeof = 0; |
| 4505 | size = type_size(&type, &align); | 4517 | size = type_size(&type, &align); |
| 4506 | if (t == TOK_SIZEOF) { | 4518 | if (t == TOK_SIZEOF) { |
| 4507 | if (!(type.t & VT_VLA)) { | 4519 | if (!(type.t & VT_VLA)) { |
| @@ -5329,28 +5341,6 @@ ST_FUNC void gexpr(void) · 821 unmodified lines | |||
| 5329 | } | 5341 | } |
| 5330 | } | 5342 | } |
| 5331 | 5343 | ||
| 5332 | /* parse an expression and return its type without any side effect. */ | ||
| 5333 | static void expr_type(CType *type) | ||
| 5334 | { | ||
| 5335 | |||
| 5336 | nocode_wanted++; | ||
| 5337 | gexpr(); | ||
| 5338 | *type = vtop->type; | ||
| 5339 | vpop(); | ||
| 5340 | nocode_wanted--; | ||
| 5341 | } | ||
| 5342 | |||
| 5343 | /* parse a unary expression and return its type without any side | ||
| 5344 | effect. */ | ||
| 5345 | static void unary_type(CType *type) | ||
| 5346 | { | ||
| 5347 | nocode_wanted++; | ||
| 5348 | unary(); | ||
| 5349 | *type = vtop->type; | ||
| 5350 | vpop(); | ||
| 5351 | nocode_wanted--; | ||
| 5352 | } | ||
| 5353 | |||
| 5354 | /* parse a constant expression and return value in vtop. */ | 5344 | /* parse a constant expression and return value in vtop. */ |
| 5355 | static void expr_const1(void) | 5345 | static void expr_const1(void) |
| 5356 | { | 5346 | { |