Package: byacc
Version: 20100216-1
Severity: normal
Tags: patch

The following patch fixes compatibility problems with bison's pure-parser
option. Judging by the upstream author's freshmeat page [1], I believe the
pure-parser option was meant specifically for bison support, thus why I left
this bug at severity normal.

1. http://freshmeat.net/projects/byacc/

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages byacc depends on:
ii  libc6                         2.11.1-2   Embedded GNU C Library: Shared lib

byacc recommends no packages.

byacc suggests no packages.

-- no debconf information
Patch for better support for bison compatibility for pure-parser option.

--- byacc-20100216.orig/skeleton.c
+++ byacc-20100216/skeleton.c
@@ -55,10 +55,18 @@ const char *xdecls[] =
     "",
     "extern int YYPARSE_DECL();",
     "",
-    "/* compatibility with flex */",
-    "#ifdef YYLEX_PARAM",
+    "/* compatibility with bison pure-parser and flex reentrant options */",
+    "#if defined YYPURE && defined YYLEX_PARAM",
+    "#define YYLEX_DECL() yylex(YYSTYPE *yylval, void *YYLEX_PARAM)",
+    "#define YYLEX yylex(&yylval, YYLEX_PARAM)",
+    "/* compatibility with flex reentrant option */",
+    "#elif defined YYLEX_PARAM",
     "#define YYLEX_DECL() yylex(void *YYLEX_PARAM)",
     "#define YYLEX yylex(YYLEX_PARAM)",
+    "/* compatilibity with bison pure-parser option */",
+    "#elif defined YYPURE",
+    "#define YYLEX_DECL() yylex(YYSTYPE *yylval)",
+    "#define YYLEX yylex(&yylval)",
     "#else",
     "#define YYLEX_DECL() yylex(void)",
     "#define YYLEX yylex()",
--- byacc-20100216.orig/output.c
+++ byacc-20100216/output.c
@@ -1223,6 +1223,7 @@ output(void)
     free_shifts();
     free_reductions();
     output_prefix(output_file);
+    output_pure_parser();
     output_stored_text();
     write_section(xdecls);
     output_defines();
@@ -1239,7 +1240,6 @@ output(void)
 	write_section(tables);
     }
     write_section(hdr_defs);
-    output_pure_parser();
     if (!pure_parser)
     {
 	write_section(hdr_vars);

Reply via email to