warnings: fix early exit of warnings treated as errors
Treating warnings as errors caused Bison to exit earlier than needed, making it
hide warnings that would have been printed had -Werror not been set.
Also, fix a bug that caused some context information of errors to not be
shown.
* src/complain.c (complaint_issued): Rename as...
(complaint_status): This, and change its type from boolean to
* src/complain.h (err_status): This, new enumeration.
* src/main.c (main): Adjust (only finish early if an actual complaint was
risen, not a mere warning treated an error).
* src/reader.c: Adjust.
Akim Demaille [Fri, 26 Oct 2012 14:50:26 +0000 (16:50 +0200)]
Merge remote-tracking branch 'origin/maint'
* origin/maint: (46 commits)
doc: minor style change
maint: use gendocs's new -I option
regen
yacc.c: do not define location support when not using locations
maint: be compilable with GCC 4.0
tests: address a warning from GCC 4.4
tests: don't use options that Clang does not support
tests: restore the tests on -Werror
regen
parse-gram: update the Bison interface
fix comment
maint: post-release administrivia
version 2.6.4
regen
2.6.4: botched 2.6.3
maint: post-release administrivia
version 2.6.3
gnulib: update
tests: check %no-lines
NEWS: warnings with clang
...
Akim Demaille [Fri, 26 Oct 2012 14:33:20 +0000 (16:33 +0200)]
Merge branch 'branch-2.6' into maint
* origin/branch-2.6:
regen
yacc.c: do not define location support when not using locations
maint: be compilable with GCC 4.0
tests: address a warning from GCC 4.4
tests: don't use options that Clang does not support
tests: restore the tests on -Werror
regen
parse-gram: update the Bison interface
fix comment
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, 22 Oct 2012 14:04:12 +0000 (16:04 +0200)]
Merge branch '2.6.3' into maint
* 2.6.3: (22 commits)
maint: post-release administrivia
version 2.6.3
gnulib: update
tests: check %no-lines
NEWS: warnings with clang
warnings: avoid warnings from clang
tests: no longer disable -O compiler options
yacc.c: initialize yylval in pure-parser mode
skeletons: style changes
tests: minor improvements
tests: use $PERL instead of perl
build: look for Perl in configure.
tests: fix sed portability issues
tests: diff -u is not portable
maint: word changes
lalr1.cc: fix test suite portability
maint: fix an erroneous include
tests: check that headers are self contained
doc: add missing documentation for --report
headers: move CPP guards into YY_*_INCLUDED to avoid collisions
...
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.
* NEWS: Document these changes.
* doc/Makefile.am: Adjust to generate example files.
* doc/bison.texi: Add a Graphviz section after "Understanding::", the section
describing the .output file, because these are similar.
* doc/figs/example-reduce.dot, doc/figs/example-reduce.txt,
doc/figs/example-shift.dot, doc/figs/example-shift.txt: New, minimal
examples to illustrate the documentation.
* src/graphviz.c (start_graph): Use courier font.
(conclude_red): Use commas to separate attributes. Show the acceptation
as a special reduction, with a blue color and an "Acc" label. Show the
lookahead tokens between square brackets.
(output_red): No longer label default reductions.
* src/print_graph.c (print_core): Refactor spacing, and print an
additional space between a rule's rhs and its lookahead tokens. Also,
capitalize "State".
(print_actions): Style, move a declaration.
Akim Demaille [Fri, 12 Oct 2012 10:39:52 +0000 (12:39 +0200)]
Merge branch 'maint'
* origin/maint:
tests: check %no-lines
tests: minor simplification
graphs: stylistic changes.
graphs: minor style changes
graphs: show reductions
graphs: style: prefix state number with "state"
graphs: style: use left justification for states
graphs: style: prefix rules and change shapes
obstack: import obstack_finish0 from master
c++: api.location.type
muscles: a function for backward compatibility
maint: more macros
* src/graphviz.c (output_red): New, show reductions on the graph.
(no_reduce_bitset_init): New, initialize a bitset.
(print_token): New, print a lookahead token.
(escape): New, print "foo" as \"foo\" because Dot doesn't like quotes within
a label.
The label text of nodes is centered "by default" (by the use of '\n' as
a line feed). This gives bad readability to the grammar rules shown in
state nodes, a left justification is much nicer. This is done by using '\l'
as the line feed.
In order to allow \l in the DOT file, changes to the quoting system seem
necessary.
* data/c++.m4, data/lalr1.cc, data/glr.cc, data/java.m4: Use
api.location.type instead of location_type.
* src/muscle-tab.c (muscle_percent_variable_update): Map the latter to
the former.
* tests/local.at: Adjust.
* tests/calc.at: Use api.location.type.
Leave tests/java.at with location_type, at least for the time being,
to cover both names.
* doc/bison.texi: Document api.location.type.
(User Defined Location Type): New.
* NEWS: Update.
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.
lalr1.cc: check exception safety of error handling
* tests/c++.at (Exception safety): Don't use swap here, it
is useless.
Cover more test cases: yyerror, YYERROR, YYABORT, and
error recovery.
(Object): Instead of just keeping a counter of instances, keep
a list of them.
* tests/c++.at (Exception safety): Let the parser support the --debug
option.
On 'p', throw an exception from the %printer.
* data/lalr1.cc (yyparse): Do not display the values we discard, as it
uses %printer, which might have thrown the exception.
* data/lalr1.cc: Check size > 1, rather than size != 1, when cleaning
the stack, as at the beginning, size is 0.
* tests/c++.at (Exception safety): Check exception safety in
%initial-action.
* data/lalr1.cc (YY_SYMBOL_PRINT, YY_REDUCE_PRINT, YY_STACK_PRINT):
Define to something so that, for instance, "if (foo) YY_SYMBOL_PRINT"
is valid even when !YYDEBUG.
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 15:16:00 +0000 (17:16 +0200)]
Merge branch 'maint'
* origin/maint:
maint: word changes
lalr1.cc: fix test suite portability
maint: fix an erroneous include
tests: check that headers are self contained
doc: add missing documentation for --report
Akim Demaille [Thu, 4 Oct 2012 13:36:00 +0000 (15:36 +0200)]
scan-skel: use the scanner to reject all invalid directives
* src/scan-skel.l: Use a simpler and more consistent pattern escaping
scheme.
Catch all the invalid directives here by just removing the previous
catch-all-but-alphabetical rule.