commit 40c44c60310875d84b3c761363c11aebb8701b17
parent 7e5aa153c76c44a936446c61e7f7fa0eb222fdcb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 30 Oct 2021 21:31:52 +0200
cc1: Simplify exp2cond()
A ternary operator in a call function can be confusing, and it was not
needed in this case.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/cmd/cc/cc1/expr.c b/src/cmd/cc/cc1/expr.c
@@ -398,6 +398,8 @@ negop(int op)
static Node *
exp2cond(Node *np, int neg)
{
+ int op;
+
if (np->type->prop & TAGGREG) {
errorp("used struct/union type value where scalar is required");
return constnode(zero);
@@ -417,7 +419,8 @@ exp2cond(Node *np, int neg)
np->op = negop(np->op);
return np;
default:
- return compare((neg) ? OEQ : ONE, np, constnode(zero));
+ op = (neg) ? OEQ : ONE;
+ return compare(op, np, constnode(zero));
}
}