History

fix __builtin_expect

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).

Michael Matz committed 9 years ago

Commit 3c39cb51 parent 8d9dd3c1 file · +2 −25Browse files

Unified · Split

tccgen.c+2−25
@@ -81,7 +81,6 @@ static void block(int *bsym, int *csym, int is_expr); · 80 unmodified lines
81static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);81static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
82static int decl0(int l, int is_for_loop_init);82static int decl0(int l, int is_for_loop_init);
83static void expr_eq(void);83static void expr_eq(void);
84static void expr_lor_const(void);
85static void unary_type(CType *type);84static void unary_type(CType *type);
86static void vla_runtime_type_size(CType *type, int *a);85static void vla_runtime_type_size(CType *type, int *a);
87static void vla_sp_restore(void);86static 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 */
5060static 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}
5069static 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
5079static void expr_land(void)5056static void expr_land(void)
5080{5057{
5081 expr_or();5058 expr_or();

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