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 | 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 expr_lor_const(void); | ||
| 85 | static void unary_type(CType *type); | 84 | static void unary_type(CType *type); |
| 86 | static void vla_runtime_type_size(CType *type, int *a); | 85 | static void vla_runtime_type_size(CType *type, int *a); |
| 87 | static void vla_sp_restore(void); | 86 | static void vla_sp_restore(void); |
| @@ -4512,10 +4511,8 @@ ST_FUNC void unary(void) · 4424 unmodified lines | |||
| 4512 | skip('('); | 4511 | skip('('); |
| 4513 | expr_eq(); | 4512 | expr_eq(); |
| 4514 | skip(','); | 4513 | skip(','); |
| 4515 | nocode_wanted++; | 4514 | expr_eq(); |
| 4516 | expr_lor_const(); | ||
| 4517 | vpop(); | 4515 | vpop(); |
| 4518 | nocode_wanted--; | ||
| 4519 | skip(')'); | 4516 | skip(')'); |
| 4520 | } | 4517 | } |
| 4521 | break; | 4518 | break; |
| @@ -4566,7 +4563,7 @@ ST_FUNC void unary(void) · 44 unmodified lines | |||
| 4566 | next(); | 4563 | next(); |
| 4567 | skip('('); | 4564 | skip('('); |
| 4568 | nocode_wanted++; | 4565 | nocode_wanted++; |
| 4569 | gexpr(); | 4566 | expr_eq(); |
| 4570 | res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST; | 4567 | res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST; |
| 4571 | vpop(); | 4568 | vpop(); |
| 4572 | nocode_wanted--; | 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 | static void expr_land(void) | 5056 | static void expr_land(void) |
| 5080 | { | 5057 | { |
| 5081 | expr_or(); | 5058 | expr_or(); |