scc

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

commit f51a68e44b4bb4255a371f30ec95da9282033bd5
parent 3ea9ea8edc499da466a8555e9424a8d92e3e7526
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 11 May 2016 16:59:35 +0200

[cc1] Fix bug after 0fc57e5

0fc57e5 fixed a bug but introduced another one.

Diffstat:
cc1/cpp.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -304,7 +304,8 @@ getpars(Symbol *args[NR_MACROARG]) if (accept(')')) return 0; - for (n = 0; ; ++n) { + n = 0; + do { if (n == NR_MACROARG) { cpperror("too much parameters in macro"); return NR_MACROARG; @@ -315,11 +316,9 @@ getpars(Symbol *args[NR_MACROARG]) } sym = install(NS_IDEN, yylval.sym); sym->flags |= SUSED; - args[n] = sym; + args[n++] = sym; next(); - if (!accept(',')) - break; - } + } while (accept(',')); expect(')'); return n;