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

Re: [tools-dev] bison and rsc



On 20 Jan 2002, Ken Foskey wrote:

> Bison 1.31 (debian woody) creates
>
> 	output   (header code)

IMHO, this is a bison bug, here is what I applied to the Mandrake Linux
8.2 bison:

2002-02-15  Gwenole Beauchesne  <gbeauchesne@mandrakesoft.com>

	* src/files (compute_exts_from_gf, compute_exts_from_src): Handle
	the case where header_extension is the same as src_extension, aka
	handle -d -o <file> where <file> doesn't have a known EXT to
	transform. e.g. if <file> is <something>.yxx, set the
	header_extension to <something>.yxx.h, as would do bison 1.28.

--- bison-1.32/src/files.c.extfix	Mon Jan 21 16:41:46 2002
+++ bison-1.32/src/files.c	Fri Feb 15 15:40:43 2002
@@ -288,6 +288,8 @@ compute_exts_from_gf (const char *ext)
   src_extension = tr (src_extension, 'Y', 'C');
   header_extension = tr (ext, 'y', 'h');
   header_extension = tr (header_extension, 'Y', 'H');
+  if (!strcmp (header_extension, src_extension))
+	header_extension = stringappend (src_extension, ".h");
 }

 /* Computes extensions from the given c source file extension. */
@@ -300,6 +302,8 @@ compute_exts_from_src (const char *ext)
   src_extension = xstrdup (ext);
   header_extension = tr (ext, 'c', 'h');
   header_extension = tr (header_extension, 'C', 'H');
+  if (!strcmp (header_extension, src_extension))
+	header_extension = stringappend (src_extension, ".h");
 }


> However there is now a lot of errors regarding size_t to fix.  I hand
> hacked the output from bison to replace YYSIZE_T with size_t and it
> worked fine.  I think this might be related to including stdio.h not
> cstdio in the mainline code, could be entirely wrong though.

With "2.96", I get something similar insofar as size_t got into __STL
namespace, which doesn't exist. Workaround is to #define __STL std into
rscyacc.cxx prior to including the .yxx file.

Bye,
Gwenole.



Reply to: