[hackers] [scc] [cc1] Support out of order unlink in unlinkhash() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 20 Feb 2017 15:46:49 +0100 (CET)

commit eeacd7b393061ba912ee5b07e8550a72cde1596a
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Feb 20 15:39:30 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Feb 20 15:39:30 2017 +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.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 3c5f9b1..7cb8d6f 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -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;
 }
 
Received on Mon Feb 20 2017 - 15:46:49 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2017 - 15:48:23 CET