bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: [Main] Macro obstack bug


From: robert anisko
Subject: FYI: [Main] Macro obstack bug
Date: Mon, 27 Aug 2001 17:44:47 +0000 (GMT)

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.186
diff -u -r1.186 ChangeLog
--- ChangeLog   2001/08/27 14:34:02     1.186
+++ ChangeLog   2001/08/27 14:53:01
@@ -1,5 +1,17 @@
 2001-08-27  Robert Anisko  <address@hidden>
 
+       * src/output.c (output): Remove the initialization of the macro 
+       obstack.  It was done too late here.
+
+       * src/reader.c (parse_macro_decl): Fix.  Use of the macro obstack was
+       completely wrong.
+       (reader): Initialize the macro obstack here, since we need it to grow
+       '%define' directives.
+
+       * src/reader.h: Declare the macro obstack as extern.
+
+2001-08-27  Robert Anisko  <address@hidden>
+
        * src/output.c (output_parser): Fix.  Store single '%' characters in
        the output obstack instead of throwing them away.
 
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.43
diff -u -r1.43 output.c
--- src/output.c        2001/08/27 14:34:02     1.43
+++ src/output.c        2001/08/27 14:53:04
@@ -1103,7 +1103,6 @@
 void
 output (void)
 {
-  obstack_init (&macro_obstack);
   obstack_init (&output_obstack);
 
 #if 0
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.75
diff -u -r1.75 reader.c
--- src/reader.c        2001/08/25 15:13:42     1.75
+++ src/reader.c        2001/08/27 14:53:06
@@ -907,10 +907,7 @@
   int ch = ungetc (skip_white_space (), finput);
   char* macro_key;
   char* macro_value;
-  struct obstack macro_obstack;
 
-  obstack_init (&macro_obstack);
-
   /* Read key. */
   if (!isalpha (ch) && ch != '_')
     {
@@ -919,6 +916,7 @@
       return;
     }
   copy_identifier (finput, &macro_obstack);
+  obstack_1grow (&macro_obstack, 0);
   macro_key = obstack_finish (&macro_obstack);
   
   /* Read value. */
@@ -935,11 +933,10 @@
       else
        fatal (_("Premature EOF after %s"), "\"");
     }
-  copy_string (finput, &macro_obstack, '"');
+  copy_string2 (finput, &macro_obstack, '"', 0);
+  obstack_1grow (&macro_obstack, 0);
   macro_value = obstack_finish (&macro_obstack);
 
-  obstack_free (&macro_obstack, 0);
-
   /* Store the (key, value) pair in the environment. */
   macro_insert (macro_key, macro_value);
 }
@@ -1990,6 +1987,9 @@
 
   init_lex ();
   lineno = 1;
+
+  /* Initialize the macro obstack.  */
+  obstack_init (&macro_obstack);
 
   /* Initialize the symbol table.  */
   tabinit ();
Index: src/reader.h
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.h,v
retrieving revision 1.2
diff -u -r1.2 reader.h
--- src/reader.h        2000/11/02 13:38:12     1.2
+++ src/reader.h        2001/08/27 14:53:07
@@ -36,4 +36,6 @@
 extern char **tags;
 extern short *user_toknums;
 
+extern struct obstack macro_obstack;
+
 #endif /* !READER_H_ */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]