mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-28 15:48:43 +08:00
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).
This commit is contained in:
parent
8d9dd3c008
commit
3c39cb5cd8
27
tccgen.c
27
tccgen.c
@ -81,7 +81,6 @@ static void block(int *bsym, int *csym, int is_expr);
|
|||||||
static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
|
static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
|
||||||
static int decl0(int l, int is_for_loop_init);
|
static int decl0(int l, int is_for_loop_init);
|
||||||
static void expr_eq(void);
|
static void expr_eq(void);
|
||||||
static void expr_lor_const(void);
|
|
||||||
static void unary_type(CType *type);
|
static void unary_type(CType *type);
|
||||||
static void vla_runtime_type_size(CType *type, int *a);
|
static void vla_runtime_type_size(CType *type, int *a);
|
||||||
static void vla_sp_restore(void);
|
static void vla_sp_restore(void);
|
||||||
@ -4512,10 +4511,8 @@ ST_FUNC void unary(void)
|
|||||||
skip('(');
|
skip('(');
|
||||||
expr_eq();
|
expr_eq();
|
||||||
skip(',');
|
skip(',');
|
||||||
nocode_wanted++;
|
expr_eq();
|
||||||
expr_lor_const();
|
|
||||||
vpop();
|
vpop();
|
||||||
nocode_wanted--;
|
|
||||||
skip(')');
|
skip(')');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4566,7 +4563,7 @@ ST_FUNC void unary(void)
|
|||||||
next();
|
next();
|
||||||
skip('(');
|
skip('(');
|
||||||
nocode_wanted++;
|
nocode_wanted++;
|
||||||
gexpr();
|
expr_eq();
|
||||||
res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
|
res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
|
||||||
vpop();
|
vpop();
|
||||||
nocode_wanted--;
|
nocode_wanted--;
|
||||||
@ -5056,26 +5053,6 @@ static void expr_or(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: fix this mess */
|
|
||||||
static void expr_land_const(void)
|
|
||||||
{
|
|
||||||
expr_or();
|
|
||||||
while (tok == TOK_LAND) {
|
|
||||||
next();
|
|
||||||
expr_or();
|
|
||||||
gen_op(TOK_LAND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void expr_lor_const(void)
|
|
||||||
{
|
|
||||||
expr_land_const();
|
|
||||||
while (tok == TOK_LOR) {
|
|
||||||
next();
|
|
||||||
expr_land_const();
|
|
||||||
gen_op(TOK_LOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void expr_land(void)
|
static void expr_land(void)
|
||||||
{
|
{
|
||||||
expr_or();
|
expr_or();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user