* 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.
This commit is contained in:
Robert Anisko
2001-08-27 14:55:39 +00:00
parent b0cfa28a12
commit 82e236e2d6
4 changed files with 20 additions and 7 deletions

View File

@@ -1,3 +1,15 @@
2001-08-27 Robert Anisko <robert.anisko@epita.fr>
* 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 <robert.anisko@epita.fr>
* src/output.c (output_parser): Fix. Store single '%' characters in

View File

@@ -1103,7 +1103,6 @@ prepare (void)
void
output (void)
{
obstack_init (&macro_obstack);
obstack_init (&output_obstack);
#if 0

View File

@@ -907,9 +907,6 @@ parse_macro_decl (void)
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 @@ parse_macro_decl (void)
return;
}
copy_identifier (finput, &macro_obstack);
obstack_1grow (&macro_obstack, 0);
macro_key = obstack_finish (&macro_obstack);
/* Read value. */
@@ -935,11 +933,10 @@ parse_macro_decl (void)
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);
}
@@ -1991,6 +1988,9 @@ reader (void)
init_lex ();
lineno = 1;
/* Initialize the macro obstack. */
obstack_init (&macro_obstack);
/* Initialize the symbol table. */
tabinit ();

View File

@@ -36,4 +36,6 @@ extern int lineno;
extern char **tags;
extern short *user_toknums;
extern struct obstack macro_obstack;
#endif /* !READER_H_ */