aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-01-17 00:06:44 +0100
committerMichael Matz <matz@suse.de>2017-05-02 03:07:36 +0200
commit3c39cb5cd8f49e52353e72e3cd26467e4cd0ed0e (patch)
treeb23371570dc2f5fc21398a98db99b9b9093c6692
parent8d9dd3c0088d69d7742889c3267e5b1a138641b0 (diff)
downloadtinycc-3c39cb5cd8f49e52353e72e3cd26467e4cd0ed0e.tar.gz
tinycc-3c39cb5cd8f49e52353e72e3cd26467e4cd0ed0e.tar.bz2
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).
-rw-r--r--tccgen.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/tccgen.c b/tccgen.c
index 1efbc1f..8aa86f3 100644
--- a/tccgen.c
+++ b/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 int decl0(int l, int is_for_loop_init);
static void expr_eq(void);
-static void expr_lor_const(void);
static void unary_type(CType *type);
static void vla_runtime_type_size(CType *type, int *a);
static void vla_sp_restore(void);
@@ -4512,10 +4511,8 @@ ST_FUNC void unary(void)
skip('(');
expr_eq();
skip(',');
- nocode_wanted++;
- expr_lor_const();
+ expr_eq();
vpop();
- nocode_wanted--;
skip(')');
}
break;
@@ -4566,7 +4563,7 @@ ST_FUNC void unary(void)
next();
skip('(');
nocode_wanted++;
- gexpr();
+ expr_eq();
res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
vpop();
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)
{
expr_or();