shithub: scc

Download patch

ref: b655b713cf6cb7abb87ef704b3dc24f91d7b2b3e
parent: 8f3b75a7c544312a9b182a614b63d18714a9b5fc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Oct 30 17:31:52 EDT 2021

cc1: Simplify exp2cond()

A ternary operator in a call function can be confusing, and it was not
needed in this case.

--- a/src/cmd/cc/cc1/expr.c
+++ b/src/cmd/cc/cc1/expr.c
@@ -398,6 +398,8 @@
 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 @@
 			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));
 	}
 }