Commit Graph

527 Commits

Author SHA1 Message Date
Paul Eggert
62c4328e00 Don't rely on whether alloc is #defined; that is in the user's name spac. 2005-09-21 20:08:38 +00:00
Paul Eggert
0d50976f3c More alloca cleanups.
* bootstrap (gnulib_modules): Remove alloca.  Bison doesn't need
it itself.
* src/main.c (main) [C_ALLOCA]: Don't flush alloca'ed memory; we
don't use alloca any more.

* data/yacc.c [YYSTACK_USE_ALLOCA && !defined __GNUC__ && ! defined
__BUILTIN_VA_ARG_INCR && ! defined _AIX && ! defined _MSC_VER &&
(defined alloca || defined _ALLOCA_H)]: Don't include <stdlib.h>;
not needed in this case.
* tests/torture.at (Exploding the Stack Size with Alloca): Adjust
to match yacc.c, to test more hosts.
2005-09-21 19:54:48 +00:00
Paul Eggert
a9739e7c4c * tests/glr-regression.at (Duplicated user destructor for lookahead):
Mark it as expected to fail.
Cast result of malloc; problem reported by twlevo@xs4all.nl.
* tests/actions.at, tests/calc.at, tests/glr-regression.at:
Don't start user-code symbols with "yy", to avoid name space problems.
2005-09-19 21:08:21 +00:00
Akim Demaille
e2586f82b0 * tests/atlocal.in (LIBS): Pass INTLLIBS to address failures on at
least Mac OSX with a /usr/local install of gettext.
2005-09-19 07:22:17 +00:00
Paul Eggert
1bd0dedaaa * NEWS: Version 2.1.
* NEWS: Remove notice of yytname change, since it was never in an
official release.
* data/glr.c (yydestroyGLRState): Rename local var to avoid shadowing
diagnostic.
* src/output.c (prepare): Likewise.
* data/lalr1.cc (YYERROR_VERBOSE_IF): New macro.
(yysyntax_error_): Use it to avoid GCC warning when YYERROR_VERBOSE
is not defined.  This is an awful hack, but it's enough for now.
All callers changed.
* tests/glr-regression-at (make_value): Args are const pointers now,
to avoid GCC warning.
(Duplicated user destructor for lookahead): New test.  Currently
skipped.  It fails on my host but I'm not sure it'll always fail.
2005-09-16 22:54:21 +00:00
Paul Eggert
7812f29985 (Duplicate representation of merged trees): Add casts to pacify g++. 2005-09-08 18:41:46 +00:00
Paul Eggert
42a6501d1a * data/glr.c (yydestroyGLRState): Renamed from yydestroyStackItem.
All uses changed.  Invoke user destructor after an error during a
split parse (trivial change from Joel E. Denny).

