scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit d9c2814c687ef15992a986941d818962359e3b7b
parent a75d6253fd88d03d1f1948461f08cb035809070e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 27 Jun 2015 10:51:41 +0200

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.

Diffstat:
cc1/lex.c | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/cc1/lex.c b/cc1/lex.c @@ -439,7 +439,7 @@ iden(void) 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 @@ next(void) { char c; -repeat: skipspaces(); if (eof) { if (cppctx) @@ -593,9 +592,6 @@ repeat: else yytoken = operator(); - if (!yytoken) - goto repeat; - fputs(yytext, stderr); putc('\n', stderr); lex_ns = NS_IDEN;