scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit c58da86b07e75bb748a45db71fcf8f0daf38995f
parent d63c65bb7d62515061b439b2e85334efbed8c20c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 16 Apr 2014 22:14:29 +0200

Remove isaddr()

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

Diffstat:
Mcc.h | 1-
Mexpr.c | 7++++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cc.h b/cc.h @@ -123,7 +123,6 @@ extern Type *voidtype, *pvoidtype, *booltype, #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)) diff --git a/expr.c b/expr.c @@ -266,12 +266,13 @@ array(Node *np1, Node *np2) 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;