diff options
author | Patrick McHardy <kaber@trash.net> | 2014-01-15 15:39:10 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2014-01-15 15:39:10 +0000 |
commit | c3d233b1e210922ac6f29afca796b66964e499de (patch) | |
tree | eb9a76368126ce60c6a48c98c5c552dacd5c4588 | |
parent | 7c6db39e019c3c7e973d9835c9b03341b0d63de9 (diff) |
expr: relational: don't surpress '==' for LHS binops in output
This patch changes the output of relational expressions to not surpress
the '==' when the LHS is a binop, f.i.
... meta mark & 0x00000003 0x00000001
becomes
... meta mark & 0x00000003 == 0x00000001
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | src/expression.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/expression.c b/src/expression.c index 71154cc6..518f71c8 100644 --- a/src/expression.c +++ b/src/expression.c @@ -356,7 +356,7 @@ const char *expr_op_symbols[] = { [OP_XOR] = "^", [OP_LSHIFT] = "<<", [OP_RSHIFT] = ">>", - [OP_EQ] = NULL, + [OP_EQ] = "==", [OP_NEQ] = "!=", [OP_LT] = "<", [OP_GT] = ">", @@ -407,7 +407,9 @@ struct expr *unary_expr_alloc(const struct location *loc, static void binop_expr_print(const struct expr *expr) { expr_print(expr->left); - if (expr_op_symbols[expr->op] != NULL) + if (expr_op_symbols[expr->op] && + (expr->op != OP_EQ || + expr->left->ops->type == EXPR_BINOP)) printf(" %s ", expr_op_symbols[expr->op]); else printf(" "); |