Joel E. Denny [Tue, 23 Mar 2010 15:07:46 +0000 (11:07 -0400)]
portability: fix spawning on at least FreeBSD 8 and FreeBSD 9.
Reported by Johan van Selst at
<http://lists.gnu.org/archive/html/bug-bison/2010-03/msg00014.html>.
* NEWS (2.4.3): New.
* THANKS (Johan van Selst): Add.
* gnulib: Update to latest.
(cherry picked from commit 311b2e56eaad952fc7908336e3aeb019dd8bf1ee)
Joel E. Denny [Sat, 20 Mar 2010 17:10:09 +0000 (13:10 -0400)]
Version 2.4.2.
* NEWS (2.4.2): Set version and date. For the recent test suite
portability fixes, don't be so optimistic about their success
given the lack of feedback on the affected platforms.
(cherry picked from commit 08090fe64c2956a4211fb5f6fd40762fe1f198b5)
Joel E. Denny [Tue, 23 Feb 2010 02:52:39 +0000 (21:52 -0500)]
tests: fix maintainer-xml-check for recent changes.
* tests/output.at (AT_CHECK_CONFLICTING_OUTPUT): Use
AT_BISON_CHECK_NO_XML rather than AT_BISON_CHECK because an
output file whose name conflicts with a previous output file
is now never generated.
(cherry picked from commit a3d760ef5d7d9bcab78268f5117c39566aa0345c)
Joel E. Denny [Mon, 22 Feb 2010 23:09:19 +0000 (18:09 -0500)]
portability: fix several issues with M4 subprocess.
M4's output pipe was not being drained upon fatal errors during
scan_skel. As a result, broken-pipe messages from M4 were seen
on at least AIX, HP-UX, Solaris, and RHEL4, and this caused a
failure in the test suite. The problem was that, on platforms
where the default disposition for SIGPIPE is ignore instead of
terminate, M4 sometimes saw fwrite fail with errno=EPIPE and
then reported it. However, there's some sort of race condition,
because the new test group occasionally succeeded.
Reported by Albert Chin at
<http://lists.gnu.org/archive/html/bug-bison/2010-02/msg00004.html>.
There were also problems with the test suite livelocking on
Tru64 5.1b. Reported by Didier Godefroy at
<http://lists.gnu.org/archive/html/bug-bison/2009-05/msg00005.html>.
Switching to create_pipe_bidi suggested by Akim Demaille.
To attempt to solve both of these problems, switch to gnulib's
create_pipe_bidi and register M4 process as a slave. Along the
way, clean up file name conflict handling, which was affected by
the broken-pipe problem before the switch.
* NEWS (2.4.2): Document.
* THANKS (Didier Godefroy): Add.
* bootstrap.conf (gnulib_modules): Add pipe.
* gnulib: Update to latest to make sure we have all the latest
fixes.
* lib/Makefile.am (libbison_a_SOURCES): Remove subpipe.h and
subpipe.c.
* po/POTFILES.in (lib/subpipe.c): Remove.
* src/files.c (compute_output_file_names): Update invocations
of output_file_name_check.
(output_file_name_check): In the case that the grammar file
would be overwritten, use complain instead of fatal, but replace
the output file name with /dev/null. Use the /dev/null solution
for the case of two conflicting output files as well because it
seems safer in case Bison one day tries to open both files at
the same time.
* src/files.h (output_file_name_check): Update prototype.
* src/output.c (output_skeleton): Use create_pipe_bidi and
wait_subprocess. Assert that scan_skel completely drains the
pipe.
* src/scan-skel.l (at_directive_perform): Update
output_file_name_check invocation.
* tests/output.at (AT_CHECK_CONFLICTING_OUTPUT): Check that the
grammar file actually isn't overwritten.
(Conflicting output files: -o foo.y): Update expected output.
* tests/skeletons.at (Fatal errors but M4 continues producing
output): New test group.
(cherry picked from commit 22cc8d813ee57c9631e527a31010ab138f9b7e06)
Joel E. Denny [Thu, 21 Jan 2010 17:18:45 +0000 (12:18 -0500)]
maint: automate PACKAGE_COPYRIGHT_YEAR update, and update it.
* HACKING (Release Procedure): Update notes on copyright years.
* Makefile.am (update-package-copyright-year): New target rule.
* build-aux/update-package-copyright-year: New file.
* cfg.mk (update-copyright): Add update-package-copyright-year
as a dependency.
(cherry picked from commit af8a609a90c48d1a7e6ea9e31dba4fbad6c7fbed)
Joel E. Denny [Mon, 4 Jan 2010 19:13:43 +0000 (14:13 -0500)]
Fix some comments concerning LR(0) versus LALR(1).
Stop equating LR(0) with nondeterminism and LALR(1) with
determinism. That is, if all states are consistent, then LR(0)
tables are deterministic. On the other hand, LALR(1) tables
might be nondeterministic before conflict resolution, and GLR
permits LALR(1) tables to remain nondeterministic.
* src/LR0.c, src/LR0.h: Here.
* src/lalr.c, src/lalr.h: Here.
* src/main.c (main): Here.
* src/state.c, src/state.h: Here.
* src/ielr.h (ielr): In preconditions, expect LR(0) not LALR(1)
parser tables.
Joel E. Denny [Wed, 30 Dec 2009 08:20:11 +0000 (03:20 -0500)]
POSIX: warn if %prec's token was not defined.
Reported by Florian Krohm at
<http://lists.gnu.org/archive/html/bug-bison/2009-12/msg00005.html>.
* NEWS (2.4.2): Document.
* src/reader.c (grammar_rule_check): Implement.
(grammar_current_rule_prec_set): Add comments explaining that we
here assume a %prec identifier is a token, but we still manage
to support POSIX.
* tests/input.at (%prec's token must be defined): New test
group.
(cherry picked from commit f1ceed07743630aa2aef7c77d8bde23c3794ee1b)
Akim Demaille [Thu, 11 Dec 2008 08:37:40 +0000 (09:37 +0100)]
Propagate i18n changes into glr.c.
* data/glr.c (yyreportSyntaxError): Use "switch" instead of
building the error message format dynamically.
* data/lalr1.java: Formatting changes.
(cherry picked from commit 2b008529edd233bac07a58d557869ae902be1818)
Akim Demaille [Thu, 21 Aug 2008 19:46:13 +0000 (21:46 +0200)]
Support i18n of the parse error messages.
* TODO (lalr1.cc/I18n): Remove.
* data/lalr1.cc (yysyntax_error_): Support the translation of the
error messages, as done in yacc.c.
Stay within the yy* pseudo namespace.
(cherry picked from commit a0ffc1751e712e55b27aa7349ec7db302557476b)
Joel E. Denny [Tue, 22 Dec 2009 20:44:29 +0000 (15:44 -0500)]
Port small part of master's 8901f32e so future ports are easier.
* data/lalr1.cc (yy::parser::yysyntax_error_): Always add second
argument, but name it in the function definition only when
verbose error messages are enabled and it'll thus be used.
(yy::parser::parse): Update use of yysyntax_error_.
Joel E. Denny [Tue, 29 Dec 2009 17:43:26 +0000 (12:43 -0500)]
portability: `<' and `>' are not always defined on addresses.
Specifically, don't sort objects by their memory addresses when
they're not allocated in the same array or other object. Though
I haven't found a test case where that fails on my platform, C
says the behavior is undefined.
* src/AnnotationList.c (AnnotationList__insertInto): Remove
FIXME. Use new id field of InadequacyList nodes rather than
their memory addresses when sorting.
(AnnotationList__compute_from_inadequacies): Add
inadequacy_list_node_count argument to pass to
InadequacyList__new_conflict.
* src/AnnotationList.h
(AnnotationList__compute_from_inadequacies): Update prototype
and documentation for new argument.
* src/InadequacyList.c (InadequacyList__new_conflict): Add
node_count argument and use it to assign a unique ID.
* src/InadequacyList.h (InadequacyListNodeCount): New typedef.
(InadequacyList): Add id field.
(InadequacyList__new_conflict): Update prototype and
documentation for new argument.
* src/ielr.c (ielr_compute_annotation_lists): Update
AnnotationList__compute_from_inadequacies invocation.
Joel E. Denny [Sun, 20 Dec 2009 07:22:53 +0000 (02:22 -0500)]
Fix handling of yychar manipulation in user semantic actions.
The problem was that yacc.c didn't always update the yychar
translation afterwards. However, other skeletons appear to be
fine. glr.c appears to already translate yychar before every
use. lalr1.cc does not define yychar and does not document its
replacement, yyla, for users. It does provide yyclearin, but
that does not manipulate yyla and thus requires no translation
update. In lalr1.java, yychar is out of scope during semantic
actions.
* NEWS (2.5): Document.
* data/yacc.c (YYBACKUP): Don't bother translating yychar into
yytoken here.
(yyparse, yypush_parse): Instead, translate before every use of
yytoken, and add comments explaining this approach.
* tests/actions.at (Destroying lookahead assigned by semantic
action): New test group checking that translation happens before
lookahead destructor calls at parser return. Previously,
incorrect destructors were called.
* tests/conflicts.at (%error-verbose and consistent
errors): New test group checking that translation happens at
syntax error detection before the associated verbose error
message and the associated lookahead destructor calls. While
the destructor call is fixed by this patch, the verbose error
message is currently incorrect due to another bug (see
comments in test group), so this is an expected failure for now.
(cherry picked from commit df222dfaf4da6becae8665d344669eefc705d7f7)
Joel E. Denny [Mon, 21 Dec 2009 19:58:48 +0000 (14:58 -0500)]
YYFAIL: warn about uses and remove from lalr1.java.
* NEWS (2.5): Document.
* data/lalr1.java (parser::YYStack::YYFAIL): Rename to YYERRLAB,
and make it private. Update all uses.
* src/scan-code.l (SC_RULE_ACTION): Implement warning.
(cherry picked from commit 4395a9ff4fd518580b9abe9482783e8eba192f34)
Joel E. Denny [Thu, 17 Dec 2009 06:09:09 +0000 (01:09 -0500)]
Code cleanup.
* src/symtab.c, src/symtab.h (symbol_class_get_string): Remove
function, which is no longer used.
(cherry picked from commit 387b4d504728391605f751e74a36fb7d0d441b19)
Joel E. Denny [Wed, 16 Dec 2009 18:19:19 +0000 (13:19 -0500)]
Add gcc's -Wundef to test suite and fix another warning from it.
* NEWS (2.4.2): Update description of -Wundef fix.
* configure.ac (WARN_CXXFLAGS_TEST): New substitution.
(WARN_CFLAGS_TEST): New substitution.
* data/glr.c: Avoid warning about __STRICT_ANSI__.
* tests/atlocal.in (CFLAGS): Use WARN_CFLAGS_TEST instead of
WARN_CFLAGS.
(NO_WERROR_CFLAGS): Likewise.
(CXXFLAGS): Use WARN_CXXFLAGS_TEST instead of WARN_CXXFLAGS.
(cherry picked from commit a603c6e0bb8b9e79d4136ee0fd0d1bf6a7d010ef)
Jonathan Nieder [Wed, 16 Dec 2009 04:07:46 +0000 (22:07 -0600)]
Simplify y.tab.c when location tracking is disabled.
* data/yacc.c: Do not check YYLTYPE_IS_TRIVIAL if location
tracking is not enabled. Instead, unconditionally define
YY_LOCATION_PRINT as a no-op for backward compatibility.
(cherry picked from commit fcd32abd3a4b68ef525d7766dbed1c98465e23b9)
Jonathan Nieder [Wed, 16 Dec 2009 04:03:18 +0000 (22:03 -0600)]
Avoid warnings from gcc -Wundef y.tab.c.
* data/glr.c: Check if YYENABLE_NLS and YYLTYPE_IS_TRIVIAL are
defined before using them.
* data/lalr1.cc: Likewise.
* data/yacc.c: Likewise.
(cherry picked from commit ae93128c9671b58bdc2b557c382ecd84e659ab52)
Joel E. Denny [Tue, 15 Dec 2009 05:15:41 +0000 (00:15 -0500)]
portability: use -DGNULIB_POSIXCHECK.
Reported by Eric Blake. See discussions at
<http://lists.gnu.org/archive/html/bug-bison/2009-09/msg00008.html>
and
<http://lists.gnu.org/archive/html/bug-gnulib/2009-10/msg00108.html>.
* HACKING (Release checks): Suggest -DGNULIB_POSIXCHECK.
* bootstrap.conf (gnulib_modules): Add all the printf modules
suggested by -DGNULIB_POSIXCHECK. Add realloc-posix as
suggested by -DGNULIB_POSIXCHECK for gnulib's own vasnprintf.c.
(excluded_files): Remove m4/printf-posix.m4.
* tests/atlocal.in (LIBS): As for LDADD in src/Makefile.am, add
lib/libbison.a so gnulib libraries can be linked.
(cherry picked from commit 5c99151aeb4396bf35b482e27075948c33088afa)
Joel E. Denny [Mon, 14 Dec 2009 23:04:57 +0000 (18:04 -0500)]
Enable assertion output and --disable-assert for configure.
* bootstrap.conf (gnulib_modules): Add assert module.
* src/system.h (aver): Define as assert, and summarize the
discussion on this issue.
(cherry picked from commit ca01f454f01645533622a59ef0df335ee07679e5)
Joel E. Denny [Mon, 14 Dec 2009 21:04:00 +0000 (16:04 -0500)]
Expand GLR acronym in summary of Bison.
Based on discussion with Akim Demaille starting at
<http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00087.html>.
* doc/bison.texinfo (Introduction): Here.
* src/getargs.c (usage): Here.
Joel E. Denny [Fri, 16 Oct 2009 23:27:12 +0000 (19:27 -0400)]
cleanup.
* src/Sbitset.c (Sbitset__new_on_obstack): Use Sbitset instead
of char*.
(Sbitset__isEmpty): Use Sbitset instead of char*.
* src/Sbitset.h (Sbitset): Make it a pointer to unsigned char
instead of char. This helps to avoid casting errors.
(Sbitset__or): Use Sbitset instead of char*.
(cherry picked from commit 5297ebb3bcdf4f957bdab9c5535c2c9c47f7dc07)
Joel E. Denny [Fri, 16 Oct 2009 23:20:43 +0000 (19:20 -0400)]
portability: don't assume 8-bit bytes.
That is, use CHAR_BIT and UCHAR_MAX instead of 8 and 0xff.
* src/Sbitset.h (Sbitset__nbytes): Here.
(Sbitset__byteAddress): Here.
(Sbitset__bit_mask): Here.
(Sbitset__last_byte_mask): Here.
(Sbitset__ones): Here.
(SBITSET__FOR_EACH): Here.
(cherry picked from commit 175620d3c65209ce72e451bd75756f6bb67e33a1)
Joel E. Denny [Mon, 5 Oct 2009 03:44:44 +0000 (23:44 -0400)]
Minor code cleanup.
* src/parse-gram.y: Clean up sorting of declarations.
Use types to simplify %printer declarations where possible.
Provide %printer for BRACKETED_ID and symbol.prec.
* src/symtab.c: Whitespace change.
(cherry picked from commit b143f4048fe39451ec739d956b4ca1f4fd8e694d)
Joel E. Denny [Mon, 5 Oct 2009 02:59:18 +0000 (22:59 -0400)]
tests: skip tests of file names that platform does not support.
Reported by Michael Raskin at
<http://lists.gnu.org/archive/html/bug-bison/2009-09/msg00001.html>.
* THANKS (Michael Raskin): Add.
* tests/output.at (AT_CHECK_OUTPUT_FILE_NAME): Fix. Cygwin used
to fail at least for file names containing ":" or "\".
(cherry picked from commit 2ceb8c617cac934b45f101ab44508d72239c894b)
Except when memory reallocation is required, this change
eliminates the need to invoke yysyntax_error twice and thus to
repeat the collection of lookaheads. It also prepares for
future extensions that will make those repetitions more
expensive and that will require additional memory management in
yysyntax_error. Finally, it fixes an obscure bug already
exercised in the test suite.
* data/yacc.c (yysyntax_error): Add arguments for message
buffer variables stored in the parser. Instead of size, return
status similar to yyparse status but indicating success of
message creation. Other than the actual reallocation of the
message buffer, import and clean up memory management code
from...
(yyparse, yypush_parse): ... here.
* tests/regression.at (%error-verbose overflow): No longer an
expected failure.
(cherry picked from commit 45319f1365eb8d125424f31401d9d33cc02ff4ad)
Joel E. Denny [Wed, 23 Sep 2009 21:53:15 +0000 (17:53 -0400)]
yysyntax_error: test memory management more.
* tests/atlocal.in (NO_WERROR_CFLAGS): New cpp macro.
* tests/regression.at (%error-verbose and YYSTACK_USE_ALLOCA):
New test group.
(%error-verbose overflow): New test group that reveals an
obscure bug. Expected fail for now.
(cherry picked from commit 52cea04ad36abf3ab684b88cba45d6c26dda80c9)
Akim Demaille [Wed, 10 Dec 2008 23:59:13 +0000 (00:59 +0100)]
Pass the token type to yysyntax_error.
* data/yacc.c (yysyntax_error): Take the transated token instead
of the raw number.
Adjust callers.
(cherry picked from commit 84eedf86fefd2496f288e72731bd0586e0b216f3)
Akim Demaille [Wed, 10 Dec 2008 23:59:13 +0000 (00:59 +0100)]
Simplify the i18n of the error messages.
* data/yacc.c (yysyntax_error): Rewrite, using a switch instead
of building dynamically the format string.
(cherry picked from commit eeb29422377c730846f784716f22be1759491bcf)
Joel E. Denny [Sat, 3 Oct 2009 15:53:05 +0000 (11:53 -0400)]
Remove dead code.
* src/symtab.c (symbol_pack): Here because every symbol's number
is always defined by this time.
(cherry picked from commit f74d6d25914371ed894583a69f99d547f9f283bf)
Joel E. Denny [Tue, 29 Sep 2009 10:54:38 +0000 (06:54 -0400)]
Use the correct conversion specifier for size_t.
Reported by Jim Meyering.
* src/Sbitset.h (SBITSET__INDEX__CONVERSION_SPEC): New, "zu"
because Sbitset__Index is size_t.
* src/Sbitset.c (Sbitset__fprint): Use it instead of %d.
(cherry picked from commit 47eced3099712180364f4e01b839242027d9a9d8)
Joel E. Denny [Sat, 26 Sep 2009 18:49:20 +0000 (14:49 -0400)]
tests: check that parse-gram.y's IELR and LALR are identical.
* tests/atlocal.in (abs_top_srcdir): New shell variable.
* tests/regression.at (parse-gram.y: LALR = IELR): New test
group.
(cherry picked from commit 43aabb70a95ecbd20c76797c53554641c3576db4)
Alex Rozenman [Sat, 19 Sep 2009 09:59:33 +0000 (12:59 +0300)]
Keep sub-messages aligned. Fix strings for translation.
* src/location.h: (location_print): Add return value.
* src/location.c: (location_print): Return number of printed
characters.
* src/complain.h: Two new functions (complain_at_indent,
warn_at_indent).
* src/complain.cpp: Implement the alignment mechanism. Add new
static variable (indent_ptr). Use and update it (error_message,
complain_at_indent, warn_at_indent).
* src/scan-code.l: Fix strings for translations. Use new *_indent
functions (parse_ref, show_sub_messages).
* tests/named-ref.at: Adjust testcases.
* NEWS (2.5): Add an announcement about named references.
Joel E. Denny [Sun, 13 Sep 2009 17:45:05 +0000 (13:45 -0400)]
tests: clean up push.at test group titles.
* tests/push.at: Remove "Push Parsing: " from test group titles
because these are already under the banner "Push Parsing Tests".
(cherry picked from commit 00d80a9cedbffda49212c0cdb90e90c27a561bb2)
Joel E. Denny [Sun, 6 Sep 2009 20:59:04 +0000 (16:59 -0400)]
Clean up yacc.c a little.
* data/yacc.c: Clean up M4 for readability, and make output
whitespace more consistent. For the main parse function
comment, instead of saying "yyparse or yypush_parse", say either
"yyparse" or "yypush_parse" depending on which it actually is.
(cherry picked from commit bb31eb56abd67c0ccf92244d160855ff06a336ac)
Joel E. Denny [Thu, 3 Sep 2009 17:59:07 +0000 (13:59 -0400)]
Use aver not assert.
* src/output.c: Don't include assert.h.
(output_skeleton): Use aver not assert.
* src/system.h (aver): In documentation of why, add links to
Paul Eggert's explanations in the mailing lists.
(cherry picked from commit 9789acf09124eb5ffbe5f0737261aec91b32ebd4)
Alex Rozenman [Sat, 5 Sep 2009 10:16:45 +0000 (13:16 +0300)]
Use "Unresolved reference" error message when no symbols were found
in a symbolic reference resolution. Remove .expr and -expr from
the shown reference when the reference is unresolved.
* src/scan-code.l: Change the error message, adjust location columns,
rename variable "exact_mode" to "explicit_bracketing".
* tests/named-ref.at: Adjust existing tests and add a new one.
Joel E. Denny [Sat, 29 Aug 2009 20:25:58 +0000 (16:25 -0400)]
Fix gcc 3.4.4 shadowing warning reported by Eric Blake.
See
<http://lists.gnu.org/archive/html/bison-patches/2009-08/msg00093.html>.
* src/scan-code.h (code_props_rule_action_init): Rename
named_ref arg to name so it doesn't shadow named_ref type. This
makes it consistent with the function definition in scan-code.l
anyway.
(cherry picked from commit 2646cd540bfdd35f457e0e0a1bcc5f9b26a96849)
Joel E. Denny [Thu, 27 Aug 2009 07:52:53 +0000 (03:52 -0400)]
tests: use perl for printing special sequences to files.
And skip tests if perl is not available. This is better than
playing tricks with shell portability. Suggested by Akim
Demaille.
* tests/input.at (Bad character literals): Use it here for
omitting final newlines.
(Bad escapes in literals): Use it here for special characters.
(cherry picked from commit b70c7fb4e1db54e78d4f3d4a0f110a81118ffc60)
Joel E. Denny [Wed, 26 Aug 2009 18:15:53 +0000 (14:15 -0400)]
tests: show a use of %define lr.default-reductions "consistent"
* tests/conflicts.at (%nonassoc and eof): Extend to test that it
prevents the omission of expected tokens for %error-verbose.
(cherry picked from commit d1cc31c5f04b81a3620fa291020ce23490f3f9e7)
Joel E. Denny [Wed, 26 Aug 2009 06:40:38 +0000 (02:40 -0400)]
Actually handle the yytable zero value correctly this time.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: Don't
mention zero values in the YYTABLE comments.
* data/glr.c (yytable_value_is_error): Don't check for zero
value.
* data/lalr1.cc (yy_table_value_is_error_): Likewise.
* data/yacc.c (yytable_value_is_error): Likewise.
* data/lalr1.java (yy_table_value_is_error_): Likewise.
(yysyntax_error): Fix typo in code: use yytable_ not yycheck_.
* src/tables.h: In header comments, explain why it's useless to
check for a zero value in yytable.
(cherry picked from commit aa0cb40d61cda5bfa9d325a45735439cbbd06327)
Joel E. Denny [Tue, 25 Aug 2009 23:41:49 +0000 (19:41 -0400)]
More fixes related to last two patches.
* data/c.m4 (b4_table_value_equals): Comment that YYID must be
defined.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: Fix
yytable comments: zero indicates syntax error not default
action.
* data/glr.c (yyis_pact_ninf): Rename to...
(yypact_value_is_default): ... this.
(yyisDefaultedState): Update for rename.
(yyis_table_ninf): Rename to...
(yytable_value_is_error): ... this, and check for value zero
besides just YYTABLE_NINF.
(yygetLRActions): Check for default value from yypact. It
appears that this check is always performed before this function
is invoked, and so adding the check here is probably redundant.
However, the code may evolve after this subtlety is forgotten.
Also, update for rename to yytable_value_is_error. Because that
macro now checks for zero, a different but equivalent branch of
the if-then-else here is evaluated.
(yyreportSyntaxError): Update for rename to
yytable_value_is_error. The zero condition was mishandled
before.
(yyrecoverSyntaxError): Update for renames. No behavioral
changes.
* data/lalr1.cc, data/lalr1.java (yy_pact_value_is_default_):
New function.
(yy_table_value_is_error_): New function.
(parse): Use new functions where possible. No behavioral
changes.
(yysyntax_error_, yysyntax_error): Use yy_table_value_is_error_.
The zero condition was mishandled before.
* data/yacc.c (yyis_pact_ninf): Rename to...
(yypact_value_is_default): ... this.
(yyis_table_ninf): Rename to...
(yytable_value_is_error): ... this, and check for value zero
besides just YYTABLE_NINF.
(yysyntax_error): Update for rename to yytable_value_is_error.
The zero condition was mishandled before.
(yyparse): Update for renames. No behavioral changes.
* src/tables.h: Improve comments about yypact, yytable, etc.
more. Most importantly, say yytable value of zero means syntax
error not default action.
(cherry picked from commit f2b30bdf3713e6fa9fafd0fc6caed68e38248ebc)
Joel E. Denny [Sat, 22 Aug 2009 00:09:54 +0000 (20:09 -0400)]
Use locale when quoting.
* src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER): Use
quote rather than implementing quoting here.
(cherry picked from commit e6c849d82a95be8a595c254cc3046cfae725f064)
Eric Blake [Thu, 20 Aug 2009 15:48:49 +0000 (09:48 -0600)]
Import latest m4/m4.m4.
* submodules/autoconf: Update to autoconf 2.64.
* configure.ac (M4_GNU_OPTION): New define.
* src/output.c (output_skeleton): Use it to resolve FIXME.
* NEWS: Mention this.
Joel E. Denny [Thu, 20 Aug 2009 00:37:28 +0000 (20:37 -0400)]
Fix complaints about escape sequences.
Discussed starting at
<http://lists.gnu.org/archive/html/bison-patches/2009-08/msg00036.html>.
* src/scan-gram.l (SC_ESCAPED_STRING, SC_ESCAPED_CHARACTER):
For a \0 and similar escape sequences meaning the null
character, report an invalid escape sequence instead of an
invalid null character because the latter does not actually
appear in the user's input.
In all escape sequence complaints, don't escape the initial
backslash, and don't quote when the sequence appears at the end
of the complaint line unless there's whitespace that quotearg
won't escape.
Consistently say "invalid" not "unrecognized".
Consistently prefer "empty character literal" over "extra
characters in character literal" warning for invalid escape
sequences; that is, consistently discard those sequences.
* tests/input.at (Bad escapes in literals): New.
(cherry picked from commit c2724603c9d87e816dbdf1a9bfd7d70ffc1bd137)
Joel E. Denny [Tue, 18 Aug 2009 22:29:54 +0000 (18:29 -0400)]
maint: update for gnulib's recent update-copyright changes
* gnulib: Update.
* .x-update-copyright (COPYING): Add as it's no longer implied
when .x-update-copyright is present.
* cfg.mk (update-copyright-local): Remove, now ignored.
(update-copyright): Declare update-b4-copyright as a dependency.
(cherry picked from commit c67e466f9d4f63d360d82dc23b9bfffb4d846209)
Akim Demaille [Mon, 17 Aug 2009 07:22:41 +0000 (09:22 +0200)]
build: lower gettext requirements.
Bison was uselessly requiring the formatstring macros from
gettext, which resulted in mo files not being installed on systems
that perfectly supported Bison mo files. Lower the requirement.
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html
* configure.ac: Require need-ngettext instead of
need-formatstring-macros.
Reported by Martin Jabocs.
Suggested by Bruno Haible.
* INSTALL: Restructure.
(Internationalization): New.
(cherry picked from commit b9e42bb439643b6b193ba44696c370bbb35d2ec0)
Joel E. Denny [Sun, 9 Aug 2009 00:19:01 +0000 (20:19 -0400)]
Make it easier to write deterministic tests.
Continues Akim's work from his 2009-06-10 commits.
* src/reader.c (check_and_convert_grammar): Don't add any
symbols after the first symbols_do invocation.
* src/symtab.c (symbols_sorted): New static global.
(user_token_number_redeclaration): Update comments.
(symbol_from_uniqstr): If a new symbol is being created, assert
that symbols_sorted hasn't been allocated yet.
(symbols_free): Free symbols_sorted.
(symbols_cmp, symbols_cmp_qsort): New functions.
(symbols_do): Sort symbol_table into symbols_sorted on first
invocation.
* tests/input.at (Numbered tokens): Recombine tests now that the
output should be deterministic across multiple numbers.
(cherry picked from commit 83b60c97ee1f98bb1f15ffa38acdc4cc765515f5)
Joel E. Denny [Tue, 11 Aug 2009 01:43:07 +0000 (21:43 -0400)]
Miscellaneous code readability improvements.
* src/reader.c (reader): Move %define front-end variable
defaults and checking into...
(prepare_percent_define_front_end_variables): ... this new
function.
* src/scan-gram.l (INITIAL): For consistency with string
literals, don't store open quote on character literal. It's
discarded before returning anyway.
(SC_ESCAPED_CHARACTER): Similarly, don't store close quote.
Make length test more readable, and make the character stored
for an empty literal more obvious while consistent with the
previous behavior.
* src/symtab.c, src/symtab.h: Rename USER_NUMBER_ALIAS to
USER_NUMBER_HAS_STRING_ALIAS throughout.
* src/symtab.c (symbol_make_alias): Remove comment from symtab.c
that is repeated in symtab.h. Improve argument names to make it
clear which side of the symbol-string alias pair is which.
(symbol_check_alias_consistency): Improve local variable names
for the same purpose.
* src/symtab.h (struct symbol): Make comments about aliases
clearer.
(symbol_make_alias): Improve comments and argument name.
* src/output.c (token_definitions_output): Update for rename to
USER_NUMBER_HAS_STRING_ALIAS and improve comments about aliases.
(cherry picked from commit dfaa48602d4e6d329e3ae9063f44929490928b3d)
Joel E. Denny [Thu, 6 Aug 2009 15:34:09 +0000 (11:34 -0400)]
maint: make update-b4-copyright easier to use
* build-aux/update-b4-copyright: In warnings, report line
numbers rather than character positions.
* cfg.mk (update-copyright-local): Set to update-b4-copyright so
that update-copyright runs it.
* gnulib: Update.
(cherry picked from commit a1a9422d4a2f70ff89e06318ba154851c3700f60)
Joel E. Denny [Wed, 5 Aug 2009 23:52:41 +0000 (19:52 -0400)]
maint: clean up update-b4-copyright code
* build-aux/update-b4-copyright: Do not accept 2-digit
UPDATE_COPYRIGHT_YEAR, which was not handled correctly.
Don't accept a `[' in a b4_copyright argument.
Format code more consistently.
Don't assume b4*copyright never occurs.
(cherry picked from commit 0b61a8ec1842bfbd6130714d06b758165b32ead4)