[hackers] [scc] [cc1] Pass table as parameter to dumpstab() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 19 Feb 2017 18:15:10 +0100 (CET)

commit 7961958fd5f94b21d4c1c136d064bedb337303a4
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Feb 19 08:42:04 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Feb 19 08:42:04 2017 +0100

    [cc1] Pass table as parameter to dumpstab()
    
    This function can be used for debugging the cpp and lexcial tables.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index a5ad280..ad476f1 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -389,7 +389,7 @@ extern void typesize(Type *tp);
 extern void flushtypes(void);
 
 /* symbol.c */
-extern void dumpstab(char *msg);
+extern void dumpstab(Symbol **tbl, char *msg);
 extern Symbol *lookup(int ns, char *name, int alloc);
 extern Symbol *nextsym(Symbol *sym, int ns);
 extern Symbol *install(int ns, Symbol *sym);
diff --git a/cc1/symbol.c b/cc1/symbol.c
index 3d4e21c..6953db8 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -20,12 +20,12 @@ static Symbol *htabcpp[NR_SYM_HASH];
 
 #ifndef NDEBUG
 void
-dumpstab(char *msg)
+dumpstab(Symbol **tbl, char *msg)
 {
         Symbol **bp, *sym;
 
         fprintf(stderr, "Symbol Table dump at ctx=%u\n%s\n", curctx, msg);
- for (bp = htab; bp < &htab[NR_SYM_HASH]; ++bp) {
+ for (bp = tbl; bp < &tbl[NR_SYM_HASH]; ++bp) {
                 if (*bp == NULL)
                         continue;
                 fprintf(stderr, "%d", (int) (bp - htab));
_AT_@ -40,6 +40,12 @@ dumpstab(char *msg)
                         sym->ns, sym->ctx,
                         (sym->name) ? sym->name : "", (void *) sym);
         }
+ fputs("\nlabels:", stderr);
+ for (sym = labels; sym; sym = sym->next) {
+ fprintf(stderr, "->[%d,%d:'%s'=%p]",
+ sym->ns, sym->ctx,
+ (sym->name) ? sym->name : "", (void *) sym);
+ }
         putc('\n', stderr);
 }
 #endif
Received on Sun Feb 19 2017 - 18:15:10 CET

This archive was generated by hypermail 2.3.0 : Sun Feb 19 2017 - 18:24:18 CET