From: Akim Demaille Date: Mon, 25 Jun 2012 08:15:44 +0000 (+0200) Subject: yacc: work around the ylwrap limitation. X-Git-Tag: v2.6~53 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/55d1006fcedde7a816290dfcd7cb84fa227ae560?ds=sidebyside 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. --- diff --git a/NEWS b/NEWS index 72e4b6b3..10829f54 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 bug-bison@gnu.org. + +*** 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 400c68ce..57f3dace 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)