Paul Eggert [Tue, 12 Jul 2005 23:28:54 +0000 (23:28 +0000)]
* bootstrap: Get runtime translations into runtime-po.
Create runtime-po files automatically, if possible.
* configure.ac: Invoke BISON_I18N, so that we eat our own dog food.
* data/yacc.c: Rewrite inclusion of <libintl.h> so that ENABLE_NLS
does not infringe on the user's name space.
(YYENABLE_NLS): Renamed from ENABLE_BISON_NLS.
* doc/bison.texinfo (Internationalization): Revamp the English
and Texinfo syntax a bit, to try to make it clearer.
(Bison Options, Option Cross Key): Mention --print-localedir.
* m4/bison-i18n.m4 (BISON_I18N): Rename ENABLE_BISON_NLS to
YYENABLE_NLS. Quote a bit more.
* runtime-po/.cvsignore: New file.
* runtime-po/Makefile.in.in (mostlyclean): Remove *.old.pot.
* runtime-po/Rules-quot: Remove; now created by bootstrap.
* runtime-po/quot.sed: Likewise.
* runtime-po/boldquot.sed: Likewise.
* runtime-po/en@quot.header: Likewise.
* runtime-po/en@boldquot.header: Likewise.
* runtime-po/insert-header.sin: Likewise.
* runtime-po/remove-potcdate.sin: Likewise.
* runtime-po/Makevars: Likewise.
* runtime-po/LINGUAS: Likewise.
* runtime-po/de.po: Likewise; we will rely on the translation project
to maintain this, so "bootstrap" should get it.
* src/getarg.s (PRINT_LOCALEDIR_OPTION): Let the C compiler determine
its value.
* src/main.c (main): Bind the bison-runtime domain, too.
* data/yacc.c: Include <libintl.h> when NLS is enabled.
(YYI18N): Renamed from _. Use dgettext when NLS is enabled.
* po/POTFILES.in: Remove autogenerated file src/parse-gram.c.
* runtime-po: New directory.
* runtime-po/Makefile.in.in: New file, copied from po/, with modified
$(DOMAIN).pot-update rule, so that old messages are never dropped.
* runtime-po/Rules-quot: New file, copied from po/.
* runtime-po/quot.sed: Likewise.
* runtime-po/boldquot.sed: Likewise.
* runtime-po/en@quot.header: Likewise.
* runtime-po/en@boldquot.header: Likewise.
* runtime-po/insert-header.sin: Likewise.
* runtime-po/remove-potcdate.sin: Likewise.
* runtime-po/Makevars: New file.
* runtime-po/POTFILES.in: New file.
* runtime-po/LINGUAS: New file.
* runtime-po/bison-runtime.pot: New file.
* runtime-po/de.po: New file.
* m4/bison.m4: New file.
* Makefile.am (SUBDIRS): Add runtime-po.
(aclocaldir, aclocal_DATA): New variables.
* configure.ac: Add AC_CONFIG_FILES of runtime-po/Makefile.in.
Define aclocaldir.
* src/getargs.c (usage): Document --print-localedir option.
(PRINT_LOCALEDIR_OPTION): New enum item.
(long_options): Add --print-localedir option.
(getargs): Handle --print-localedir option.
* doc/bison.texinfo (Bison Parser): Remove paragraph about _().
(Internationalization): New section.
* src/symtab.h, src/symtab.c (symbol_print): Swap the arguments,
for consistency with the rest of the code.
* src/symlist.h, src/symlist.c (symbol_list_print): Ditto.
Add separators.
Paul Eggert [Sat, 9 Jul 2005 07:14:18 +0000 (07:14 +0000)]
* data/yacc.c (yyparse): In the initial action, set
yylsp[0] and yyvsp[0] rather than yylloc and yylval.
This avoids the use of undefined variables if the initial
action does not set yylloc and/or yylval.
Paul Eggert [Thu, 7 Jul 2005 23:16:46 +0000 (23:16 +0000)]
* examples/calc++/calc++-driver.cc, examples/calc++/calc++-driver.hh:
* examples/calc++/calc++-scanner.ll, examples/calc++/calc++.cc:
Remove from CVS. These files are automatically generated.
* examples/extexi: Clarify that this file is now part of Bison,
not GNU M4, and that it works with any POSIX-compatible Awk.
* examples/calc++/Makefile.am (run_extexi): Remove; not used.
($(calc_extracted)): Renamed from $(calc_sources_extracted),
so that we also get calc++-parser.yy. Geneate it.
Use $(AWK), not gawk, since any conforming Awk will do.
Put comment before action, since older 'make' can't handle comment
in action.
$(BUILT_SOURCES): List all built sources, not just some of them.
$(MAINTAINERCLEANFILES): Remove *.stamp, and all built sources.
$($(srcdir)/calc++-parser.stamp): Work even if POSIXLY_CORRECT.
$($(calc_sources_generated)): Remove unnecessary test for existence
of target. (This had a shell syntax error anyway; a stray "x".)
(calc_extracted): List $(srcdir)/calc++-parser.yy, not
calc++-parser.yy.
* examples/.cvsignore, examples/calc++/.cvsignore: New files.
Paul Eggert [Wed, 6 Jul 2005 04:12:23 +0000 (04:12 +0000)]
* data/glr.c (yyFail): Drastically simplify; since the format argument
never had any % directives, we can simply pass it to yyerror.
(yyparse): Use "t a; a=b;" rather than "t a = b;" when a will
be modified later, as that is the usual style in glr.c.
Paul Eggert [Tue, 5 Jul 2005 21:58:37 +0000 (21:58 +0000)]
Rewrite GLR parser to catch more buffer overrun, storage exhaustion,
and size overflow errors.
* data/glr.c: Include <stdio.h> etc. after user prolog, not before,
in case the user prolog sets feature-test macros like _GNU_SOURCE.
(YYSIZEMAX): New macro.
(yystpcpy): New function, taken from yacc.c.
(struct yyGLRStack.yyspaceLeft): Now size_t, not int.
(yyinitGLRStack, yyfreeGLRstack): Remove unnecessary forward decls,
so that we don't have to maintain their signatures.
(yyFail): Check for buffer overflow, by using vsnprintf rather
than vsprintf. Allocate a bigger buffer if possible.
Report an error if buffer allocation fails.
(yyStackOverflow): New function.
(yyinitStateSet, yyinitGLRStack): Return a boolean indicating whether
the initialization was successful. It might fail if storage was
exhausted.
(yyexpandGLRStack): Add more checks for storage allocation failure.
Use yyStackOverflow to report failures.
(yymarkStackDeleted, yyglrShift, yyglrShiftDefer, yydoAction):
(yysplitStack, yyprocessOneStack, yyparse, yypstack):
Don't assume stack number fits in int.
(yysplitStack): Check for storage allocation failure.
(yysplitStack, yyprocessOneStack): Add pure_formals, so that we
can print diagnostics on storage allocation failure. All callers
changed.
(yyresolveValue): Use yybool for boolean.
(yyreportSyntaxError): Check for size-calculation overflow.
This code is taken from yacc.c.
(yyparse): Check for storage allocation errors when allocating
the initial stack.
Extract calc++ from the documentation.
* doc/bison.texinfo (Calc++): Add the extraction marks.
* examples/extexi: New, from the aborted GNU Programming 2E.
Separate the different paragraph of a file with empty lines.
* examples/Makefile: Use it to extract the whole calc++ example.
Paul Eggert [Fri, 27 May 2005 23:22:10 +0000 (23:22 +0000)]
Fix infringement on user name space reported by Bruno Haible.
* data/yacc.c (YYSIZE_T): Define first, so that later decls can use it.
Prefer GCC's __SIZE_TYPE__ if available, so that we don't infringe on
the user's name space.
(alloca): Include <stdlib.h> to get it, if it's not built in.
(YYMALLOC, YYFREE): Define only if needed.
(malloc, free): Declare, but only if needed, as this infringes on
the user name space.
Paul Eggert [Wed, 25 May 2005 19:48:00 +0000 (19:48 +0000)]
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.
Paul Eggert [Sun, 22 May 2005 17:45:28 +0000 (17:45 +0000)]
Various maintainer cleanups.
* .cvsignore: Add a.exe, a.out, b.out,, conf[0-9]*, confdefs*,
conftest*, for benefit of CVS commands run at the same time as
"configure". Add build-aux, since "bootstrap" now creates it and
its subfiles.
* Makefile.cfg (move_if_change): Remove.
* Makefile.maint: Remove the update stuff; we now use "bootstrap".
(ftp-gnu, www-gnu, move_if_change, local_updates, update):
(po_repo, do-po-update, po-update, wget_files, get-targets):
(config.guess-url_prefix, config.sub-url_prefix):
(ansi2knr.c-url_prefix, texinfo.tex-url_prefix):
(standards.texi-url_prefix, make-stds.texi-url_prefix, taget, url):
($(get-targets), cvs-files, automake_repo, wget-update, cvs-update):
Remove.
* configure.ac (AC_CONFIG_AUX_DIR): Change from config to build-aux;
this is now the recommended name.
* config/.cvsignore: Remove config.guess, config.rpath, config.sub,
depcomp, install-sh, mdate-sh, missing, mkinstalldirs, texinfo.tex,
ylwrap. These files now go into build-aux.
* config/move-if-change: Remove.
* config/prev-version.txt: Bump from 1.75 to 2.0.
Paul Eggert [Sun, 22 May 2005 08:04:06 +0000 (08:04 +0000)]
* bootstrap: Add stdio-safer, unistd-safer modules.
Remove m4/glibc2.m4 (introduced by latest gnulib, but
we don't need it).
* lib/.cvsignore: Add dup-safer.c, fd-safer.c,
fopen-safer.c, stdio-safer.h, unistd-safer.h.
* lib/subpipe.c: Include "unistd-safer.h".
(create_subpipe): Make sure all the newly-created
file descriptors are > 2, so that diagnostics don't
get sent down them (which might cause Bison to hang, in theory).
* m4/.cvsignore: Add stdio-safer.m4, unistd-safer.m4.
* src/files.c (xfopen): Use fopen_safer, not fopen.
Paul Eggert [Sun, 22 May 2005 05:20:01 +0000 (05:20 +0000)]
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 ()".
Paul Hilfinger [Sat, 21 May 2005 08:35:51 +0000 (08:35 +0000)]
* 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.
Paul Eggert [Mon, 2 May 2005 04:52:33 +0000 (04:52 +0000)]
* 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.
Paul Eggert [Sun, 17 Apr 2005 08:07:15 +0000 (08:07 +0000)]
* 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.
Paul Eggert [Sat, 16 Apr 2005 06:32:51 +0000 (06:32 +0000)]
* 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.
Paul Eggert [Sat, 16 Apr 2005 06:25:03 +0000 (06:25 +0000)]
(YYSTACK_ALLOC_MAXIMUM): New macro.
(YYSIZE_T): Define to unsigned long int when using an older compiler.
(yyparse): Revamp code to generate long syntax error message, to
make it easier to translate, and to avoid problems with arithmetic
overflow. Change "virtual memory" to "memory" in diagnostic, since
we don't know whether the memory is virtual.
Paul Eggert [Thu, 14 Apr 2005 00:08:56 +0000 (00:08 +0000)]
* NEWS: Bison-generated C parsers now use the _ macro to
translate strings.
* data/yacc.c (_) [!defined _]: New macro.
All English strings wrapped inside this macro.
* doc/bison.texinfo (Bison Parser): Document _.
* po/POTFILES.in: Include src/parse-gram.c, since it now
includes translateable strings that parse-gram.y doesn't.
Paul Eggert [Tue, 12 Apr 2005 22:38:20 +0000 (22:38 +0000)]
(symbol_make_alias): Call symbol_type_set,
reverting the 2004-10-11 change to this function.
(symbol_check_alias_consistency): Don't call symbol_type_set
if the type name is already correct.
Paul Eggert [Sat, 26 Mar 2005 01:12:59 +0000 (01:12 +0000)]
(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.
Paul Eggert [Mon, 7 Mar 2005 06:41:39 +0000 (06:41 +0000)]
* src/output.c (escaped_output): Renamed from
escaped_file_name_output, since we now use it for symbol tags as
well. All uses changed.
(symbol_destructors_output, symbol_printers_output):
Escape symbol tags too.
Problem reported by Matyas Forstner in
<http://lists.gnu.org/archive/html/bug-bison/2005-03/msg00009.html>.
Paul Eggert [Tue, 1 Mar 2005 00:41:33 +0000 (00:41 +0000)]
(Semantic Tokens): Fix scoping problem in
example, reported by Derek M Jones. Also, make the example even
more outrageous, to better illustrate how bad the problem is.
Paul Eggert [Mon, 7 Feb 2005 23:14:22 +0000 (23:14 +0000)]
(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.