ref: bb1e1b0015d417d616261d5acb438bd74de1919e
parent: 235aee1ffddb12ecbab5823365199931283e5ea4
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Apr 15 09:29:54 EDT 2014
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.
--- a/cc.h
+++ b/cc.h
@@ -244,5 +244,6 @@
#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
--- a/expr.c
+++ b/expr.c
@@ -422,7 +422,7 @@
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;