bison-patches
[Top][All Lists]
Advanced

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

patch for Bison bug with -d and --output-file


From: Paul Eggert
Subject: patch for Bison bug with -d and --output-file
Date: Wed, 25 Dec 2002 22:48:31 -0800 (PST)

> From: Bruce Stephens <address@hidden>
> To: Debian Bug Tracking System <address@hidden>
> Date: Fri, 18 Oct 2002 13:26:26 +0100

> when processed using "bison -y -d -pcl --output-file ClReader.cc.h
> ClReader.y" (which is what the Makefile wants to do), produces a
> bogus file, with a bunch of NULs in the middle.

Thanks for the bug report.  I installed the following patch in the
upstream Bison sources, and the fix should appear in the next Bison
version.

I should warn you, though, that you're relying on undefined behavior.
That command asks that the header and code files both be sent to
ClReader.cc.h.  It happens that the header overwrites the code in the
current implementation, but this is not guaranteed, and you're better
off specifying something like "--output-file ClReader.cc.c" to avoid
the undefined behavior.

2002-12-25  Paul Eggert  <address@hidden>

        * src/scan-skel.l ("@output ".*\n): Close any old yyout before
        opening a new one.  This fixes Debian bug 165349, reported by
        Bruce Stephens.

--- scan-skel.l 11 Dec 2002 06:48:54 -0000      1.19
+++ scan-skel.l 26 Dec 2002 05:59:06 -0000      1.20
@@ -60,6 +60,7 @@ int skel_lex (void);
 
   XFREE (outname);
   outname = xstrdup (filename);
+  xfclose (yyout);
   yyout = xfopen (outname, "w");
   lineno = 1;
 }



reply via email to

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