shithub: scc

Download patch

ref: ad3115bad7ad1fff10fa676c55c1c78645e5f5a1
parent: 6234ca1a96d4ff39e0e236337008886684af6237
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jan 7 17:41:43 EST 2016

Convert incdec() to use new fields in Type

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -513,17 +513,14 @@
 
 	chklvalue(np);
 
-	switch (BTYPE(np)) {
-	case PTR:
-		if (!tp->defined)
-			error("invalid use of undefined type");
-		inc = sizeofnode(tp->type);
-		break;
-	case INT:
-	case FLOAT:
+	if (!tp->defined) {
+		errorp("invalid use of undefined type");
+		return np;
+	} else if (tp->arith) {
 		inc = constnode(one);
-		break;
-	default:
+	} else if (tp->op == PTR) {
+		inc = sizeofnode(tp->type);
+	} else {
 		errorp("wrong type argument to increment or decrement");
 		return np;
 	}