shithub: scc

Download patch

ref: c93d98b686a627b492c2fff2c438909000643069
parent: 845cfbbd4b4544abcd91b4dc733185a362b2c7f7
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Nov 4 03:30:56 EDT 2021

cc1: Change name of variables in cast()

Casts are unary operators and talking about left and right
is really confusing, specially when one of them is just a
temporary variable used to stored the node returned by the
recursion.

--- a/src/cmd/cc/cc1/expr.c
+++ b/src/cmd/cc/cc1/expr.c
@@ -889,7 +889,7 @@
 static Node *
 cast(int needdecay)
 {
-	Node *lp, *rp;
+	Node *tmp, *np;
 	Type *tp;
 	static int nested;
 
@@ -910,10 +910,10 @@
 		case ARY:
 			error("cast specifies an array type");
 		default:
-			lp = cast(needdecay);
-			if ((rp = convert(lp,  tp, 1)) == NULL)
+			tmp = cast(needdecay);
+			if ((np = convert(tmp,  tp, 1)) == NULL)
 				error("bad type conversion requested");
-			rp->flags &= ~NLVAL;
+			np->flags &= ~NLVAL;
 		}
 		break;
 	default:
@@ -920,14 +920,14 @@
 		if (nested == NR_SUBEXPR)
 			error("too many expressions nested by parentheses");
 		++nested;
-		rp = xexpr();
+		np = xexpr();
 		--nested;
 		expect(')');
-		rp = postfix(rp);
+		np = postfix(np);
 		break;
 	}
 
-	return rp;
+	return np;
 }
 
 static Node *