* tests/glr-regression.at
(User destructor after an error during a split parse):  New test case.
Problem reported by Joel E. Denny in:
http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00029.html
2005-08-26 20:16:16 +00:00
Akim Demaille
e6efa9dacc * tests/local.at (AT_COMPILE_CXX): Pass $LINKS too. 2005-08-25 08:53:33 +00:00
Paul Eggert
adc90f13ab * data/glr.c (yyrecoverSyntaxError, yyreturn):
Don't invoke destructor on unresolved entries.
* tests/glr-regression.at
(User destructor for unresolved GLR semantic value): New test case.
Problem reported by Joel E. Denny in:
http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00016.html
2005-08-25 06:11:35 +00:00
Paul Eggert
dd5f2af2bd * data/glr.c (yyreturn): Use "Cleanup:" rather than "Error:"
in yydestruct diagnostic, since it might not be an error.
Problem reported by Joel Denny near end of
<http://lists.gnu.org/archive/html/help-bison/2005-07/msg00040.html>.
* data/lalr1cc (yyerturn): Likewise.
* data/yacc.c (yyreturn): Likewise.
* tests/calc.at (_AT_CHECK_CALC_ERROR): Adjust to the above change.
2005-08-22 02:31:10 +00:00
Paul Eggert
f9315de5a4 * data/glr.c (yyresolveValue): Fix redundant parse tree problem
reported by Joel E. Denny in
<http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00004.html>
(trivial change).
* tests/glr-regression.at (Duplicate representation of merged trees):
New test, from Joel E. Denny in:
<http://lists.gnu.org/archive/html/help-bison/2005-07/msg00013.html>.
* THANKS: Add Joel E. Denny.
2005-08-21 23:43:56 +00:00
Paul Eggert
3d54b57635 * tests/regression.at (Token definitions): Don't rely on
AT_PARSER_CHECK for data that contains backslashes.  It currently
uses 'echo', and 'echo' isn't portable if its argument contains
backslashes.  Problem found on OpenBSD 3.4.  Also, do not assume
that the byte '\0xff' is not printable in the C locale; it is,
under OpenBSD 3.4 (!).  Luckily, '\0x80' through '\0x9e' are
not printable, so use '\0x81' to test.
2005-07-25 06:36:13 +00:00
Paul Eggert
fc01665ea5 Fix core dump reported by Pablo De Napoli in
<http://lists.gnu.org/archive/html/bug-bison/2005-07/msg00053.html>.
* tests/regression.at (Invalid inputs with {}): New test.
* src/parse-gram.y (token_name): Translate type before using
it as an index.
2005-07-25 03:38:42 +00:00
Paul Eggert
040984073a * NEWS: Version 2.0b.
* data/glr.c (ATTRIBUTE_UNUSED): Remove, since it infringes on
the user's name space.  All uses changed to __attribute__
((__unused__)).
(yyFail, yyMemoryExhausted, yyreportAmbiguity):
Add __attribute__ ((__noreturn__)).

* etc/clcommit: Remove.  We weren't using it, and it failed
"make maintainer-distcheck".
* Makefile.maint: Merge from coreutils.
(CVS_LIST, CVS_LIST_EXCEPT): New macros.
(syntax-check-rules): Change list of rules as described below.
(sc_cast_of_alloca_return_value, sc_dd_max_sym_length):
(sc_file_system, sc_obsolete_symbols, sc_prohibit_atoi_atof):
(sc_prohibit_jm_in_m4, sc_root_tests, sc_tight_scope):
(sc_trailing_space): New rules.
(sc_xalloc_h_in_src): Remove.
(sc_cast_of_argument_to_free, sc_cast_of_x_alloc_return_value):
(sc_space_tab, sc_error_exit_success, sc_changelog):
(sc_system_h_headers, sc_sun_os_names, sc_unmarked_diagnostics):
(makefile-check, po-check, author_mark_check):
(makefile_path_separator_check, copyright-check):
Use grep -n, to make it easier to find violations.
Use CVS_LIST and CVS_LIST_EXCEPT.
(header_regexp, h_re): Remove.
(dd_c): New macro.
(sc_dd_max_sym_length, .re-list, news-date-check): New rules.
(my-distcheck): Use more-modern GCC flags.
(signatures, %.asc): Remove.
(rel-files, announcement): Remove signatures.
Restore old updating code, even though we don't use it, so
that we're the same as coreutils.
(alpha, beta, major): Depend on news-date-check.
Make the upload commands.

* data/c.m4, data/lalr1.cc, data/yacc.c: Normalize white space.
* lib/abitset.h, lib/bbitset.h, lib/bitset.h: Likewise.
* lib/bitset_stats.c, lib/ebitset.h, lib/lbitset.c: Likewise.
* lib/libitset.h, lib/timevar.c, lib/vbitset.h: Likewise.
* src/Makefile.am, src/gram.c, src/muscle_tab.h: Likewise.
* src/parse-gram.y, src/system.h, src/tables.c, src/vcg.c: Likewise.
* src/vcg_defaults.h, tests/cxx-type.at, tests/existing.at: Likewise.
* tests/sets.at: Likewise.

* data/m4sugar/m4sugar.m4: Sync from Autoconf, except that
we comment out the Autoconf version number.
* doc/bison.texinfo (Calc++ Scanner): Don't use atoi, as
it's error-prone and "make maintainer-distcheck" rejects it.

