shithub: scc

Download patch

ref: 76f51c1570cb8e07e4dff1cc67b364519ead4d8a
parent: 407b3b6c257984402dd3c7980ba5ac32290f8ad4
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Dec 20 14:24:00 EST 2016

[cc1] Remove nextsym()

It is not longer needed because we already use another hash
table for cpp symbols.

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -499,12 +499,6 @@
 	if ((sym = lookup(NS_CPP, yytext, NOALLOC)) != NULL) {
 		if (!disexpand && expand(begin, sym))
 			return next();
-		/*
-		 * it is not a correct macro call, so try to find
-		 * another definition.
-		 */
-		if (lexmode != CPPMODE)
-			sym = nextsym(sym, namespace);
 	}
 	sym = lookup(namespace, yytext, ALLOC);
 	yylval.sym = sym;
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -277,28 +277,6 @@
 }
 
 Symbol *
-nextsym(Symbol *sym, int ns)
-{
-	char *s, *t, c;
-	Symbol *p;
-
-	/*
-	 * This function is only called when a macro with parameters
-	 * is called without them.
-	 *      #define x(y) ((y) + 1)
-	 *      int x = x(y);
-	 */
-	s = sym->name;
-	c = *s;
-	for (p = sym->hash; p; p = p->hash) {
-		t = p->name;
-		if (c == *t && !strcmp(s, t))
-			return p;
-	}
-	return allocsym(ns, s);
-}
-
-Symbol *
 install(int ns, Symbol *sym)
 {
 	if (sym->flags & SDECLARED) {