scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit b84e1437a4a054d68f3b49fc908580939a795247
parent bb62eb750a4a55634e242500fdb955278723805e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 27 Sep 2015 10:23:33 +0200

Fix nextsym()

Nextsym() is used when a macro with arguments is found without arguments,
and it is needed to look for a definition with less priority. There were
two different errors in nextsym(), because in case of finding the less
priority symbol it was returning the more priority, and in case of not
finding a less priority symbol it was installing a new symbol, but it
should be only allocated.

Diffstat:
Mcc1/symbol.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -281,9 +281,9 @@ nextsym(Symbol *sym, int ns) for (p = sym->hash; p; p = p->hash) { t = p->name; if (c == *t && !strcmp(s, t)) - return sym; + return p; } - return linkhash(allocsym(ns, s)); + return allocsym(ns, s); } Symbol *