]> git.saurik.com Git - bison.git/commitdiff
(symbol_destructors_output, symbol_printers_output):
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Jul 2004 14:39:58 +0000 (14:39 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Jul 2004 14:39:58 +0000 (14:39 +0000)
Don't assume %union.

src/output.c

index d004604e1375e8bf5915e28dd9d76961dc50db34..a77546f1ff98f2da3741b8a98930b51aedbe5526 100644 (file)
@@ -402,16 +402,18 @@ symbol_destructors_output (FILE *out)
 
        /* Filename, lineno,
           Symbol-name, Symbol-number,
 
        /* Filename, lineno,
           Symbol-name, Symbol-number,
-          destructor, typename. */
+          destructor, optional typename.  */
        fprintf (out, "%s[", sep);
        sep = ",\n";
        escaped_file_name_output (out, sym->destructor_location.start.file);
        fprintf (out, "%s[", sep);
        sep = ",\n";
        escaped_file_name_output (out, sym->destructor_location.start.file);
-       fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
+       fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]]",
                 sym->destructor_location.start.line,
                 sym->tag,
                 sym->number,
                 sym->destructor_location.start.line,
                 sym->tag,
                 sym->number,
-                sym->destructor,
-                sym->type_name);
+                sym->destructor);
+       if (sym->type_name)
+         fprintf (out, ", [[%s]]", sym->type_name);
+       fputc (']', out);
       }
   fputs ("])\n\n", out);
 }
       }
   fputs ("])\n\n", out);
 }
@@ -435,16 +437,18 @@ symbol_printers_output (FILE *out)
 
        /* Filename, lineno,
           Symbol-name, Symbol-number,
 
        /* Filename, lineno,
           Symbol-name, Symbol-number,
-          printer, typename. */
+          printer, optional typename.  */
        fprintf (out, "%s[", sep);
        sep = ",\n";
        escaped_file_name_output (out, sym->printer_location.start.file);
        fprintf (out, "%s[", sep);
        sep = ",\n";
        escaped_file_name_output (out, sym->printer_location.start.file);
-       fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
+       fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]]",
                 sym->printer_location.start.line,
                 sym->tag,
                 sym->number,
                 sym->printer_location.start.line,
                 sym->tag,
                 sym->number,
-                sym->printer,
-                sym->type_name);
+                sym->printer);
+       if (sym->type_name)
+         fprintf (out, ", [[%s]]", sym->type_name);
+       fputc (']', out);
       }
   fputs ("])\n\n", out);
 }
       }
   fputs ("])\n\n", out);
 }