commit b655b713cf6cb7abb87ef704b3dc24f91d7b2b3e
parent 8f3b75a7c544312a9b182a614b63d18714a9b5fc
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));
}
}