shithub: scc

Download patch

ref: a69c703bb4665df150774ffc1e4cce19db92f9a7
parent: dc646368f83872d8a5a3f3470254f9516e5e09dc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Feb 20 10:39:30 EST 2017

[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.

--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -88,7 +88,9 @@
 	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;
 }