]> git.saurik.com Git - bison.git/commitdiff
debug: improve the display of symbol lists
authorAkim Demaille <akim@lrde.epita.fr>
Sat, 9 Feb 2013 15:07:09 +0000 (16:07 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Mon, 11 Feb 2013 08:04:17 +0000 (09:04 +0100)
* src/symtab.c (symbol_print): Remove useless quotes (the symbol already
has quotes).
Prefer fputs.
* src/symlist.c (symbol_list_syms_print): Likewise.
Fix separators.

src/symlist.c
src/symtab.c

index 72ca11096ddc06f2a6e13171ec2582e37979f517..d43591ad812a512d6d764b037b2206806d2f5224 100644 (file)
@@ -84,12 +84,17 @@ symbol_list_type_new (uniqstr type_name, location loc)
 void
 symbol_list_syms_print (const symbol_list *l, FILE *f)
 {
+  char const *sep = "";
   for (/* Nothing. */; l && l->content.sym; l = l->next)
     {
+      fputs (sep, f);
+      fputs (l->content_type == SYMLIST_SYMBOL ? "symbol: "
+             : l->content_type == SYMLIST_TYPE ? "type: "
+             : "invalid content_type: ",
+             f);
       symbol_print (l->content.sym, f);
-      fprintf (f, l->action_props.is_value_used ? " used" : " unused");
-      if (l && l->content.sym)
-        fprintf (f, ", ");
+      fputs (l->action_props.is_value_used ? " used" : " unused", f);
+      sep = ", ";
     }
 }
 
index 1768d88d2bb6bf4ff9b7b3cc4d699ce38facda9f..b132e07bcd2b71ccfc61a3443760cc00587dc3b1 100644 (file)
@@ -153,13 +153,13 @@ symbol_print (symbol const *s, FILE *f)
 {
   if (s)
     {
-      fprintf (f, "\"%s\"", s->tag);
+      fputs (s->tag, f);
       SYMBOL_ATTR_PRINT (type_name);
       SYMBOL_CODE_PRINT (destructor);
       SYMBOL_CODE_PRINT (printer);
     }
   else
-    fprintf (f, "<NULL>");
+    fputs ("<NULL>", f);
 }
 
 #undef SYMBOL_ATTR_PRINT