scc

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

commit 13ce3ce2a3c0bd19452d9bdbe9669a62382a44a0
parent a879848adf3c6b62dc033994c2ccb22849084697
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Sun,  8 May 2016 19:19:44 +0200

[cc2] Avoid name collision

Label() was a name used in several ports, so it is
not a good idea to define it again in the global
namespace. Label2node() is also a good name.

Diffstat:
Mcc2/arch/qbe/cgen.c | 6+++---
Mcc2/cc2.h | 2+-
Mcc2/code.c | 2+-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -351,13 +351,13 @@ cgen(Node *np) sym->kind = SLABEL; next->label = sym; } - ifyes = label(np->u.sym); - ifno = label(next->label); + ifyes = label2node(np->u.sym); + ifno = label2node(next->label); op = ASBRANCH; np = np->left; goto emit_jump; case OJMP: - ifyes = label(np->u.sym); + ifyes = label2node(np->u.sym); op = ASJMP; np = ifno = NULL; emit_jump: diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -202,7 +202,7 @@ extern void writeout(void), endinit(void), newfun(void); extern void code(int op, Node *to, Node *from1, Node *from2); extern void defvar(Symbol *), defpar(Symbol *), defglobal(Symbol *); extern void setlabel(Symbol *sym); -extern Node *label(Symbol *sym); +extern Node *label2node(Symbol *sym); /* node.c */ #define SETCUR 1 diff --git a/cc2/code.c b/cc2/code.c @@ -53,7 +53,7 @@ addr(Node *np, Addr *addr) } Node * -label(Symbol *sym) +label2node(Symbol *sym) { Node *np;