scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 3a13451527967209d4e2e9d8bf8248659bfafb3f
parent abed3472b1cdf0e54d28e9e36473d7d6affaa250
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 19 Jan 2016 12:17:26 +0100

Remove symbol field from Node

This flag gives the same information that field sym
gives.

Diffstat:
Mcc1/cc1.h | 1-
Mcc1/code.c | 6++----
Mcc1/expr.c | 4++--
3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -87,7 +87,6 @@ struct node { Type *type; Symbol *sym; bool lvalue : 1; - bool symbol: 1; bool constant : 1; struct node *left, *right; }; diff --git a/cc1/code.c b/cc1/code.c @@ -316,7 +316,7 @@ emitdesig(Node *np, Type *tp) if (!np) { sym = NULL; } else { - if (!np->symbol) + if (!np->sym) goto emit_expression; sym = np->sym; if ((sym->flags & ISINITLST) == 0) @@ -474,7 +474,7 @@ node(unsigned op, Type *tp, Node *lp, Node *rp) np->op = op; np->type = tp; np->sym = NULL; - np->constant = np->symbol = np->lvalue = 0; + np->constant = np->lvalue = 0; np->left = lp; np->right = rp; @@ -491,7 +491,6 @@ varnode(Symbol *sym) np->type = sym->type; np->lvalue = tp->op != FTN && tp->op != ARY; np->constant = 0; - np->symbol = 1; np->sym = sym; return np; } @@ -503,7 +502,6 @@ constnode(Symbol *sym) np = node(OSYM, sym->type, NULL, NULL); np->type = sym->type; - np->symbol = 1; np->constant = 1; np->sym = sym; return np; diff --git a/cc1/expr.c b/cc1/expr.c @@ -552,7 +552,7 @@ address(char op, Node *np) if (BTYPE(np) != FTN) { chklvalue(np); - if (np->symbol && (np->sym->flags & ISREGISTER)) + if (np->sym && (np->sym->flags & ISREGISTER)) errorp("address of register variable '%s' requested", yytext); if (np->op == OPTR) { Node *new = np->left; @@ -562,7 +562,7 @@ address(char op, Node *np) } new = node(op, mktype(np->type, PTR, 0, NULL), np, NULL); - if (np->symbol && np->sym->flags & (ISGLOBAL|ISLOCAL|ISPRIVATE)) + if (np->sym && np->sym->flags & (ISGLOBAL|ISLOCAL|ISPRIVATE)) new->constant = 1; return new; }