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
8181 static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
8282 static int decl0(int l, int is_for_loop_init);
8383 static void expr_eq(void);
84−static void expr_lor_const(void);
8584 static void unary_type(CType *type);
8685 static void vla_runtime_type_size(CType *type, int *a);
8786 static void vla_sp_restore(void);
@@ -4512,10 +4511,8 @@ ST_FUNC void unary(void) · 4424 unmodified lines
45124511 skip('(');
45134512 expr_eq();
45144513 skip(',');
4515− nocode_wanted++;
4516− expr_lor_const();
4514+ expr_eq();
45174515 vpop();
4518− nocode_wanted--;
45194516 skip(')');
45204517 }
45214518 break;
@@ -4566,7 +4563,7 @@ ST_FUNC void unary(void) · 44 unmodified lines
45664563 next();
45674564 skip('(');
45684565 nocode_wanted++;
4569− gexpr();
4566+ expr_eq();
45704567 res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
45714568 vpop();
45724569 nocode_wanted--;
@@ -5056,26 +5053,6 @@ static void expr_or(void) · 483 unmodified lines
50565053 }
50575054 }
50585055
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−
50795056 static void expr_land(void)
50805057 {
50815058 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