shithub: scc

Download patch

ref: d9c2814c687ef15992a986941d818962359e3b7b
parent: a75d6253fd88d03d1f1948461f08cb035809070e
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Jun 27 06:51:41 EDT 2015

Return next token in iden()

Instead of returning an indication that there was an expansion
is better to return the next token, and then the caller does
not need to repeat the operation.

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -439,7 +439,7 @@
 	yylval.sym = sym = lookup(lex_ns);
 	if (sym->ns == NS_CPP) {
 		if (!disexpand && sym != input->macro && expand(sym))
-			return 0;
+			return next();
 		/*
 		 * it is not a correct macro call, so try to find
 		 * another definition. This is going to be expensive
@@ -572,7 +572,6 @@
 {
 	char c;
 
-repeat:
 	skipspaces();
 	if (eof) {
 		if (cppctx)
@@ -592,9 +591,6 @@
 		yytoken = character();
 	else
 		yytoken = operator();
-
-	if (!yytoken)
-		goto repeat;
 
 	fputs(yytext, stderr);
 	putc('\n', stderr);