scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit bb1e1b0015d417d616261d5acb438bd74de1919e
parent 235aee1ffddb12ecbab5823365199931283e5ea4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 15 Apr 2014 13:29:54 +0200

Simplify check of a Symbol Node

The unique way of detecting that a Node is a Symbol is
to check the code installed in the Node, that in the case
of emitsym implies a Symbol Node. This check is not
very clear, so it is better use a macro with a better name.

Diffstat:
cc.h | 1+
expr.c | 2+-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/cc.h b/cc.h @@ -244,5 +244,6 @@ extern Node #define SYM(s) ((union unode) {.sym = s}) #define OP(s) ((union unode) {.op = s}) #define TYP(s) ((union unode) {.type = s}) +#define ISNODESYM(n) ((n)->code == emitsym) #endif diff --git a/expr.c b/expr.c @@ -422,7 +422,7 @@ unary(void) case OADDR: if (!np->b.lvalue) goto no_lvalue; - if (np->code == emitsym && np->u.sym->s.isregister) + if (ISNODESYM(np) && np->u.sym->s.isregister) goto reg_address; tp = mktype(tp, PTR, NULL, 0); break;