[hackers] [scc] Add output in dumpstab() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 10 Aug 2015 23:21:07 +0200 (CEST)

commit 8137246e26d881141bcdc525d9dc0b43ba5cf5db
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Aug 10 23:17:26 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Aug 10 23:17:26 2015 +0200

    Add output in dumpstab()
    
    Sometimes is useful to know the list of symbols
    and not only the hash.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index bdc31d4..f746901 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -23,15 +23,23 @@ dumpstab(char *msg)
 {
         Symbol **bp, *sym;
 
- fprintf(stderr, "%s\n", msg);
+ fprintf(stderr, "Symbol Table dump at ctx=%u\n%s\n", curctx, msg);
         for (bp = htab; bp < &htab[NR_SYM_HASH]; ++bp) {
                 if (*bp == NULL)
                         continue;
                 fprintf(stderr, "%d", (int) (bp - htab));
                 for (sym = *bp; sym; sym = sym->hash)
- fprintf(stderr, "->%d:%s", sym->ns, sym->name);
+ fprintf(stderr, "->%d,%d:%s",
+ sym->ns, sym->ctx, sym->name);
                 putc('\n', stderr);
         }
+ fputs("head:", stderr);
+ for (sym = head; sym; sym = sym->next) {
+ fprintf(stderr, "->%d,%d:'%s'",
+ sym->ns, sym->ctx,
+ (sym->name) ? sym->name : "");
+ }
+ putc('\n', stderr);
 }
 #endif
 
_AT_@ -305,7 +313,12 @@ ikeywords(void)
                         sym->token = bp->token;
                         sym->u.token = bp->value;
                 }
- head = NULL;
                 ns = NS_CPPCLAUSES;
         }
+ /*
+ * Remove all the predefined symbols from * the symbol list. It
+ * will make faster someoperations. There is no problem of memory
+ * leakeage because this memory is not ever freed
+ */
+ head = NULL;
 }
Received on Mon Aug 10 2015 - 23:21:07 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 10 2015 - 23:24:14 CEST