Akim Demaille [Fri, 26 Oct 2012 12:16:29 +0000 (14:16 +0200)]
maint: be compilable with GCC 4.0
The "shadows a global declaration" warning in GCC 4.0 was a bit
annoying. It does not like that a type name be used in a prototype of
a function (not the implementation, just the declaration):
In file included from src/LR0.c:38:
src/reader.h:56: warning: declaration of 'named_ref' shadows a
global declaration
src/named-ref.h:35: warning: shadowed declaration is here
It does not like either when a global variable name is used in a
prototype. Flex 2.5.37 generates this prototype:
void gram_set_debug (int debug_flag );
* src/getargs.h, src/getargs.c (debug_flag): Rename as...
(debug): this.
Adjust dependencies.
* src/reader.h: Don't use "named_ref" as a formal argument name.
Akim Demaille [Thu, 25 Oct 2012 12:42:24 +0000 (14:42 +0200)]
tests: address a warning from GCC 4.4
236. torture.at:465: testing Exploding the Stack Size with Alloca ...
../../../tests/torture.at:474: bison -o input.c input.y
../../../tests/torture.at:474: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS
stderr:
cc1: warnings being treated as errors
input.y: In function 'main':
input.y:60: error: 'status' may be used uninitialized in this function
* tests/torture.at (AT_DATA_STACK_TORTURE): Initial status to avoid
the previous error.
Akim Demaille [Thu, 25 Oct 2012 10:28:35 +0000 (12:28 +0200)]
tests: restore the tests on -Werror
When run as /bin/sh, Bash sets the shell variable POSIXLY_CORRECT to
y. The test suite checks for the envvar POSIXLY_CORRECT to turn of
some tests not supported in POSIX mode. Restore these tests.
Reported by the Hydra build farm, from Rob Vermaas.
* tests/local.at (AT_BISON_CHECK_WARNINGS_): Check the envvar
POSIXLY_CORRECT, not the shell variable.
Akim Demaille [Mon, 8 Oct 2012 07:17:20 +0000 (09:17 +0200)]
warnings: avoid warnings from clang
Fix the following warning
parse-gram.c:2078:14: error: equality comparison with extraneous parentheses
[-Werror,-Wparentheses-equality]
if (((yyn) == (-91)))
~~~~~~^~~~~~~~
parse-gram.c:2078:14: note: remove extraneous parentheses around the
comparison to silence this warning
if (((yyn) == (-91)))
~ ^ ~
parse-gram.c:2078:14: note: use '=' to turn this equality comparison into
an assignment
if (((yyn) == (-91)))
^~
=
1 error generated.
and the following one:
input.cc:740:1: error: function declared 'noreturn' should not return
[-Werror,-Winvalid-noreturn]
static void yyMemoryExhausted (yyGLRStack* yystackp)
__attribute__ ((__noreturn__));
static void
yyMemoryExhausted (yyGLRStack* yystackp)
{
YYLONGJMP (yystackp->yyexception_buffer, 2);
}
^
1 warning and 1 error generated.
This is Apple clang version 3.1 (tags/Apple/clang-318.0.61).
* data/c.m4 (b4_table_value_equals): Use (!!(A == B)) instead of (A == B)
to avoid this warning.
Any reasonable compiler should generate the same code.
* src/uniqstr.h (UNIQSTR_EQ): Likewise.
* data/glr.c (LONGJMP): abort after longjmp to pacify clang.
Akim Demaille [Mon, 8 Oct 2012 07:02:09 +0000 (09:02 +0200)]
tests: no longer disable -O compiler options
Tests are running without -O since f377f69fec28013c79db4efe12bbb9d48987fb2c because some warnings (about
yylval not being initialized) show only when GCC is given -O2. The
previous patch fixes the warnings. Run the test suite with compiler
options unmodified.
* tests/atlocal.in (O0CFLAGS, O0CXXFLAGS): Remove, use CFLAGS and
CXXFLAGS.
Paul Eggert [Fri, 5 Oct 2012 17:55:11 +0000 (10:55 -0700)]
yacc.c: initialize yylval in pure-parser mode
See http://lists.gnu.org/archive/html/bison-patches/2012-08/msg00024.html
(spreading over September and October).
* data/yacc.c (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN)
(YY_IGNORE_MAYBE_UNINITIALIZED_END, YYLVAL_INITIALIZE):
New macros. Use them to suppress an unwanted GCC diagnostic.
Bison uses "/usr/bin/perl" or "perl" in several places, and it does
not appear to be a problem. But, at least to make it simpler to
change PERL on the make command line, check for perl in configure.
* configure.ac (PERL): New.
* doc/Doxyfile.in, doc/Makefile.am, tests/bison.in: Use it.
Akim Demaille [Thu, 4 Oct 2012 07:07:42 +0000 (09:07 +0200)]
lalr1.cc: fix test suite portability
Reported by Rob Vermaas' Hydra build farm on x86_64-darwin 10.2.0 with
G++ 4.6.3.
* tests/headers.at (Several parsers): Include AT_DATA_SOURCE_PROLOGUE
in the files to compile.
* data/location.cc: Do not include twice string and iostream (once
by position.hh, and then by location.hh).
* README-hacking (Typical errors): Some hints for other maintainers.
yacc: fix handling of CPP guards when no header is generated
When no header was to be generated, Bison would issue:
/* In a future release of Bison, this section will be replaced
by #include "". */
#ifndef YY_
# define YY_
It now properly generates nothing.
* data/c.m4 (b4_cpp_guard_open, b4_cpp_guard_close): Issue nothing when
the file name is empty.
* data/yacc.c: Do not generate the above comment when there is no header
to generate.
* NEWS: Update.
* doc/.gitignore: Don't ignore split info files as we don't split our
info file.
See <http://lists.gnu.org/archive/html/bug-bison/2012-08/msg00006.html>.
* src/system.h: Don't include sys/types.h.
Reported by Eric Blake,
<http://lists.gnu.org/archive/html/bug-bison/2012-09/msg00002.html>.
(FUNCTION_PRINT): Remove, unused.
Jim Meyering [Sun, 5 Aug 2012 11:28:01 +0000 (13:28 +0200)]
use locale-indep. c_is* functions for parsing, not isspace, isprint etc
* src/parse-gram.y: Include "c-ctype.h".
(add_param): Parse with c_isspace, not isspace.
* src/parse-gram.c: Likewise.
* src/scan-gram.l: Include c-ctype.h, not ctype.h.
(SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER): Use c_isspace and c_isprint,
not ctype.h's locale-dependent functions.
Akim Demaille [Fri, 31 Aug 2012 16:18:13 +0000 (18:18 +0200)]
--help: include a place to report translation issues
http://lists.gnu.org/archive/html/bug-bison/2012-08/msg00007.html
shows that it is useful to help users report translation issues.
While at it, include other informative bits that the coreutils shows.
* src/getargs.c (usage): Report more URLs where the user can
refer to.
Mostly copied/pasted from coreutils' emit_ancillary_info function.
Akim Demaille [Wed, 22 Aug 2012 12:26:26 +0000 (14:26 +0200)]
tests: style changes
* tests/torture.at (AT_DATA_STACK_TORTURE): M4 style changes to
improve readability.
Fix an assertion which, because of a <= instead of ==, did not check
new_status as visibly meant.
(get_args): New.
Akim Demaille [Thu, 2 Aug 2012 10:01:54 +0000 (12:01 +0200)]
yacc: remove trailing end of line at end of file
There are still spurious spaces at the end of some lines. But this is
addressed in the master branch, and I am reluctant to try to backport
this.
* data/yacc.c, data/glr.c, data/lalr1.cc, data/glr.cc: here.
* tests/calc.at (AT_CHECK_SPACES): New.
Use it.
Be sure not to introduce trailing empty lines in the *.y files.
* NEWS: Doc it.
* cfg.mk (syntax-check): Remove the exception.
Akim Demaille [Wed, 1 Aug 2012 07:30:27 +0000 (09:30 +0200)]
tests: synclines: style changes
* tests/synclines.at (AT_TEST_SYNCLINE): Rename as...
(AT_TEST): this.
Use pushdef/popdef.
Formatting changes.
Use '+' instead of '*' where appropriate.
* src/parse-gram.y (add_param): No only skip ' ' and '\t', skip all
leading and trailing spaces.
* tests/regression.at (Lex and parse params): Check it.
* NEWS: Document it.
$ flex src/scan-skel.l
src/scan-skel.l:145: multiple <<EOF>> rules for start condition SC_AT_DIRECTIVE_ARGS
src/scan-skel.l:145: multiple <<EOF>> rules for start condition SC_AT_DIRECTIVE_SKIP_WS
This is warning, and it seems there are no means to make it an error.
* src/scan-skel.l: Restore the start-condition INITIAL for an <<EOF>>
clause.
* cfg.mk: Nuke the following warnings which are confused by our
text reports (that state that the error token is number 256).
prohibit_magic_number_exit
../../doc/bison.texi:8170:error (256)
../../tests/conflicts.at:570:error (256)
../../tests/conflicts.at:673:error (256)
../../tests/conflicts.at:811:error (256)
../../tests/conflicts.at:1154:error (256)
../../tests/regression.at:281:error (256)
../../tests/regression.at:582:error (256)
maint.mk: use EXIT_* values rather than magic number
scan-code.l is already passing argument to b4_dollar_dollar for the
initial acton, but its definition (of b4_dollar_dollar) does not use
this argument.
Generalize this definition, and use it for the %initial-action too.
* data/c.m4 (b4_dollar_dollar_, b4_dollar_pushdef, b4_dollar_popdef):
Instead of expecting a pointer, require a value, and use ".".
Since they are now generic enough, move to...
* data/c-like.m4: this new file.
* data/c.m4, data/java.m4: Load it.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c: Use
b4_dollar_pushdef for the %initial-action.
* tests/actions.at: Check that.
* data/Makefile.am: Adjust.
* NEWS, doc/bison.texi: Document.
Currently "%printer {...} a b c d e f" translates the {...} six times.
Not only is this bad for time and space, it also issues six times the
same warnings.
* src/symlist.h, src/symlist.c (symbol_list_destructor_set)
(symbol_list_printer_set): Take the action as code_props instead of
const char *.
* src/parse-gram.y: Translate these actions here.
* src/scan-code.h: Comment change.
* tests/input.at: Check that warnings are issued only once.
The conversion from @ to @@ and so forth is coded is too many
different places. Factor, a bit.
* src/scan-code.l: Instead of duplicating the logic of obstack_escape,
use it.
It sure is less efficient, but the cost is negligible.
This allows to factor rules that are alike.
And to factor some start-condition clauses.
* tests/input.at (Stray $ or @): New.
* NEWS: Document it.
* src/scan-code.l, src/scan-skel.l: Use a more traditional indentation
style for start-conditions.
Prefer "continue" to a comment, for empty actions.
Strip useless {}.
Remove useless start-condition clauses.
* src/scan-code.l (SC_SYMBOL_ACTION): Accept $<tag>$, not just $$.
* data/c.m4 (b4_dollar_dollar_): New.
(b4_symbol_actions): Let b4_dollar_dollar use b4_dollar_dollar_.
* NEWS, doc/bison.texi: Document it.
* tests/actions.at: Check this for C and C++.
muscles: fix another occurrence of unescaped type name
* src/output.c (quoted_output): Split into...
(quoted_output, string_output): these.
Use the former when outputting a type_name.
* tests/input.at: Check this case.
* src/symtab.h: Comment changes.
* src/scan-code.l: Use obstack_quote when passing type_name to m4.
* tests/input.at (Code injection): New.
* NEWS: Document it.
Thanks to Paul Eggert for the wording.
* src/system.h (obstack_quote): New.
* src/muscle-tab.c: Use it instead of obstack_escape where applicable.
* src/scan-code.l: Since obstack_quote supports NULL, leave type_name
as NULL instead of defaulting to "".
* src/muscle-tab.c (MUSCLE_COMMON_DECODE, muscle_string_decode)
(muscle_location_decode): Not related to muscles, rename as...
(COMMON_DECODE, string_decode, location_decode): these.
* src/muscle-tab.h (MUSCLE_OBSTACK_SGROW): This is not related to
muscles, so move to, and rename as...
* src/system.h (obstack_escape): this.
Adjust dependencies.
doc: avoid problems with case insensitive file systems
makeinfo --html generates index.html, and the node "Index" will result
in Index.html. On case insensitive file systems, such as on Mac OS X
by default, this results in a single, invalid, file (Texinfo 4.13).
See http://lists.gnu.org/archive/html/bug-texinfo/2012-07/msg00032.html
* doc/bison.texi (Index): Rename as...
(Index of Terms): this.
* configure.ac: In the AC_SUBST call on 'VALGRIND_PREBISON'. Without
this change, when running ./configure, I see:
...
checking for valgrind... valgrind
./configure: line 35221: -q: command not found
checking for Java compiler... gcj -C -fsource=1.3 -ftarget=1.4
...