scc

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

commit eeacd7b393061ba912ee5b07e8550a72cde1596a
parent e337843c58d1d5b0e91134c6d3173c97708cb291
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 20 Feb 2017 15:39:30 +0100

[cc1] Support out of order unlink in unlinkhash()

The cpp symbols are defined/undefined in any order, so we need
the support for out of order at least for them. Other symbols
should have the invariant of being in the top of the collision
list.

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

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -88,7 +88,9 @@ unlinkhash(Symbol *sym) if ((sym->flags & SDECLARED) == 0) return; h = hash(sym->name, sym->ns); - assert(*h == sym); + assert(sym->ns == NS_CPP || *h == sym); + while (*h != sym) + h = &(*h)->hash; *h = sym->hash; }