Akim Demaille [Mon, 25 Aug 2003 08:06:17 +0000 (08:06 +0000)]
Have lalr1.cc catch with Paul Eggert's patch to fix the infinite
error recovery loops. This patch is based on
<http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00000.html>.
Also, augment the similarity between lalr1.cc and yacc.c.
Note: the locations of error recovery rules are not correct yet.
* data/lalr1.cc: Comment changes to augment the similarity between
lalr1.cc and yacc.c.
(YYERROR): Goto to yyerrorlab, not yyerrlab1.
(yyerrlab1): Remove, but where it used to be (now the bottom part of
yyerrlab), when hitting EOF, pop the whole stack here instead of
merely falling thru the default error handling mechanism.
(yyerrorlab): New label, with the old contents of YYERROR,
plus the following change: pop the stack of rhs corresponding
to the production that invoked YYERROR. That is how Yacc
behaves (required by POSIX).
* tests/calc.at (AT_CHECK_CALC_LALR1_CC): No longer expected to
fail.
Akim Demaille [Mon, 25 Aug 2003 07:15:49 +0000 (07:15 +0000)]
Tune local.at so that people can "autom4te -l autotest calc.at -o
calc" for instance, to extract a sub test suite.
* tests/testsuite.at: Move the initialization, Autotest version
requirement, and AT_TESTED invocation into...
* tests/local.at: here.
* tests/testsuite.at: Include it for compatibility with Autoconf
2.57.
* tests/Makefile.am ($(TESTSUITE)): Report that the warning should
be ignore.
Paul Eggert [Sat, 26 Jul 2003 14:12:28 +0000 (14:12 +0000)]
(YYASSERT): New macro.
(yyfillin, yydoAction, yyglrReduce, yysplitStack,
yyresolveStates, yyprocessOneStack):
Use `YYASSERT (FOO);' rather than `if (! (FOO)) abort ();'.
Paul Eggert [Mon, 7 Jul 2003 03:46:28 +0000 (03:46 +0000)]
(operator<<(std::ostream&, const Position&)):
use s.empty() rather than s == "" to test for empty string; see
<http://mail.gnu.org/archive/html/bison-patches/2003-07/msg00003.html>
(trivial change)
Paul Eggert [Thu, 19 Jun 2003 08:45:55 +0000 (08:45 +0000)]
* data/glr.c (yyremoveDeletes, yy_reduce_print, yyglrReduce,
yyreportTree): Do not assume that size_t is the same width as int,
when printing sizes. Print sizes using an unsigned format.
Paul Eggert [Thu, 19 Jun 2003 08:45:16 +0000 (08:45 +0000)]
(yyremoveDeletes, yy_reduce_print, yyglrReduce, yyreportTree): Do not
assume that size_t is the same width as int, when printing sizes.
Print sizes using an unsigned format. Problem reported by Frank
Heckenbach in
<http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00035.html>.
Paul Eggert [Thu, 19 Jun 2003 07:38:39 +0000 (07:38 +0000)]
Port to Forte Developer 7 C compiler.
(struct YYLTYPE): If locations are not being used, declare a single
dummy member, as empty structs do not conform to the C standard.
(YYERROR, YYBACKUP): Do not use "do { ...; return foo; } while (0)";
the Forte Developer 7 C compiler complains that end-of-loop
code is not reached.
Paul Eggert [Tue, 17 Jun 2003 07:46:05 +0000 (07:46 +0000)]
(EXTRA_DIST): Add the following files, which
shouldn't be needed according to the gettext 0.12.1 documentation
but which seem to be needed anyway: codeset.m4 glibc21.m4
intdiv0.m4 inttypes-pri.m4 inttypes.m4 inttypes_h.m4
lcmessage.m4 nls.m4 po.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4.
Paul Eggert [Tue, 17 Jun 2003 07:25:48 +0000 (07:25 +0000)]
Do not include config.h; that's the includer's job.
Do not include <stdlib.h>.
(PARAMS): Define unconditionally for C89.
(ATTRIBUTE_NORETURN): Remove.
(ATTRIBUTE_UNUSED): Define unconditionally.
Paul Eggert [Tue, 17 Jun 2003 07:21:59 +0000 (07:21 +0000)]
Upgrade to 2003-06-08 libbitset; then:
(bitset_compatible_p): Indent as per GNU standard.
Don't use 'index' in comments, as it's a builtin fn on some hosts.
Paul Eggert [Tue, 17 Jun 2003 07:19:50 +0000 (07:19 +0000)]
Upgrade to 2003-06-08 libbitset; then:
Do not include config.h; that's the includer's job.
Do not include <sys/types.h>; shouldn't be needed on a C89 host.
Paul Eggert [Mon, 16 Jun 2003 19:45:45 +0000 (19:45 +0000)]
* configure.ac (AM_STDBOOL_H): Invoke this instead of AC_HEADER_STDBOOL.
(AM_GNU_GETTEXT): Put brackets around args, as latest manual suggests.
(AM_GNU_GETTEXT_VERSION): Update to 0.12.1.
Paul Hilfinger [Tue, 10 Jun 2003 02:44:58 +0000 (02:44 +0000)]
* data/glr.c (YYERROR): Update definition.
(yyrecoverSyntaxError): Correct yyerrState logic. Correct comment.
Allow states with only a default reduction.
Fixes to avoid problem that $-N rules in GLR parsers can cause
buffer overruns, corrupting state.
Fixes to problems with location handling in GLR parsers reported by
Frank Heckenbach (2003/06/05).
* data/glr.c (YYLTYPE): Make trivial if locations not used.
(YYRHSLOC): Add parentheses, make depend on whether locations used.
(YYLLOC_DEFAULT): Ditto.
(yyuserAction): Use YYLLOC_DEFAULT.
(yydoAction): Remove redundant code.
* tests/cxx-type.at: Exercise location information.
(yylex): Track locations.
(stmtMerge): Return value rather than printing.
Paul Eggert [Mon, 2 Jun 2003 08:19:29 +0000 (08:19 +0000)]
* data/lalr1.cc (yy::Position::lines, yy::Position::columns,
yy::Location::lines, yy::Location::columns): Rename arguments
to avoid shadowing; this removes a warning generated by GCC 3.3.
Paul Eggert [Mon, 2 Jun 2003 08:19:08 +0000 (08:19 +0000)]
(yy::Position::lines, yy::Position::columns,
yy::Location::lines, yy::Location::columns): Rename arguments
to avoid shadowing; this removes a warning generated by GCC 3.3.
Paul Eggert [Mon, 2 Jun 2003 07:25:30 +0000 (07:25 +0000)]
(WARNING_CXXFLAGS): New subst. Set it to
everything that WARNING_CFLAGS has, except omit warnings
not suitable for C++.
(AC_PROG_CXX): Use this instead of AC_CHECK_PROGS([CXX], [g++]).
Paul Eggert [Mon, 2 Jun 2003 06:18:31 +0000 (06:18 +0000)]
(yyfillin): Renamed from the old yyfill. Mark
as possibly unused.
(yyfill): New function.
(YYFILL): Use it.
(yyuserAction): Change type of yynormal to bool, so that it matches
the new yyfill signature. Mark it as possibly unused.
Paul Eggert [Mon, 2 Jun 2003 03:58:34 +0000 (03:58 +0000)]
(_AT_DATA_CALC_Y): Include unistd.h if available.
Define 'alarm' to do nothing if unistd.h is not available.
Add a new rule "exp: '-' error;" to test the above change to
data/yacc.c. Use 'alarm' to abort any test taking longer than
10 seconds, as it's probably looping.
(AT_CHECK_CALC): Test recovery from error in new grammar rule.
Also, the new yacc.c generates two fewer diagnostics for an
existing test.
Paul Eggert [Mon, 2 Jun 2003 03:57:39 +0000 (03:57 +0000)]
(YYERROR): Now just 'goto yyerrorlab', since the
macro's size was becoming unwieldy.
(yyerrlab): Do not discard an empty lookahead symbol, as this
might destroy garbage.
(yyerrorlab): New label, with the old contents of YYERROR,
plus the following change: pop the stack of rhs corresponding
to the production that invoked YYERROR. That is how Yacc
behaves, and POSIX requires this behavior.
(yyerrlab1): Use YYPOPSTACK instead of its definiens.
Paul Eggert [Sun, 25 May 2003 06:44:31 +0000 (06:44 +0000)]
* data/glr.c (YYSTACKEXPANDABLE): Do not evaluate
YYSTYPE_IS_TRIVIAL or YYSTYPE_IS_TRIVIAL unless they are defined.
This fixes a problem reported by John Bowman when the Compaq/HP
Alpha cxx compiler happy (e.g. using cxx -D__USE_STD_IOSTREAM
-ansi -Wall -gall).
* data/yacc.c (union yyalloc): Likewise.
(YYCOPY): Do not evaluate __GNUC__ unless it is defined.
Paul Eggert [Sun, 25 May 2003 06:44:08 +0000 (06:44 +0000)]
(union yyalloc): Do not evaluate
YYSTYPE_IS_TRIVIAL or YYSTYPE_IS_TRIVIAL unless they are defined.
This fixes a problem reported by John Bowman when the Compaq/HP
Alpha cxx compiler happy (e.g. using cxx -D__USE_STD_IOSTREAM
-ansi -Wall -gall).
(YYCOPY): Do not evaluate __GNUC__ unless it is defined.
Paul Eggert [Sun, 25 May 2003 06:43:19 +0000 (06:43 +0000)]
(YYSTACKEXPANDABLE): Do not evaluate
YYSTYPE_IS_TRIVIAL or YYSTYPE_IS_TRIVIAL unless they are defined.
This fixes a problem reported by John Bowman when the Compaq/HP
Alpha cxx compiler happy (e.g. using cxx -D__USE_STD_IOSTREAM
-ansi -Wall -gall).
Paul Eggert [Wed, 14 May 2003 19:30:22 +0000 (19:30 +0000)]
Require a semicolon after a grammar declaration, in the interest of
possible future changes to the Bison input language.
Do not allow a stray semicolon at the start of the grammar.
Allow one or more semicolons after any rule, including
just before "|" as required by POSIX.
Paul Eggert [Wed, 14 May 2003 19:26:16 +0000 (19:26 +0000)]
(rules_or_grammar_declaration): Require a
semicolon after a grammar declaration, in the interest of possible
future changes to the Bison input language.
Do not allow a stray semicolon at the start of the grammar.
(rhses.1): Allow one or more semicolons after any rule, including
just before "|" as required by POSIX.
* data/lalr1.cc (b4_parse_param_decl, b4_parse_param_cons,
b4_cc_constructor_calls, b4_cc_constructor_call,
b4_parse_param_vars, b4_cc_var_decls, b4_cc_var_decl): New m4
definitions.
(yy::b4_parser_class_name::b4_parser_class_name): Take extra
parse-param arguments.
(yy::b4_parser_class_name): Declare instance variables to
hold parse-param arguments.
* tests/calc.at: s/value/semantic_value/ because value clashes
with a member of yy::b4_parser_class_name. Adjust C++ code
to handle %parse-param. Enable %parse-param test in C++.
Paul Eggert [Mon, 12 May 2003 19:34:21 +0000 (19:34 +0000)]
(How Can I Reset @code{yyparse}): Reword the
English a bit. Fix fclose typo. Change "const char" to "char
const", and use ANSI C rather than K&R for "main". Suggest
YY_FLUSH_BUFFER over yyrestart (as that is what Flex recommends)
and suggest yy_switch_to_buffer.
Paul Eggert [Mon, 5 May 2003 20:39:04 +0000 (20:39 +0000)]
(__INT_TO_PTR): Define to a value that presumes C89.
This avoids a diagnostic on compilers that define __STDC__
to 0, fixing a problem with Tru64 cc reported by Martin Mokrejs in
<http://mail.gnu.org/archive/html/bug-bison/2003-04/msg00041.html>.
Paul Eggert [Sun, 4 May 2003 06:29:51 +0000 (06:29 +0000)]
(BITSET_FOR_EACH, BITSET_FOR_EACH_REVERSE):
Do not overrun array bounds.
This should fix a bug reported today by Olatunji Oluwabukunmi in
<http://mail.gnu.org/archive/html/bug-bison/2003-05/msg00004.html>.