Akim Demaille [Fri, 7 Dec 2012 08:58:40 +0000 (09:58 +0100)]
build: keep -Wmissing-declarations and -Wmissing-prototypes for modern GCCs
Fixes a -Werror failure of xalloc.h used in src.
From Eric Blake.
http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00006.html
* configure.ac: Check whether GCC pragma diagnostic push/pop works.
Enable these warnings for bison if it does.
Enable these warnings for the test suite anyway.
* origin/maint:
misc: pacify the Tiny C Compiler
cpp: make the check of Flex version portable
misc: require getline
c++: support wide strings for file names
doc: document carets
tests: enhance existing tests with carets
errors: show carets
getargs: add support for --flags/-f
* tests/actions.at: Unset value.
* tests/conflicts.at: Rule useless due to conflicts.
* tests/input.at: Missing terminator, unexpected end of file, command line
redefinition of variable.
* tests/named-refs.at: Many errors.
* tests/reduce.at: Useless nonterminals and rules.
* tests/regression.at: Large token.
Akim Demaille [Mon, 3 Dec 2012 15:27:23 +0000 (16:27 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
parser: accept #line NUM
m4: use a safer pattern to enable/disable output
tests: beware of gnulib's need for config.h
gnulib: update
yacc.c, glr.c: check and fix the display of locations
formatting changes
glr.c: remove stray macro
Akim Demaille [Mon, 3 Dec 2012 14:29:44 +0000 (15:29 +0100)]
m4: use a safer pattern to enable/disable output
Work on some other areas of Bison revealed that some macros expanded
to be expanded only once were actually expanded several times. This
was due to the fact that changecom was not properly restored each
time, and macro names appearing in comments were then expanded.
Introduce begin/end macros which are easier to match that
changecom()/changecom(#).
Akim Demaille [Fri, 30 Nov 2012 10:19:43 +0000 (11:19 +0100)]
yacc.c, glr.c: check and fix the display of locations
In some case, negative column number could be displayed.
Make YY_LOCATION_PRINT similar to bison's own implementation of
locations. Since the macro is getting fat, make it a static
function.
Reported by Jonathan Fabrizio.
* data/c.m4 (yy_location_print_define): Improve the implementation,
and generate the yy_location_print_ function.
Adjust YY_LOCATION_PRINT.
* tests/actions.at (Location Print): New tests.
Akim Demaille [Fri, 30 Nov 2012 10:19:33 +0000 (11:19 +0100)]
formatting changes
* data/c.m4: Fix comments, put macros in a more natural order.
Space changes (from M-x whitespace-cleanup).
* src/location.c: Fix spaces.
* tests/actions.at: Space changes.
Akim Demaille [Thu, 29 Nov 2012 13:54:37 +0000 (14:54 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
doc: minor fixes
doc: improve the index
doc: introduce api.pure full, rearrange some examples
yacc.c: support "%define api.pure full"
local.at: improvements
doc: introduce api.pure full, rearrange some examples
* NEWS: Add entry.
* doc/bison.texi (%define Summary): Show the old Yacc behaviour.
(Parser Function): Move parse-param examples here.
(Pure Calling): Remove parse-param examples.
(Error Reporting): Don't show the old behavior, stick to 'full'.
* tests/local.at (AT_YYERROR_FORMALS): Make llocp const.
(AT_PURE_AND_LOC_IF, AT_GLR_OR_PARAM_IF): Remove, expand...
(AT_YYERROR_ARG_LOC_IF): Here, and use m4_join for readability.
Akim Demaille [Mon, 26 Nov 2012 08:14:51 +0000 (09:14 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
yacc.c: always initialize yylloc
scanner: issue a single error for groups of invalid characters
tests: formatting changes
doc: one of the fixes for an ambiguous grammar was ambiguous too
doc: fix the dangling else with precedence directives
doc: prefer "token" to TOKEN
doc: formatting changes
scanner: use explicit "ignore" statements
Akim Demaille [Mon, 26 Nov 2012 08:05:28 +0000 (09:05 +0100)]
Merge remote-tracking branch 'origin/branch-2.6' into maint
* origin/branch-2.6:
yacc.c: always initialize yylloc
doc: one of the fixes for an ambiguous grammar was ambiguous too
doc: fix the dangling else with precedence directives
doc: prefer "token" to TOKEN
doc: formatting changes
The initial location might be used if the parser starts by an empty
reduction, so really ensure proper initialization of the initial
location. The previous approach fails for PostgreSQL, which uses
Reported by Peter Eisentraut.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00023.html
With help from Théophile Ranquet.
* data/yacc.c (b4_declare_scanner_communication_variables): Be sure
to initialize yylloc, even when its structure is unknown.
(yyparse): Simplify the call to b4_dollar_pushdef.
* tests/actions.at (Initial location): Check of similar pattern
as in the case of PostgreSQL.
Akim Demaille [Tue, 13 Nov 2012 09:59:55 +0000 (10:59 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
tests: close files in glr-regression
xml: match DOT output and xml2dot.xsl processing
xml: factor xslt space template
graph: fix a memory leak
xml: documentation
output: capitalize State
Make the DOT produced by XSLT processing equivalent to the one made with the
--graph option.
* data/xslt/xml2dot.xsl: Stylistic changes, and add support for reductions.
* doc/bison.texi (Xml): Update.
* src/graphviz.c (conclude_red): Minor stylistic changes to DOT internals.
(output_red): Swap enabled and disabled reductions output, for coherence
with XSLT output.
* src/print_graph.c (print_core): Minor stylistic change to States' output.
(print_actions): Swap order of output for reductions and transitions.
* tests/local.at (AT_BISON_CHECK_XML): Ignore differences in order.
* tests/output.at: Adjust to changes in DOT internals.
Akim Demaille [Mon, 12 Nov 2012 08:45:30 +0000 (09:45 +0100)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
maint: address syntax-check errors.
tests: use valgrind where appropriate
tests: use valgrind where appropriate
tests: don't expect $EGREP to support -w
tests: more possible error compiler messages for "#error"
Akim Demaille [Mon, 12 Nov 2012 08:39:41 +0000 (09:39 +0100)]
maint: address syntax-check errors.
* cfg.mk: Ignore the "error" call in tests/c++.at, it is not to be
translated.
* doc/bison.texi: Fix incorrect @pxref use.
* po/POTFILES.in: Add missing file.
* src/print_graph.c: Remove useless include.
Akim Demaille [Sat, 10 Nov 2012 08:26:40 +0000 (09:26 +0100)]
tests: use valgrind where appropriate
Reported by Théophile Ranquet.
* tests/glr-regression.at: Rewrite some test cases so that AT_PARSER_CHECK,
which runs valgrind, is exposed with the parser, not with "echo".
* tests/local.at, tests/regression.at, tests/headers.at:
Use AT_PARSER_CHECK for generated parsers.
Akim Demaille [Thu, 8 Nov 2012 18:34:29 +0000 (19:34 +0100)]
tests: don't expect $EGREP to support -w
Does not work on Solaris 10. Reported by Dennis Clarke.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00009.html
* tests/headers.at (Several parsers): Use Perl instead.
While at it, run it only once, on all the generated headers.
Adjust to YY_NULL be defined in position.hh.
Akim Demaille [Thu, 8 Nov 2012 08:24:51 +0000 (09:24 +0100)]
Merge branch 'maint'
* origin/maint:
regen
maint: post-release administrivia
version 2.6.5
regen
tests: syntax-check
tests: beware of compilers that do not support POSIXLY_CORRECT
gnulib: update
Akim Demaille [Thu, 8 Nov 2012 08:20:48 +0000 (09:20 +0100)]
Merge branch 'branch-2.6' into maint
* origin/branch-2.6:
maint: post-release administrivia
version 2.6.5
regen
tests: syntax-check
tests: beware of compilers that do not support POSIXLY_CORRECT
gnulib: update
Akim Demaille [Wed, 7 Nov 2012 16:23:06 +0000 (17:23 +0100)]
tests: beware of compilers that do not support POSIXLY_CORRECT
Running "maintainer-release-check" on OS X with Clang 2.9 fails,
because "clang-mp-2.9 -o test -g test.c" launches "/usr/bin/dsymutil
test -o test.dSYM" which fails with "error: unable to open executable
'-o'".
* m4/c-working.m4 (BISON_CHECK_WITH_POSIXLY_CORRECT)
(BISON_C_COMPILER_POSIXLY_CORRECT): New.
* configure.ac: Use the latter.
* tests/atlocal.in (POSIXLY_CORRECT_IS_EXPORTED): New.
* tests/local.at (AT_BISON_CHECK_WARNINGS_): Use it instead of computing its
value each time.
(AT_QUELL_VALGRIND): Skip tests that cannot work because of compilers
that do not support POSIXLY_CORRECT.
Akim Demaille [Tue, 6 Nov 2012 15:25:37 +0000 (16:25 +0100)]
tests: calc: modernize the use of locations
* tests/calc.at: Don't initialize the location, let the parser
do it.
Use a $printer.
Change some testing input to be easier to distinguish (instead of always
"0 0" for instance).
Akim Demaille [Tue, 6 Nov 2012 14:34:51 +0000 (15:34 +0100)]
glr.cc, yacc.c: initialize yylloc properly
There are several issues to address here. One is that yylloc should
be initialized when possible. Another is that the push parser needs
to update yypushed_loc when the user modified it. And if the parser
starts by a reduction of an empty, it uses the first location on the
stack, which, therefore, must also be initialized to this initial
location.
This is getting complex, especially since because initializing a
global (impure interface) is different from initializing a local
variable. To simplify, the local yylloc is not initialized during its
definition.
* data/c.m4 (b4_yyloc_default_define): Replace by...
(b4_yyloc_default): this.
Adjust dependencies.
* data/glr.cc: Initialize yylloc.
* data/yacc.c (b4_declare_scanner_communication_variables):
Initialize yylloc during its definition.
Don't define yyloc_default.
(yypush_parse): The location formal is not const, as we might
initialize it.
(yyparse): Define yyloc_default.
Use it before running the user initial action.
Possibly update the first location on the stack, and the pushed
location after the user initial action.
* tests/actions.at (Initial locations): Check that the initial
location is correct.
Akim Demaille [Mon, 5 Nov 2012 15:58:24 +0000 (16:58 +0100)]
yacc.c, glr.c: a better YY_LOCATION_PRINT
* data/c.m4 (b4_yy_location_print_define): New.
Now issues "short" locations, e.g., "1.1" instead of "1.1-1.1".
Was initially a function, but then we face "static but unused"
warnings.
Simpler as a macro.
* tests/local.at, data/glr.c, data/yacc.c: Use it instead of duplicating.
* tests/actions.at: Adjust expectations.
Akim Demaille [Mon, 5 Nov 2012 14:19:45 +0000 (15:19 +0100)]
yacc.c: simplify initialization
* data/yacc.c: Fuse the initializations of yyssp, yyss and the like.
Remove an obsolete comment: we do initialize these initial stack
members (in some cases).
Akim Demaille [Sat, 3 Nov 2012 16:15:43 +0000 (17:15 +0100)]
tests: fix locations in C
* tests/local.at (AT_YYERROR_DEFINE): Don't display the end of the location
if it is not after its beginning.
* tests/actions.at, tests/cxx-type.at: Adjust the expected output.
Akim Demaille [Sat, 3 Nov 2012 09:05:03 +0000 (10:05 +0100)]
tests: handle %parse-param in the generated yyerror
* tests/local.at (AT_PARSE_PARAMS): New.
(AT_YYERROR_FORMALS, AT_YYERROR_DEFINE): Use it to add the parse-param
to yyerror.
* tests/calc.at, tests/regression.at: Use AT_YYERROR_DEFINE and
AT_YYERROR_DECLARE, now that they handle properly the parse-params.
Be sure to let AT_BISON_OPTION_PUSHDEFS now what parse-params are used.
Akim Demaille [Thu, 1 Nov 2012 16:54:13 +0000 (17:54 +0100)]
lalr1.cc: rename lex_symbol as api.token.constructor
* data/bison.m4 (b4_lex_symbol_if): Rename as...
(b4_token_ctor_if): this.
Depend upon api.token.constructor.
* data/c++.m4, data/lalr1.cc: Adjust.
* doc/bison.texi: Fix all the occurrences of lex_symbol.
* etc/bench.pl.in: Adjust.
* examples/variant.yy: Likewise.
* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Handle AT_TOKEN_CTOR_IF.
* tests/c++.at: Adjust to using api.token.constructor and AT_TOKEN_CTOR_IF.
Simplify the test of both build call styles.
(AT_CHECK_VARIANTS): Rename as...
(AT_TEST): this.
And undef when done.
Akim Demaille [Fri, 26 Oct 2012 09:25:41 +0000 (11:25 +0200)]
yacc.c: initialize yylval and yylloc.
When generating a pure push parser, the initialization of yylval and
yylloc may not be visible to the compiler. With warnings enabled, GCC
4.3.6, 4.4.7, 4.5.4, and 4.6.3 report uninitialized uses of
yylval/yylloc. Using local pragmas to disable these warnings is not
supported before 4.6, and 4.6 does not support it properly. So
initialize yylval and yylloc at their definition. Reported by Peter
Simons. See
http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00133.html
* data/c.m4 (b4_yyloc_default_define): New.
* data/yacc.c: Use it when locations are requested.
(YYLVAL_INITIALIZE): Replace by...
(YY_INITIAL_VALUE): this.
(yyparse): Initialize yylloc and yylval.
Therefore, remove the initialization of yylloc's field.
* data/glr.c: Likewise.