* lib/subpipe.c: Include <fcntl.h> without checking for HAVE_FCNTL_H.
Indent calls to "error" to pacify "make maintainer-distcheck",
when the calls are not intended to be translated.
* m4/subpipe.m4 (BISON_PREREQ_SUBPIPE): Don't check for fcntl.h.

* src/Makefile.am (DEFS): Use +=, to pacify
"make maintainer-distcheck".
(bison_SOURCES): Add scan-skel.h.
(sc_tight_scope): New rule, from coreutils.

* src/files.c (src_extension, header_extension):
Now static, not extern.
* src/getargs.c (short_options): Likewise.
* src/muscle_tab.c (muscle_table): Likewise.
* src/parse-gram.y (current_class, current_type, current_prec):
Likewise.
* src/reader.c (grammar_end, previous_rule_end): Likewise.
* src/getargs.h: Redo comments to pacify "make maintainer-distcheck".
* src/main.c (main): Cast bindtextdomain and textdomain calls to
void, to avoid warning when NLS is disabled.
* src/output.c: Include scan-skel.h.
(scan_skel): Remove decl, since scan-skel.h does this.
(output_skeleton):
Indent calls to "error" to pacify "make maintainer-distcheck".
* src/print_graph.c: Don't include <obstack.h>, as system.h does this.
* src/reader.h (gram_end, gram_lineno): New decls to pacify
"make maintainer-distcheck".
* src/scan-skel.l (skel_lex, skel_get_lineno, skel_get_in):
(skel_get_out, skel_get_leng, skel_get_text, skel_set_lineno):
(skel_set_in, skel_set_out, skel_get_debug, skel_set_debug):
(skel_lex_destroy, scan_skel): Move these decls to...
* src/scan-skel.h: New file.
* src/uniqstr.c (uniqstr_assert):
Indent calls to "error" to pacify "make maintainer-distcheck".

* tests/Makefile.am ($(srcdir)/package.m4): Use $(VAR),
not @VAR@.

