shithub: scc

Download patch

ref: 3a13451527967209d4e2e9d8bf8248659bfafb3f
parent: abed3472b1cdf0e54d28e9e36473d7d6affaa250
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jan 19 07:17:26 EST 2016

Remove symbol field from Node

This flag gives the same information that field sym
gives.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -87,7 +87,6 @@
 	Type *type;
 	Symbol *sym;
 	bool lvalue : 1;
-	bool symbol: 1;
 	bool constant : 1;
 	struct node *left, *right;
 };
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -316,7 +316,7 @@
 	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 @@
 	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 @@
 	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 @@
 
 	np = node(OSYM, sym->type, NULL, NULL);
 	np->type = sym->type;
-	np->symbol = 1;
 	np->constant = 1;
 	np->sym = sym;
 	return np;
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -552,7 +552,7 @@
 
 	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 @@
 	}
 	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;
 }