ref: 8137246e26d881141bcdc525d9dc0b43ba5cf5db
parent: 1fd69c115bb5155d7dca44242d9c331d122786a4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Aug 10 19:17:26 EDT 2015
Add output in dumpstab() Sometimes is useful to know the list of symbols and not only the hash.
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -23,15 +23,23 @@
{
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
@@ -305,7 +313,12 @@
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;
}