* tests/torture.at: Revamp to avoid misuse of atoi that
"make maintainer-distcheck" complained about.
2005-07-24 07:24:22 +00:00
Paul Eggert
9e0876fb0c * data/glr.c (yytnamerr): New function.
(yyreportSyntaxError): Use it to dequote most string literals.
* data/lalr1.c (yytname_): Renamed from yyname_, for compatibility
with other skeletons.  All uses changed.
(yytnameerr_): New function.
(yyreport_syntax_error): Use it to dequote most string literals.
* data/yacc.c (yytnamerr): New function.
(yyerrlab): Use it to decode most string literals.
* doc/bison.texinfo (Decl Summary, Calling Convention):
Clarify quoting convention of yytname.
* src/output.c (prepare_symbols): Quote all names.  This undoes
the 2005-04-17 change, which is now accomplished (mostly) via
changes in the parsers as described above.
* tests/regression.at (Token definitions, Web2c Actions):
Undo most 2005-04-17 change here, too.
2005-07-21 20:53:03 +00:00
Paul Eggert
49b1cf794d Don't pipe output of ./types through sed to
remove trailing spaces.  This loses the exit status of ./types,
and isn't needed since ./types shouldn't be emitting trailing
spaces.
2005-07-20 22:01:47 +00:00
Paul Eggert
802b9687d0 (_AT_TEST_GLR_CXXTYPES): Work even with
overly-picky compilers that reject 'char *foo = "bar";'.
2005-07-20 21:19:40 +00:00
Paul Eggert
258b75caaa Destructor cleanups and regularization among the three skeletons.
* NEWS: Document the behavior changes.
* data/glr.c (yyrecoverSyntaxError): Don't bother to pop the
stack before failing, as the cleanup code will do it for us now.
* data/lalr1.cc (yyerrlab): Likewise.
* data/glr.c (yyparse): Pop everything off the stack before
freeing it, so that destructors get called properly.
* data/lalr1.cc (yyreturn): Likewise.
* data/yacc.c (yyreturn): Pop and destroy the start symbol, too.
This is more consistent.
* doc/bison.texinfo (Destructor Decl): Mention more reasons
why destructors might be called.  1.875 -> 2.1.
(Destructor Decl, Decl Summary, Table of Symbols):
Some English-language cleanups for %destructor.
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR):
Add output line for destructor of start symbol.
* tests/calc.at (AT_CHECK_CALC): Add one to line counts,
because of that same extra output line.
2005-07-19 06:56:44 +00:00
Paul Eggert
4cf31ef8e7 (_AT_TEST_GLR_CXXTYPES): Don't try to have yyerror return 0, now that
it returns void.
2005-07-19 03:32:40 +00:00
Paul Eggert
1a05945136 * NEWS: Document minor wording changes in diagnostics of
Bison-generated parsers.
* data/glr.c (yyMemoryExhausted): Renamed from yyStackOverflow.
Remove unused formals.  All uses changed.
(yyreportAmbiguity): "ambiguity detected" -> "syntax is ambiguous".
(yyparse): Rename yyoverflowlab to yyexhaustedlab.
* data/yacc.c (yyparse): "parser stack overflow" -> "memory exhausted".
Rename yyoverflowab to yyexhaustedlab.
When memory exhaustion occurs during syntax-error reporting,
report it separately rather than in a single diagnostic; this
eases translation.
* doc/bison.texinfo (Memory Management): Renamed from Stack Overflow.
(Memory Exhausted): Renamed from Parser Stack Overflow.
Revamp wording slightly to prefer "memory exhaustion".
* tests/actions.at: "parser stack overflow" -> "memory exhausted".
2005-07-19 00:05:57 +00:00
Paul Eggert
ac8c5689f8 Fix yyerror / yylex test glitches noted by twlevo@xs4all.nl.
* tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Have yyerror return
void, not int.
* tests/glr-regression.at (Badly Collapsed GLR States):
Likewise.
(Improper handling of embedded actions and dollar(-N) in GLR parsers):
yylex should return 0 at EOF rather than aborting.
2005-07-18 18:39:01 +00:00
Paul Eggert
6100a9aa2e Improve tests for stack overflow in GLR parser.
Problem reported by twlevo@xs4all.nl.
* data/glr.c (struct yyGLRStack): Remove yyerrflag member.
All uses removed.
(yyStackOverflow): Just longjmp, but with value 2 so that caller
can handle the problem.
(YYCHK1): Use goto (a la yacc.c) rather than setting a flag.
(yyparse): New local variable yyresult to record the result.
Use result of setjmp to set it, rather than storing itinto
struct.
(yyDone): Remove label.
(yyacceptlab, yyabortlab, yyoverflowlab, yyreturn): New labels,
to mimic yacc.c.  Do not discard lookahead if it's EOF (possible
if YYABORT is used).
* tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Exit with
yyparse status; put status > 1 into diagnostic.
Check that status==2 works.
* tests/calc.at, tests/cxx-type.at, tests/glr-regression.at:
Use exit status 3 for failure to open (which shouldn't happen).
2005-07-18 18:09:40 +00:00
Paul Eggert
67fd79c427 * tests/conflicts.at (%nonassoc and eof): Don't exit with status
1 on syntax error; just let yyparse do its thing.
* tests/glr-regression.at (Badly Collapsed GLR States): Likewise.
* tests/torture.at (AT_DATA_STACK_TORTURE): Likewise.
(Exploding the Stack Size with Alloca):
(Exploding the Stack Size with Malloc):
Expect exit status 2, not 1, since the parser is supposed to blow
its stack.  Problem reported by twlevo@xs4all.nl.
2005-07-18 06:14:16 +00:00
Paul Eggert
c70fdfcd20 More changes to pacify C++ compilers. 2005-07-14 23:57:45 +00:00
Paul Eggert
e2688cd96e * data/glr.c (YYSTACKEXPANDABLE): Don't define if already defined.
(yyuserMerge): Provide a default case if b4_mergers is empty.
* tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Define YYSTACKEXPANDABLE.
* tests/glr-regression.at
(Improper handling of embedded actions and dollar(-N) in GLR parsers):
YYSTYPE is char *, not char const *, so that strcpy ($$, ...) works.
2005-07-14 23:15:47 +00:00
Paul Eggert
1beb0b24f3 * tests/glr-regression.at (Improper merging of GLR delayed action
sets): Declare yylex before using it.
2005-07-14 21:42:40 +00:00
Paul Eggert
a22ff96f32 * tests/Makefile.am (maintainer-check-g++): Remove bogus
test for valgrind; valgrind is independent of g++.
(maintainer-check-posix): Add _POSIX2_VERSION=200112, to check
for compatibility with POSIX 1003.1-2001 (if running coreutils).
* tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Port to stricter C++.
Use a destructor, so that we can expand the stack.  Change
YYSTYPE to char * so that we can free it.  Cast result of malloc.
2005-07-14 17:27:01 +00:00
Paul Eggert
31d7addbf5 Update copyright. 2005-07-14 16:34:15 +00:00
Paul Eggert
71206cce8e (maintainer-check-g++): Fix a stray
$(GXX) that escaped the renaming of GXX to CXX.
2005-07-14 16:33:28 +00:00
Paul Eggert
4d1801f1a8 Fix BeOS, FreeBSD, MacOS porting problems reported by Bruno Haible.
* lib/bitset.c (bitset_print): Don't assume size_t can be printed
with %d format.
* lib/ebitset.c (min, max): Undef before defining.
* lib/vbitset.c (min, max): Likewise.
* lib/subpipe.c (create_subpipe): Save local variables in case
vfork clobbers them.
* tests/synclines.at (AT_SYNCLINES_COMPILE): Add support for the
error message syntax used by gcc-4.0.
2005-05-25 19:48:00 +00:00
Paul Eggert
cea1469d47 Fix a destructor bug reported by Wolfgang Spraul in
<http://lists.gnu.org/archive/html/bug-bison/2005-05/msg00042.html>.
* data/yacc.c (yyabortlab): Don't call destructor, and
don't set yychar to EMPTY.
(yyoverflowlab): Don't call destructor.
(yyreturn): Call destructor, if yychar is neither YYEOF nor YYEMPTY.
* tests/calc.at (AT_CHECK_CALC): Expect one fewer output lines,
since we no longer output the message "discarding lookahead token
end of input ()".
2005-05-22 05:20:01 +00:00
Paul Hilfinger
5e6f62f2f1 * data/glr.c (YY_SYMBOL_PRINT): Don't print newline at end to
fix a small glitch in debugging output.
(yyprocessOneStack, yyrecoverSyntaxError, yyparse): Print newline
after YY_SYMBOL_PRINT where needed.

(struct yyGLRState): Add some comments.
(struct yySemanticOption): Add some comments.
(union yyGLRStackItem): Add comment.

(yymergeOptionSets): Correct this to properly perform the union,
avoiding infinite reported by Michael Rosien.
Update comment.

* tests/glr-regression.at: Add test for GLR merging error reported
by M. Rosien.
2005-05-21 08:35:51 +00:00
Paul Eggert
0fb669f9d6 Update FSF postal mail address. 2005-05-14 06:49:48 +00:00
Paul Eggert
51f4735e22 * tests/local.at (AT_COMPILE_CXX): Treat LDFLAGS like AT_COMPILE does.
Problem reported by Ralf Menzel.
2005-05-11 19:38:24 +00:00
Paul Eggert
80ce3401e9 * tests/actions.at: Test that stack overflow invokes destructors.
From Marcus Holland-Moritz.
* data/yacc.c (yyerrlab): Move the code that destroys the stack
from here....
(yyreturn): to here.  That way, destructors are called properly
even if the stack overflows, or the user calls YYACCEPT or
YYABORT.  Stack-overflow problem reported by Marcus Holland-Moritz.
(yyoverflowlab): Destroy the lookahead.
2005-05-02 04:52:33 +00:00
Paul Eggert
ba20a26459 (Torturing the Scanner): Adjust to lack of quotes in diagnostics. 2005-04-17 08:12:56 +00:00
Paul Eggert
72f000b088 * NEWS: Bison-generated C parsers no longer quote literal strings
associated with tokens.
* src/output.c (prepare_symbols): Don't escape strings,
since users don't want to see C escapes.
* tests/calc.at (AT_CHECK_CALC): Adjust to lack of quotes
in diagnostics.
* tests/regression.at (Token definitions, Web2c Actions): Likewise.
2005-04-17 08:07:15 +00:00
Paul Eggert
f79b4f5ce1 (AT_INCREASE_DATA_SIZE): Skip the test if
the data size is known to be too small and we can't increase it.
2005-04-16 08:11:33 +00:00
Paul Eggert
ca407bdf9d * src/parse-gram.y: Include quotearg.h.
(string_as_id): Quote $1 before using it as a key, since the
lexer no longer quotes it for us.
(string_content): Don't strip quotes, since lexer no longer
quotes it for us.
* src/scan-gram.l: Include quotearg.h.
("\""): Omit quote.
("'"<SC_ESCAPED_CHARACTER>): Quote symbol before using it as
a key, since the rest of the lexer doesn't quote it.
* src/symtab.c (symbol_get): Don't quote symbol; caller does it now.
* tests/regression.at (Token definitions): Check for backslashes
in token strings.
2005-04-16 06:32:51 +00:00
Paul Eggert
e59adf8f04 (Typed symbol aliases): New test. 2005-04-12 22:35:53 +00:00
Paul Eggert
4f136612d9 (Token definitions): Don't use a token named c, as that generates a
"#define c ..." that runs afoul of buggy stdlib.h that uses the
identifier c as a member of struct drand48_data.
2005-03-26 01:12:59 +00:00
Paul Eggert
72d848c21d (AT_COMPILE, AT_COMPILE_CXX): Don't put options
after operands; POSIX says this isn't portable for the c99 command.
2005-03-21 06:58:11 +00:00
Paul Eggert
f508a6a0d6 (glr-regr2a.y): Try to dump core
immediately if a data overrun has occurred; this may help us track
down what may be a spurious failure on MacOS.
2005-03-18 20:57:19 +00:00
Paul Eggert
d46c3fc694 Renamed from "Invalid \$n", to work around an Autoconf bug with dollar
signs in test names.
2005-02-07 23:14:55 +00:00
Paul Eggert
d6d67dbdcb (Improper handling of embedded actions and dollar(-N) in GLR parsers):
Renamed from "Improper handling of embedded actions and $-N in GLR
parsers", work around an Autoconf bug with dollar signs in test names.
2005-02-07 23:14:22 +00:00
Paul Eggert
38989c080e (AT_CHECK_DOXYGEN): Don't use options after operands. 2005-01-23 08:37:35 +00:00
Paul Eggert
419ab1055e (_AT_DATA_CALC_Y): Use alarm (100), not alarm (10). 2005-01-10 18:22:11 +00:00
Paul Eggert
f1bbfccee2 (AT_CHECK_OUTPUT): New arg SHELLIO.
(Output file names.): Add a test for the case when standard output
is closed.
2005-01-01 09:23:41 +00:00
Paul Eggert
577d7c33df (Exploding the Stack Size with Alloca): Set
YYSTACK_USE_ALLOCA to 1 if __GNUC__ or alloca are defined;
otherwise, we're not testing alloca.  Unfortunately there's no
simple way to consult HAVE_ALLOCA here.
2004-12-26 06:12:18 +00:00
Akim Demaille
e019c24779 * data/lalr1.cc (parser::token_number_type, parser::rhs_number_type)
(parser::state_type, parser::semantic_type, parser::location_type):
Private, not public.
(parser::parse): Return ints, not bool.
Returning a bool introduces a problem: 0 corresponds to false, and
it seems weird to return false on success.  Returning true changes
the conventions for yyparse.
Alternatively we could return void and send an exception.
There is no clear consensus (yet?).
(state_stack, semantic_stack, location_stack): Rename as...
(state_stack_type, semantic_stack_type, location_stack_type): these.
Private, not public.
* tests/c++.at: New.
* tests/testsuite.at, tests/Makefile.am: Adjust.
2004-12-22 10:06:15 +00:00