From: Akim Demaille Date: Fri, 6 Jul 2012 08:58:26 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/maint' X-Git-Tag: v2.7.90~403 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/60aa04a236004d3d03f00aeaf07b643a52ef0760 Merge remote-tracking branch 'origin/maint' * origin/maint: maint: update release instructions maint: post-release administrivia version 2.5.90 build: fix gen-ChangeLog call. gnulib: update. tests: fix SKIP_IF for Java. api.prefix: incompatible with %name-prefix. api.prefix: strengthen the tests and fix push-parsers. skeletons: style changes. NEWS: minor changes. api.prefix: improve the documentation for YYDEBUG. gnulib: update. Conflicts: NEWS cfg.mk data/bison.m4 doc/bison.texi m4/.gitignore tests/calc.at tests/headers.at --- 60aa04a236004d3d03f00aeaf07b643a52ef0760 diff --cc NEWS index eddfa8ee,24f43d51..c17939a3 --- a/NEWS +++ b/NEWS @@@ -2,126 -2,10 +2,127 @@@ GNU Bison NEW * Noteworthy changes in release ?.? (????-??-??) [?] +** Warnings -* Noteworthy changes in release 2.5.90 (2012-07-05) [beta] +*** Warning categories are now displayed in warnings + + For instance: + + foo.y:4.6: warning: type clash on default action: != [-Wother] + +*** Useless semantic types + + Bison now warns about useless (uninhabited) semantic types. Since + semantic types are not declared to Bison (they are defined in the opaque + %union structure), it is %printer/%destructor directives about useless + types that trigger the warning: + + %token term + %type nterm + %printer {} + %destructor {} + %% + nterm: term { $$ = $1; }; + + 3.28-34: warning: type is used, but is not associated to any symbol + 4.28-34: warning: type is used, but is not associated to any symbol + +*** Undeclared symbols + + Bison used to raise an error for %printer and %destructor directives for + undefined symbols. + + %printer {} symbol1 + %destructor {} symbol2 + %% + exp: "a"; + + This is now only a warning. + +*** Useless destructors or printers + + Bison now warns about useless destructors or printers. In the following + example, the printer for , and the destructor for are + useless: all symbols of (token1) already have a printer, and all + symbols of type (token2) already have a destructor. + + %token token1 + token2 + token3 + token4 + %printer {} token1 + %destructor {} token2 + +** Additional yylex/yyparse arguments + + The new directive %param declares additional arguments to both yylex and + yyparse. The %lex-param, %parse-param, and %param directives support one + or more arguments. Instead of + + %lex-param {arg1_type *arg1} + %lex-param {arg2_type *arg2} + %parse-param {arg1_type *arg1} + %parse-param {arg2_type *arg2} + + one may now declare -** Future Changes + %param {arg1_type *arg1} {arg2_type *arg2} + +** Java skeleton improvements + + The constants for token names were moved to the Lexer interface. + Also, it is possible to add code to the parser's constructors using + "%code init" and "%define init_throws". + +** C++ skeleton improvements + + The C++ parser features a syntax_error exception, which can be + thrown from the scanner or from user rules to raise syntax errors. + This facilitates reporting errors caught in sub-functions (e.g., + rejecting too large integral literals from a conversion function + used by the scanner, or rejecting invalid combinations from a + factory invoked by the user actions). + +** Variable api.tokens.prefix + + The variable api.tokens.prefix changes the way tokens are identified in + the generated files. This is especially useful to avoid collisions + with identifiers in the target language. For instance + + %token FILE for ERROR + %define api.tokens.prefix "TOK_" + %% + start: FILE for ERROR; + + will generate the definition of the symbols TOK_FILE, TOK_for, and + TOK_ERROR in the generated sources. In particular, the scanner must + use these prefixed token names, although the grammar itself still + uses the short names (as in the sample rule given above). + +** Variable api.namespace + + The "namespace" variable is renamed "api.namespace". Backward + compatibility is ensured, but upgrading is recommended. + +** Variable parse.error + + The variable error controls the verbosity of error messages. The + use of the %error-verbose directive is deprecated in favor of + %define parse.error "verbose". + +** Semantic predicates + + The new, experimental, semantic-predicate feature allows actions of + the form %?{ BOOLEAN-EXPRESSION }, which cause syntax errors (as for + YYERROR) if the expression evaluates to 0, and are evaluated immediately + in GLR parsers, rather than being deferred. The result is that they + allow the programmer to prune possible parses based on the values of + run-time expressions. + +* Noteworthy changes in release ?.? (????-??-??) [?] + - ** Future changes ++ ++* Noteworthy changes in release 2.5.90 (2012-07-05) [beta] The next major release of Bison will drop support for the following deprecated features. Please report disagreements to bug-bison@gnu.org. diff --cc cfg.mk index 392d2112,222d3bc3..6088b64a --- a/cfg.mk +++ b/cfg.mk @@@ -62,9 -68,9 +62,9 @@@ $(call exclude, prohibit_always-defined_macros+=?|^lib/timevar.c$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \ - prohibit_empty_lines_at_EOF=^src/parse-gram.[ch]$$ \ + prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \ + prohibit_strcmp=^doc/bison\.texinfo$$ \ require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ space_tab=^tests/(input|c\+\+)\.at$$ \ - unmarked_diagnostics=^djgpp/ \ - trailing_blank=^src/parse-gram.[ch]$$ \ + unmarked_diagnostics=^(djgpp/|doc/bison.texi$$) \ ) diff --cc doc/bison.texi index 085c5a96,15ee270e..d4ac6e40 --- a/doc/bison.texi +++ b/doc/bison.texi @@@ -5156,8 -5074,10 +5156,8 @@@ default location or at the location spe @end deffn @deffn {Directive} %debug - Instrument the output parser for traces. Obsoleted by @samp{%define -In the parser implementation file, define the macro @code{YYDEBUG} (or -@code{@var{prefix}DEBUG} with @samp{%define api.prefix @var{prefix}}), see -@ref{Multiple Parsers, ,Multiple Parsers in the Same Program}) to 1 if it is -not already defined, so that the debugging facilities are compiled. ++Instrument the parser for traces. Obsoleted by @samp{%define +parse.trace}. @xref{Tracing, ,Tracing Your Parser}. @end deffn @@@ -5683,46 -5470,7 +5685,50 @@@ syntax error handling. @xref{LAC} @item Accepted Values: @code{none}, @code{full} @item Default Value: @code{none} @end itemize +@c parse.lac + +@c ================================================== parse.trace +@item parse.trace +@findex %define parse.trace + +@itemize - @item Languages(s): C, C++ ++@item Languages(s): C, C++, Java + +@item Purpose: Require parser instrumentation for tracing. - In C/C++, define the macro @code{YYDEBUG} to 1 in the parser implementation ++@xref{Tracing, ,Tracing Your Parser}. ++ ++In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with ++@samp{%define api.prefix @var{prefix}}), see @ref{Multiple Parsers, ++,Multiple Parsers in the Same Program}) to 1 in the parser implementation +file if it is not already defined, so that the debugging facilities are - compiled. @xref{Tracing, ,Tracing Your Parser}. ++compiled. + +@item Accepted Values: Boolean + +@item Default Value: @code{false} +@end itemize +@c parse.trace + +@c ================================================== variant +@item variant +@findex %define variant + +@itemize @bullet +@item Language(s): +C++ + +@item Purpose: +Request variant-based semantic values. +@xref{C++ Variants}. + +@item Accepted Values: +Boolean. + +@item Default Value: +@code{false} @end itemize +@c variant +@end table @node %code Summary diff --cc tests/calc.at index 55b91544,e4cb07f1..886122e2 --- a/tests/calc.at +++ b/tests/calc.at @@@ -629,18 -625,19 +625,19 @@@ AT_CHECK_CALC_LALR([%define parse.erro AT_CHECK_CALC_LALR([%define api.pure %locations]) AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %locations]) -AT_CHECK_CALC_LALR([%error-verbose %locations]) +AT_CHECK_CALC_LALR([%define parse.error verbose %locations]) - AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%error-verbose %locations %defines %define api.prefix "calc" %verbose %yacc]) ++AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %define api.prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) AT_CHECK_CALC_LALR([%debug]) -AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) ++AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) - AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) ++AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc]) - AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) -AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) ++AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) # ----------------------- # @@@ -662,22 -659,24 +659,24 @@@ AT_CHECK_CALC_GLR( AT_CHECK_CALC_GLR([%defines]) AT_CHECK_CALC_GLR([%locations]) AT_CHECK_CALC_GLR([%name-prefix "calc"]) + AT_CHECK_CALC_GLR([%define api.prefix "calc"]) AT_CHECK_CALC_GLR([%verbose]) AT_CHECK_CALC_GLR([%yacc]) -AT_CHECK_CALC_GLR([%error-verbose]) +AT_CHECK_CALC_GLR([%define parse.error verbose]) AT_CHECK_CALC_GLR([%define api.pure %locations]) -AT_CHECK_CALC_GLR([%error-verbose %locations]) +AT_CHECK_CALC_GLR([%define parse.error verbose %locations]) -AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR([%debug]) -AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) - AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) ++AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) -AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) -AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) ++AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) # ----------------------------- # @@@ -694,19 -693,18 +693,21 @@@ AT_CHECK_CALC([%skeleton "lalr1.cc" %de # Start a testing chunk which compiles `calc' grammar with # the C++ skeleton, and performs several tests over the parser. m4_define([AT_CHECK_CALC_LALR1_CC], -[AT_CHECK_CALC([%language "C++" %defines %locations] $@)]) +[AT_CHECK_CALC([%language "C++" %defines] $@)]) AT_CHECK_CALC_LALR1_CC([]) -AT_CHECK_CALC_LALR1_CC([%define location_type Span]) -AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%error-verbose %define api.prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR1_CC([%locations]) +AT_CHECK_CALC_LALR1_CC([%locations %define location_type Span]) +AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %define api.prefix "calc" %verbose %yacc]) ++AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) - AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) - AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) ++AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc]) ++AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) + +AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) ++AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) @@@ -728,12 -726,13 +729,14 @@@ m4_define([AT_CHECK_CALC_GLR_CC] AT_CHECK_CALC_GLR_CC([]) AT_CHECK_CALC_GLR_CC([%define location_type Span]) -AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR_CC([%error-verbose %define api.prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR_CC([%define parse.error verbose %name-prefix "calc" %verbose %yacc]) ++AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR_CC([%debug]) -AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) -AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) -AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) ++AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) diff --cc tests/headers.at index 36142cc9,07f1d1bc..8475a090 --- a/tests/headers.at +++ b/tests/headers.at @@@ -162,16 -165,20 +165,21 @@@ AT_BISON_CHECK([-d -o AT_SKEL_CC_IF([$1 AT_SKEL_CC_IF([], [AT_CHECK([$EGREP yy $1.h], [1])]) - # Ignore comments. Ignore YYPARSE_PARAM. YYDEBUG (not renamed) can be - # read, but not changed. + # Ignore comments. Ignore YYPARSE_PARAM (obsolete) and + # YYPUSH_MORE(_DEFINED)? (whose definition is constant). + # + # YYDEBUG (not renamed) can be read, but not changed. -AT_CHECK([[sed -ne 's,/\*[^*]*\*/,,g;s,//.*,,' \ - -e '/YY/p' ]$1.AT_SKEL_CC_IF([hh], [h])[ | +AT_CHECK([[$PERL -0777 -e 's{/\*.*?\*/}{}sg;s,//.*,,;' \ + ]$1.AT_SKEL_CC_IF([hh], [h])[ | + grep 'YY' | - $EGREP -wv '(YYPARSE_PARAM|defined YYDEBUG|if YYDEBUG)']], + $EGREP -wv 'YY(PARSE_PARAM|PUSH_MORE(_DEFINED)?)|(defined|if) YYDEBUG']], [1]) AT_LANG_COMPILE([$1.o]) + + AT_CHECK([[echo "$1" >>expout]]) + AT_BISON_OPTION_POPDEFS - ]) + ])# AT_TEST AT_DATA([main.cc], [AT_DATA_SOURCE_PROLOGUE