X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/ff4423cc2856ccc63b0fc72430fdc095208e0b14..dc2825ae898c526ea3619450112b2ea44f437151:/src/output.c diff --git a/src/output.c b/src/output.c index f4b3c3fd..b86f4611 100644 --- a/src/output.c +++ b/src/output.c @@ -223,10 +223,18 @@ register YYLTYPE *yylsp;\n\ void output_headers (void) { - char *attrsfile_quoted = quotearg_style (c_quoting_style, attrsfile); + char *attrsfile_quoted = 0; if (semantic_parser) - obstack_fgrow1 (&guard_obstack, GUARDSTR, attrsfile_quoted); + { + /* FIXME: This is *buggy*. ATTRSFILE is not computed yet, since + we are waiting for the full input file to have been read to + be sure of the output file name. So basically, here, a SEGV + is guaranteed. OTOH, currently semantic parsers are not + supported. */ + attrsfile_quoted = quotearg_style (c_quoting_style, attrsfile); + obstack_fgrow1 (&guard_obstack, GUARDSTR, attrsfile_quoted); + } if (no_parser_flag) return; @@ -1146,17 +1154,19 @@ output_parser (void) int c; FILE *fskel; size_t line; - const char *skeleton = NULL; int actions_dumped = 0; if (pure_parser) obstack_sgrow (&table_obstack, "#define YYPURE 1\n\n"); /* Loop over lines in the standard parser file. */ - if (semantic_parser) - skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY); - else - skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE); + if (!skeleton) + { + if (semantic_parser) + skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY); + else + skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE); + } fskel = xfopen (skeleton, "r"); /* Set LINE to 2, not 1: `#line LINENUM' -- Here LINENUM is a