shithub: scc

Download patch

ref: d464e990c12ba28e4fbe501db59a4a994baa4281
parent: ed75d396ec28b77eece0b243eea09143cfb4e2da
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun May 8 15:19:44 EDT 2016

[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.

--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -351,13 +351,13 @@
 			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:
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -202,7 +202,7 @@
 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
--- a/cc2/code.c
+++ b/cc2/code.c
@@ -53,7 +53,7 @@
 }
 
 Node *
-label(Symbol *sym)
+label2node(Symbol *sym)
 {
 	Node *np;