shithub: scc

Download patch

ref: 0c094f48799666e4e0c82aed4fd817f69a3f3f6e
parent: 11f2fad7a2d1dfb01db4048b86f48c9762909587
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jan 7 14:21:56 EST 2016

Interchange integeruop() and numericaluop()

This change puts integeruop() after integerop(),  which
simplifies reading the code, because it puts together
related functions.

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -211,26 +211,26 @@
 }
 
 static Node *
-numericaluop(char op, Node *np)
+integeruop(char op, Node *np)
 {
-	if (!np->type->arith)
-		error("unary operator requires numerical operand");
+	if (!np->type->integer)
+		error("unary operator requires integer operand");
 	np = promote(np);
-	if (op == ONEG && np->op == ONEG)
+	if (op == OCPL && np->op == OCPL)
 		return np->left;
-	if (op == OADD)
-		return np;
 	return simplify(op, np->type, np, NULL);
 }
 
 static Node *
-integeruop(char op, Node *np)
+numericaluop(char op, Node *np)
 {
-	if (!np->type->integer)
-		error("unary operator requires integer operand");
+	if (!np->type->arith)
+		error("unary operator requires numerical operand");
 	np = promote(np);
-	if (op == OCPL && np->op == OCPL)
+	if (op == ONEG && np->op == ONEG)
 		return np->left;
+	if (op == OADD)
+		return np;
 	return simplify(op, np->type, np, NULL);
 }