bison-patches
[Top][All Lists]
Advanced

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

Re: ylwrap does not rename y.tab.h in y.tab.c (was: yacc.c: instead of d


From: Akim Demaille
Subject: Re: ylwrap does not rename y.tab.h in y.tab.c (was: yacc.c: instead of duplicating y.tab.h inside y.tac.c, include it)
Date: Mon, 25 Jun 2012 10:25:31 +0200

Le 20 juin 2012 à 07:26, Akim Demaille a écrit :

> 
> Le 15 juin 2012 à 13:34, Akim Demaille a écrit :
> 
>> I installed it, and some more tests, in maint, as follows.
> 
>> 
>> From 0f11eec272453d5646e5aeda135650b4fb8ac33d Mon Sep 17 00:00:00 2001
>> From: Akim Demaille <address@hidden>
>> Date: Tue, 12 Jun 2012 16:15:14 +0200
>> Subject: [PATCH 1/2] yacc.c: instead of duplicating y.tab.h inside y.tac.c, 
>> include it.
> 
> We have a problem with this change (which can be seen if
> you make check in master): as far as I can tell, ylwrap,
> which goes via y.tab.c and y.tab.h, does _not_ change the
> occurrences of y.tab.h in y.tab.c.  So in the end, the
> parser implementation file foo.c includes y.tab.h instead of
> foo.h.
> 
> This is Automake 1.12.1, ylwrap 2011-08-25.18.
> 
> Because of this, it is unclear to me whether we can leave that
> change, users would face the same issue as bison-master :(
> And it does not seem acceptable that Bison 2.6 mandates Automake
> 1.12.2 or whatever.
> 
> Any suggestion?  In particular a workaround (for Makefile.am)
> which would work for both older and newer Automakes.

Well, I guess I must step back.  I installed what follows
in maint.

What are the versions of Automake to fix?  Should 1.11.*
be addressed too?  I have no idea how wide spread 1.12 is.

From 55d1006fcedde7a816290dfcd7cb84fa227ae560 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Mon, 25 Jun 2012 10:15:44 +0200
Subject: [PATCH] yacc: work around the ylwrap limitation.

* data/yacc.c (b4_shared_declarations): Include the header guards.
Do not include the header in the *.c file, duplicate it.
* NEWS (Future Changes): Extend, and announce the forthcoming change
about the use of the parser header.
---
 NEWS        |   32 +++++++++++++++++++++++---------
 data/yacc.c |   15 +++++++++------
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/NEWS b/NEWS
index 72e4b6b..10829f5 100644
--- a/NEWS
+++ b/NEWS
@@ -2,19 +2,33 @@ GNU Bison NEWS
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
-** Future changes:
+** Future changes
+
+  The next major release of Bison will drop support for the following
+  deprecated features.  Please report disagreements to address@hidden
+
+*** K&C parsers
+
+  Support for generating parsers in K&R C will be removed.  Parsers
+  generated for C supprt ISO C90, and are tested with ISO C99 and ISO C11
+  compilers.
+
+*** Deprecated features
+
+  The definitions of yystype and yyltype will be removed, as announced since
+  Bison 1.875.  Use YYSTYPE and YYLTYPE only.
 
-  The next major release will drop support for generating parsers in K&R C,
-  and remove the definitions of yystype and yyltype (removal announced since
-  Bison 1.875).  YYPARSE_PARAM and YYLEX_PARAM, which were deprecated in
-  favor of %parse-param and %lex-param (introduced in Bison 1.875 too), will
-  no longer be supported.
+  YYPARSE_PARAM and YYLEX_PARAM, which were deprecated in favor of
+  %parse-param and %lex-param (introduced in Bison 1.875), will no longer be
+  supported.
 
-** The generated header is included (yacc.c)
+*** The generated header will be included (yacc.c)
 
   Instead of duplicating the content of the generated header (definition of
-  YYSTYPE, yyltype etc.), the generated parser now includes it, as was
-  already the case for GLR or C++ parsers.
+  YYSTYPE, yyparse declaration etc.), the generated parser will include it,
+  as is already the case for GLR or C++ parsers.  This change is deferred
+  because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
+  it.
 
 ** Headers (yacc.c, glr.c, glr.cc)
 
diff --git a/data/yacc.c b/data/yacc.c
index 400c68c..57f3dac 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -227,6 +227,8 @@ m4_define([b4_declare_parser_state_variables], 
[b4_pure_if([[
 
 # b4_declare_yyparse_push_
 # ------------------------
+# Declaration of yyparse (and dependencies) when using the push parser
+# (including in pull mode).
 m4_define([b4_declare_yyparse_push_],
 [[typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
 enum { YYPUSH_MORE = 4 };
@@ -272,12 +274,14 @@ m4_define([b4_declare_yyparse],
 # Declaration that might either go into the header (if --defines)
 # or open coded in the parser body.
 m4_define([b4_shared_declarations],
-[b4_declare_yydebug[
+[b4_cpp_guard_open([b4_spec_defines_file])[
+]b4_declare_yydebug[
 ]b4_percent_code_get([[requires]])[
 ]b4_token_enums_defines(b4_tokens)[
 ]b4_declare_yylstype[
 ]b4_declare_yyparse[
-]b4_percent_code_get([[provides]])[]dnl
+]b4_percent_code_get([[provides]])[
+]b4_cpp_guard_close([b4_spec_defines_file])[]dnl
 ])
 
 ## -------------- ##
@@ -337,8 +341,9 @@ m4_if(b4_prefix, [yy], [],
 # define YYTOKEN_TABLE ]b4_token_table[
 #endif
 
-]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
-               [b4_shared_declarations])[
+/* In a future release of Bison, this section will be replaced
+   by #include "@basename(]b4_spec_defines_file[@)".  */
+]b4_shared_declarations[
 
 /* Copy the second part of user declarations.  */
 ]b4_user_post_prologue
@@ -2065,8 +2070,6 @@ b4_defines_if(
 b4_copyright([Bison interface for Yacc-like parsers in C],
              [1984, 1989-1990, 2000-2012])[
 
-]b4_cpp_guard_open([b4_spec_defines_file])[
 ]b4_shared_declarations[
-]b4_cpp_guard_close([b4_spec_defines_file])[
 ]])dnl b4_defines_if
 m4_divert_pop(0)
-- 
1.7.10.4





reply via email to

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