shithub: scc

Download patch

ref: c58da86b07e75bb748a45db71fcf8f0daf38995f
parent: d63c65bb7d62515061b439b2e85334efbed8c20c
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Apr 16 18:14:29 EDT 2014

Remove isaddr()

This macro was used only once and it can be replaced
by a more concrete expression

--- a/cc.h
+++ b/cc.h
@@ -123,7 +123,6 @@
 #define ISQUAL(t)    (isqual((t)->op))
 #define UNQUAL(t)    (ISQUAL(t) ? (t)->type : (t))
 #define BTYPE(t)     (UNQUAL(t)->op)
-#define isaddr(op)   ((op) & POINTER)
 #define isqual(op)   ((op) & TQUALIFIER)
 #define isconst(op) (((op) & (TQUALIFIER|CONST)) == \
                                      (TQUALIFIER|CONST))
--- a/expr.c
+++ b/expr.c
@@ -266,12 +266,13 @@
 
 	t1 = BTYPE(np1->type);
 	t2 = BTYPE(np2->type);
-	if (!isaddr(t1) && !isaddr(t2))
-		goto bad_vector;
 	if (t1 != INT && t2 != INT)
 		goto bad_subs;
 	np1 = arithmetic(OADD, np1, np2);
-	np1 =  unarycode(OARY, np1->type->type , np1);
+	tp = np1->type;
+	if (tp->op != PTR)
+		goto bad_vector;
+	np1 =  unarycode(OARY, tp->type , np1);
 	np1->b.lvalue = 1;
 	return np1;