shithub: scc

Download patch

ref: bcc4de52e4e216a3b5a9d734fed46a4d06c3252c
parent: 42a2ed50d61e736f6c8c34ad78089ae9f56d6534
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Sep 1 18:09:45 EDT 2015

Small cosmetic changes in fold.c

--- a/cc1/fold.c
+++ b/cc1/fold.c
@@ -293,8 +293,6 @@
 		*rp = r;
 		*lp = l;
 		break;
-	default:
-		return;
 	}
 }
 
@@ -329,7 +327,7 @@
 	return v;
 }
 
-static bool
+static Node *
 identity(int op, Node *lp, Node *rp)
 {
 	int val;
@@ -352,13 +350,13 @@
 		if (cmp(lp, ones(lp->type->size * 8)))
 			goto free_right;
 	default:
-		return 0;
+		return NULL;
 	}
 	if (!cmp(rp, val))
-		return 0;
+		return NULL;
 free_right:
 	freetree(rp);
-	return 1;
+	return lp;
 }
 
 Node *
@@ -369,8 +367,8 @@
 	if ((np = fold(op, tp, lp, rp)) != NULL)
 		return np;
 	commutative(&op, &lp, &rp);
-	if (identity(op, lp, rp))
-		return lp;
+	if ((np = identity(op, lp, rp)) != NULL)
+		return np;
 	return node(op, tp, lp, rp);
 }