shithub: scc

Download patch

ref: f426a4d4ddaad3eb752814fc040f0b180775ce16
parent: ac748964eb6c3535320d3bedc211a4e272cf946f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Aug 18 10:36:03 EDT 2015

Call install() in label()

The message of label() is outdated and current version
of install() handles this situation, so we can call it directly.

--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -20,18 +20,8 @@
 	switch (yytoken) {
 	case IDEN:
 	case TYPEIDEN:
-		/*
-		 * We cannot call to insert() because the call to lookup in
-		 * lex.c was done in NS_IDEN namespace, and it is impossibe
-		 * to fix this point, because an identifier at the beginning
-		 * of a statement may be part of an expression or part of a
-		 * label. This double call to lookup() is going to generate
-		 * an undefined symbol that is not going to be used ever.
-		 */
-		sym = lookup(NS_LABEL);
-		if (sym->flags & ISDECLARED)
+		if ((sym = install(NS_LABEL, yylval.sym)) == NULL)
 			error("label '%s' already defined", yytoken);
-		sym->flags |= ISDECLARED;
 		emit(OLABEL, sym);
 		next();
 		expect(':');