the second argument can be an arbitrary expression (including side-effects), not just a constant. This removes the last user of expr_lor_const and hence also that function (and expr_land_const). Also the argument to __builtin_constant_p can be only a non-comma expression (like all functions arguments).
Unified · Split
| @@ -81,7 +81,6 @@ static void block(int *bsym, int *csym, int is_expr); · 80 unmodified lines | ||
| 81 | 81 | static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope); |
| 82 | 82 | static int decl0(int l, int is_for_loop_init); |
| 83 | 83 | static void expr_eq(void); |
| 84 | −static void expr_lor_const(void); | |
| 85 | 84 | static void unary_type(CType *type); |
| 86 | 85 | static void vla_runtime_type_size(CType *type, int *a); |
| 87 | 86 | static void vla_sp_restore(void); |
| @@ -4512,10 +4511,8 @@ ST_FUNC void unary(void) · 4424 unmodified lines | ||
| 4512 | 4511 | skip('('); |
| 4513 | 4512 | expr_eq(); |
| 4514 | 4513 | skip(','); |
| 4515 | − nocode_wanted++; | |
| 4516 | − expr_lor_const(); | |
| 4514 | + expr_eq(); | |
| 4517 | 4515 | vpop(); |
| 4518 | − nocode_wanted--; | |
| 4519 | 4516 | skip(')'); |
| 4520 | 4517 | } |
| 4521 | 4518 | break; |
| @@ -4566,7 +4563,7 @@ ST_FUNC void unary(void) · 44 unmodified lines | ||
| 4566 | 4563 | next(); |
| 4567 | 4564 | skip('('); |
| 4568 | 4565 | nocode_wanted++; |
| 4569 | − gexpr(); | |
| 4566 | + expr_eq(); | |
| 4570 | 4567 | res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST; |
| 4571 | 4568 | vpop(); |
| 4572 | 4569 | nocode_wanted--; |
| @@ -5056,26 +5053,6 @@ static void expr_or(void) · 483 unmodified lines | ||
| 5056 | 5053 | } |
| 5057 | 5054 | } |
| 5058 | 5055 | |
| 5059 | −/* XXX: fix this mess */ | |
| 5060 | −static void expr_land_const(void) | |
| 5061 | −{ | |
| 5062 | − expr_or(); | |
| 5063 | − while (tok == TOK_LAND) { | |
| 5064 | − next(); | |
| 5065 | − expr_or(); | |
| 5066 | − gen_op(TOK_LAND); | |
| 5067 | − } | |
| 5068 | −} | |
| 5069 | −static void expr_lor_const(void) | |
| 5070 | −{ | |
| 5071 | − expr_land_const(); | |
| 5072 | − while (tok == TOK_LOR) { | |
| 5073 | − next(); | |
| 5074 | − expr_land_const(); | |
| 5075 | − gen_op(TOK_LOR); | |
| 5076 | − } | |
| 5077 | −} | |
| 5078 | − | |
| 5079 | 5056 | static void expr_land(void) |
| 5080 | 5057 | { |
| 5081 | 5058 | expr_or(); |