Victor Santet [Tue, 19 Jun 2012 14:14:55 +0000 (16:14 +0200)]
warnings: used but undeclared symbols are warnings
We used to raise an error if a symbol appears only in a %printer or
%destructor. Make it a warning.
* src/symtab.h (status): New enum.
(symbol): Replace the binary "declared" with the three-state "status".
Adjust dependencies.
* src/symtab.c (symbol_check_defined): Needed symbols are an error,
whereas "used" are simply warnings.
* src/symlist.c (symbol_list_destructor_set, symbol_list_printer): Set
symbol status to 'used' when associated to destructors or printers.
* input.at (Undeclared symbols used for a printer or destructor): New.
Akim Demaille [Tue, 19 Jun 2012 15:35:53 +0000 (17:35 +0200)]
Merge remote-tracking branch 'origin/maint'
* origin/maint:
maint: formatting changes.
tests: support api.prefix.
tests: pacify font-lock-mode.
tests: remove test covered elsewhere.
tests: factor the declaration/definition of yyerror and yylex.
regen.
tests: portability issues.
tests: call the parser from another compilation unit.
glr.c, yacc.c: declare yydebug in the header.
skeletons: use header guards.
tests: improve AT_FULL_COMPILE.
tests: reorder.
tests: strengthen the test on generated headers inclusion
yacc.c: instead of duplicating y.tab.h inside y.tac.c, include it.
yacc.c: factor.
Akim Demaille [Mon, 11 Jun 2012 14:47:46 +0000 (16:47 +0200)]
tests: call the parser from another compilation unit.
In order to improve the testing of %defines, which exports the
interface of the generated parser, change the calc.at tests so that
when %defines is passed, main will be in another compilation unit. It
loads the generated header.
* tests/calc.at (AT_CALC_MAIN): New.
Includes the definition of the global variables.
Therefore, now declare them from the %requires section of the parser.
Adjust to yydebug and yyparse being renamed by %name-prefix.
Akim Demaille [Fri, 15 Jun 2012 13:19:16 +0000 (15:19 +0200)]
glr.c, yacc.c: declare yydebug in the header.
* data/c.m4 (b4_declare_yydebug): New.
* data/glr.c, data/yacc.c (b4_shared_declarations): Use it.
Remove the corresponding code from the parser body.
* NEWS: Doc this.
Akim Demaille [Tue, 12 Jun 2012 12:40:18 +0000 (14:40 +0200)]
yacc.c: factor.
yacc.c used to include two almost identical sections: one for the *.h
file, and another for the *.c file. The main difference is that in
the *.c file we used the yy* names (as %name-prefix is handled by
"#define yy* <prefix>*" before), while the *.hh used <prefix>* names.
Keep only the later. If this is troublesome, b4_shared_declarations
can easily take the desired prefix as argument.
* data/yacc.c (b4_shared_declarations): New.
Use it to factor duplicated declarations.
Akim Demaille [Tue, 12 Jun 2012 08:55:18 +0000 (10:55 +0200)]
skeletons: factor yacc.c and glr.c.
yacc.c and glr.c share common declarations. Their YYLTYPE are exactly
equal, and their YYSTYPE are sufficiently alike to be fused (its
declaration was protected by YYSTYPE_IS_DECLARED in yacc.c, but not in
glr.c). Besides, yacc.c duplicated the definitions of YYLTYPE and
YYSTYPE (*.h/*.c).
* data/c.m4 (b4_declare_yylstype): New.
* data/yacc.c, data/glr.c: Use it.
Akim Demaille [Tue, 5 Jun 2012 15:46:58 +0000 (17:46 +0200)]
maint: don't use mbsr?chr.
Basically, revert ba60c39547a445dee3e07920931b4d7a81843868's move to
mbs* functions, which was prompted by -DGNULIB_POSIXCHECK. See
<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00052.html>
and following.
* bootstrap.conf: No longer ask for them.
* src/files.c, src/getargs.c, src/location.c,
* src/parse-gram.c, src/parse-gram.y, src/scan-gram.l,
* src/symtab.c: s/mbs(r?chr)/str$1/g.
Akim Demaille [Tue, 5 Jun 2012 15:26:55 +0000 (17:26 +0200)]
maint: use xconcat-filename.
* bootstrap.conf (gnulib_modules): Request it.
* src/output.h, src/output.c (compute_pkgdatadir): Rename as...
(pkgdatadir): this.
Adjust dependencies.
* src/output.c (output_skeleton): Reduce the scope of "in".
Use xconcatenated_filename to simplify the construction of the
qualified paths to m4sugar.m4, bison.m4, and the selected skeleton.
There are a few minor differences: the new code uses strchr instead of
mbschr (but this was not really justified), and the new code does not
garantee a single slash even if $BISON_PKGDATADIR ends with several
(which was considered more accurate). See the discussion at
<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00052.html>.
Jim Meyering [Tue, 5 Jun 2012 07:02:36 +0000 (09:02 +0200)]
maint: fix comment typos
Using http://github.com/lyda/misspell-check, massage its
output into sed commands to perform the suggested changes.
Initially, I filtered out the THRU->Through changes, because
that failed to retain capitalization in the grammar token.
Instead, do this manually, beforehand:
Akim Demaille [Thu, 24 May 2012 11:37:28 +0000 (13:37 +0200)]
Merge tag 'v2.5.1_rc2'
Bison 2.5.1_rc2.
* tag 'v2.5.1_rc2': (34 commits)
Bison 2.5.1_rc2.
doc: fixes.
build: fix ChangeLog generation.
c++: compute the header guards.
skeletons: remove support for unused directive.
lalr1.cc: improve Doxygen documentation.
lalr1.cc: extract stack.hh.
news: convert to double quotes.
space changes.
build: do not prototype flex-generated functions.
build: fix ChangeLog generation.
Bison 2.5.1_rc1.
tests: save/restore Autotest special files when checking XML support.
tests: AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES.
tests: honor TESTSUITEFLAGS in all the check targets.
build: do not enable c++ warnings on 0 when nullptr is not supported.
maint: update gnulib.
build: config.in.h.
build: move silent rules.
glr.c: reduce variable scopes.
maint: maintainer-release-check.
maint: shush a syntax-check.
maint: prefer "commit message" to "log entry".
command line: fix minor leaks.
maint: we no longer maintain the ChangeLog.
maint: fix the generation of the synclines for bison's parser.
maint: regen.
maint: import the xmemdup0 gnulib module.
maint: remove left-over gnulib modules.
maint: ignore files imported by autopoint.
build: AC_PROG_LEX: use more readable variable names.
maint: regen src/parse-gram.[ch]
maint: simplify parse-gram.y
maint: s/strncpy/memcpy/, when equivalent
Akim Demaille [Tue, 15 May 2012 09:22:34 +0000 (11:22 +0200)]
build: do not prototype flex-generated functions.
Some versions of Flex, possibly modified by the distribution package
maintainers, have incompatible signatures. Since newer versions of
Flex prototype their functions, avoid the conflicts in that case.
Reported by Stefano Lattarini.
<http://lists.gnu.org/archive/html/bug-bison/2012-05/msg00012.html>.
* src/flex-scanner.h (FLEX_VERSION_GT): New.
Use it to issue prototypes for flex-generated functions only for
versions up to 2.5.31, in accordance with the comment.
See commit dc9701e848f27ae64b6ddcf809580998667d60f2.
Use it to define yylex_destroy when needed.
Akim Demaille [Fri, 11 May 2012 15:11:09 +0000 (17:11 +0200)]
tests: save/restore Autotest special files when checking XML support.
Currently the test 248, "parse-gram.y: LALR = IELR", fails
BISON_TEST_XML is set.
* tests/local.at (AT_BISON_CHECK_XML): Belt: Save/restore files.
* tests/regression.at (parse-gram.y: LALR = IELR): Suspenders: Don't
rely on expout.
Each one of these changes suffices.
Some of our macros play with expout and other Autotest special files,
which may break their callers (e.g., currently TESTSUITEFLAGS='248
BISON_TEST_XML=1' fails).
There is already some support for this. Expand it to be ready to use
it elsewhere.
* tests/local.at (AT_RESTORE_SPECIAL_FILES, AT_SAVE_SPECIAL_FILES)
(at_save_special_files, at_restore_special_files): New.
(AT_BISON_CHECK_NO_XML): Use them.
Akim Demaille [Wed, 9 May 2012 09:00:32 +0000 (11:00 +0200)]
build: config.in.h.
Historically we used config.hin (where everybody else used
config.h.in) to please DOS. Now that we use gnulib, there are already
tons of files with several dots, especially *.in.h.
Akim Demaille [Sun, 9 Jan 2011 10:06:23 +0000 (11:06 +0100)]
glr.c: reduce variable scopes.
* data/glr.c: Where appropriate, fuse variable declarations followed
by assignments by variable declarations with a value.
Where appropriate, introduce new scopes to limit variable spans.
Jim Meyering [Sat, 5 May 2012 09:30:01 +0000 (11:30 +0200)]
maint: s/strncpy/memcpy/, when equivalent
* src/output.c (output_skeleton): Use memcpy, not strncpy,
since the source is known to fit in the destination buffer.
* src/parse-gram.y (%skeleton): Likewise.
The Hydra buildfarm provides code coverage analysis. For some reason,
in some test cases, code coverage data seem to be incompatible, and
generate error messages at parser run-time. Ignore these messages so
that (i) these tests do pass, (ii) coverage results be provided by
Hydra.
* tests/local.at (AT_PARSER_CHECK): Ignore messages for failed merges
of code coverage/profiling results.
* gnulib: Fix install-pdf in po/ and runtime-po/.
Reported by Hans Aberg.
Fixed by Joel E. Denny.
http://lists.gnu.org/archive/html/bug-bison/2011-05/msg00008.html
lalr1.cc used to support yyo, but not yyoutput. Support both,
but document only yyoutput (at least until there is some consensus
on this).
* data/c.m4 (yy_symbol_value_print): Also support yyo.
* data/glr.cc (yy_symbol_value_print_): Support both yyo and yyoutput.
* data/lalr1.cc: Also support yyoutput.
* doc/bison.texinfo: Explicitly use yyoutput in the examples.
* examples/mfcalc/mfcalc.test: Test the -p option.
(cherry picked from commit c50263271db482261b11f7452283c142a780a09d)
* doc/bison.texinfo (Printer Decl): New.
Number mfcalc.y snippets so that they are output in
the proper order.
(The mfcalc Main): Use yydebug.
(Debugging): Simplify the text.
(Enabling Traces, Mfcalc Traces, The YYPRINT Macro): New.
(Table of Symbols): Document YYPRINT and YYFPRINTF.
* tests/input.at: Use "print" in %printer instead of "destroy".
It is unused, so we don't care, yet it is less surprising.
* tests/actions.at: Comment changes.
lalr1.cc used to support yyo, but not yyoutput. Support both,
but document only yyoutput (at least until there is some consensus
on this).
* data/c.m4 (yy_symbol_value_print): Also support yyo.
* data/glr.cc (yy_symbol_value_print_): Support both yyo and yyoutput.
* data/lalr1.cc: Also support yyoutput.
* doc/bison.texinfo: Explicitly use yyoutput in the examples.
* examples/mfcalc/mfcalc.test: Test the -p option.
* doc/bison.texinfo (Printer Decl): New.
Number mfcalc.y snippets so that they are output in
the proper order.
(The mfcalc Main): Use yydebug.
(Debugging): Simplify the text.
(Enabling Traces, Mfcalc Traces, The YYPRINT Macro): New.
(Table of Symbols): Document YYPRINT and YYFPRINTF.
* tests/input.at: Use "print" in %printer instead of "destroy".
It is unused, so we don't care, yet it is less surprising.
* tests/actions.at: Comment changes.