errors: indent "user token number redeclaration" context
This is the continuation of the work on the readability of errors
context.
* src/symtab.c (user_token_number_redeclaration): Use
complain_at_indent to output with increased indentation level.
* tests/input:at: Apply this change.
errors: don't display "warnings treated as errors"
This line doesn't add any meaningful information anymore, the appended
[-Werror=CATEGORY] is enough. It is actually more insightful, as it
allows to distinguish warnings treated as errors from those that
aren't. This line is also removed by gcc 4.8.
* src/complain.c (set_warnings_issued): The only action left was
checking if the error bit corresponding to the warning issued was set,
and that function was only called once. Therefore, remove it, and do
its job directly in the caller...
(complains): here.
* src/complains.h: Adjust.
* tests/input.at: Adjust.
* NEWS: Document this change.
The prefix of warnings treated as errors is now "error: ". Also, their
suffix now reflects the changes in the Werror option format.
An output for -Werror=other used to be:
bison: warnings being treated as errors
input.y:1.1: warning: stray ',' treated as white space [-Wother]
It is now:
bison: warnings being treated as errors
input.y:1.1: error: stray ',' treated as white space [-Werror=other]
The line "warnings being treated as errors" no longer adds any info,
it will be removed in a forthcoming change.
* NEWS: Add entry "Enhancement of the -Werror"
* doc/bison.texi: Move the warnings-as-error to a new bullet.
* src/complain.c (complains): Refactor, change the prefix of warnings
that are treated as errors.
(warnings_print_categories): Support for [-Werror=CATEGORY] display
* src/getargc.c (getargs): -y implies -Werror=yacc
* tests/input.at: Update expected --yacc output for coherence.
This new option is a lot more flexible than the previous one. Its
details will be discussed in the NEWS and info file, in a forthcoming
change.
If no category is specified (ie: used as simply "-Werror"), the
functionality is the same as before.
* src/complain.c (errors_flag): New variable.
(set_warning_issued): Accept warning categories as an argument.
* src/complain.h (Wall): Better definition.
* src/getargs.c (flags_argmatch): Support for the new format.
(usage): Update -Werror to -Werror[=CATEGORY] format.
* src/complain.c (errors_flag): New variable.
(set_warning_issued): Accept warning categories as an argument.
* src/complain.h (Wall): Better definition.
* src/getargs.c (flags_argmatch): Support for the new format.
(usage): Update -Werror to -Werror=[CATEGORY] format.
This improves readability. This is also what gcc does.
* NEWS: Document this change.
* src/complain.c (complain_at): Prefix all errors with "error: ".
(complain_at_indent, warn_at_indent): Do not prefix the context
information of errors, which are basically just indented errors.
* tests/conflicts.at, tests/glr-regression.at, tests/input.at,
tests/named-refs.at, tests/output.at, tests/push.at,
tests/regression.at, tests/skeletons.at: Apply this change.
errors: indent "invalid value for %define" context
This is the continuation of the work on the readability of errors
context.
For example, what used to be:
input.y:1.9-29: invalid value for %define variable 'foo' : 'bar'
input.y:1.9-29: accepted value: 'most'
is now:
input.y:1.9-29: invalid value for %define variable 'foo' : 'bar'
input.y:1.9-29: accepted value: 'most'
* src/muscle-tab.c (muscle_percent_define_check_values): Use
complain_at_indent to output with increased indentation level.
* tests/input:at: Apply this change.
This is the continuation of the work on the readability of errors
context.
For example, what used to be:
input.y:2.9-11: %define variable 'var' redefined
input.y:1.9-11: previous definition
is now:
input.y:2.9-11: %define variable 'var' redefined
input.y:1.9-11: previous definition
* src/muscle-tab.c (muscle_percent_define_insert): Use
complain_at_indent to output with increased indentation level.
* tests/input.at: Apply this change.
input.y:6.5-10: result type clash on merge function 'merge': [...]
input.y:2.4-9: previous declaration
In order to distinguish the actual error from the context provided, we
rather this new output:
input.y:6.5-10: result type clash on merge function 'merge': [...]
input.y:2.4-9: previous declaration
Another patch will introduce an "error: " prefix to all non-indented
lines, giving yet better readability to the reports.
* src/complain.h (SUB_INDENT): Move to here.
* src/reader.c (record_merge_function_type): Use complain_at_indent to
output with increased indentation level.
* src/scan-code.l (SUB_INDENT): Remove from here.
* tests/glr-regression.at: Apply this change.
warnings: use the regular interface for s/r and r/r conflicts
The current routines used to display s/r and r/r conflicts are both
inconvenient from the programmer point of view (they do not use the
warning infrastructure) and for the user (the messages are rather
terse, not necessarily pleasant to read, and because they don't use
the same routines, they look different).
It was due to the belief (dating back to the initial checked-in
version of Bison) that, at some point, POSIX Yacc mandated the format
for these messages. Today, the Open Group's manual page for Yacc,
<http://pubs.opengroup.org/onlinepubs/009695399/utilities/yacc.html>,
explicitly states that the format of these messages is unspecified.
See commit be7280480c175bed203883f524c7dcd6cf37c13d and
<http://lists.gnu.org/archive/html/bison-patches/2002-12/msg00027.html>.
For a discussion on the chosen warning format, see
http://lists.gnu.org/archive/html/bison-patches/2012-09/msg00039.html
In an effort to factor the handling of errors and warnings, use the
Bison warning routines to report these messages.
* src/conflicts.c (conflicts_print): Rewrite with clearer sections
about S/R and then R/R conflicts.
(conflict_report): Remove, inlined in its sole
caller...
(conflicts_output): here.
* tests/conflicts.at, tests/existing.at, tests/glr-regression.at,
* tests/reduce.at, tests/regression.at: Adjust the expected results.
* NEWS: Update.
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.
* src/conflicts.c (conflicts_print): Complain about %expect-rr if not
in GLR mode, regardless of the number of reduce/reduce conflicts.
* tests/conflicts.at (%expect-rr non GLR): New test.
* NEWS: Update.
* src/complain.h : errors_flag variable
* src/complain.c : actual stuff happens here
* src/conflits.c : differentiated SR and RR conflicts
* src/getargs.c : flags_argmatch recognizes the new -Werror format
* origin/maint:
maint: remove useless file
update files to ignore
remove useless include
use locale-indep. c_is* functions for parsing, not isspace, isprint etc
gnulib: update
--help: include a place to report translation issues
tests: style changes
tests: fix push-pull test
yacc.c: style changes
* 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, 15 Aug 2012 07:44:34 +0000 (09:44 +0200)]
undefined but unused is a warning
* src/symtab.c (symbol_check_defined): Undeclared symbols are only
a warning.
* tests/input.at (Undeclared symbols used for a printer or destructor):
Rename as...
(Undefined symbols): this, and check this case.
* NEWS: Doc it.
Akim Demaille [Wed, 15 Aug 2012 06:46:54 +0000 (08:46 +0200)]
glr.cc: %defines is no longer mandatory
* data/glr.cc: No longer require %defines.
When it is not given, define the position and location classes instead
of including their headers.
(b4_shared_declarations): Use the original parse-params.
* data/glr.c (b4_shared_declarations): Define only if undefined.
* tests/actions.at, tests/calc.at: No longer force the use of %defines
for glr.cc.
* NEWS: Doc it.
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 [Sat, 11 Aug 2012 07:16:08 +0000 (09:16 +0200)]
minor refactoring: shorten variable names
* src/scan-skel.l (at_directive_argc, at_directive_argv)
(AT_DIRECTIVE_ARGC_MAX): Rename as...
(argc, argv, ARGC_MAX): these, as there is no possible confusion.
(flags): New.
(QPUTS): Remove, inline its only use.
Akim Demaille [Sat, 11 Aug 2012 07:02:19 +0000 (09:02 +0200)]
obstacks: simplifications
* src/system.h (obstack_finish0): New.
Use it to simplify several uses.
* src/muscle-tab.h (MUSCLE_INSERTF): New.
* src/muscle-tab.c: Use obstack_printf where simpler.
Akim Demaille [Fri, 10 Aug 2012 08:11:32 +0000 (10:11 +0200)]
minor refactoring in user code scanning
* src/scan-code.l (show_sub_message, show_sub_messages): Instead of a
Boolean, take a "warnings" argument.
Avoid storing printf-like format strings in a variable, so that GCC
can check them.
Akim Demaille [Fri, 3 Aug 2012 08:52:55 +0000 (10:52 +0200)]
Merge branch 'maint'
* origin/maint:
maint: post-release administrivia
version 2.6.2
NEWS: update.
yacc: remove trailing end of line at end of file
thanks: fix a contributor name
gnulib: update
tests: synch line -> syncline, for consistency
tests: synclines: style changes
tests: synclines: fix perl invocation
regen
c++: trailing end-of-lines in %parse-param
tests: simplify
* data/c.m4, data/glr.c, data/yacc.c (YYID): Remove.
No longer use ARGSUSED.
* src/getargs.c: Restore simpler inclusion of getopt.h (anyway, since
then we now use gnulib which certainly protects us from such issues).
Akim Demaille [Thu, 2 Aug 2012 12:11:07 +0000 (14:11 +0200)]
skeletons: simplify after knr removal
* data/c.m4 (b4_yydestruct_generate, b4_yy_symbol_print_generate):
They no longer need an argument, it has a single possible value.
* data/glr.c, data/yacc.c: Adjust.
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.
* maint:
use obstack_printf
scanner: restore a missing start condition
gnulib: update
maint: post-release administrivia
version 2.6.1
gnulib: update
maint: fix some syntax-check issues
tests: do not depend on __cplusplus to decide for C++ or C output
* tests/output.at (AT_CHECK_OUTPUT): It used to check that the
expected files are indeed generated, but it did not check that
there are no additional ones.
Do that, and adjust expectations (in particular alphabetical order).
lalr1.cc: location.hh and position.hh are not generated without %defines
* data/location.cc (b4_position_define, b4_location_define): New.
(location.hh, position.hh): Generate only if %defines.
* data/lalr1.cc: therefore, define these classes when locations are
needed, but headers are not generated.
* tests/output.at: Check that these files are not generated.
* NEWS: Document.
* data/glr.cc: Use b4_locations_if where appropriate.
* data/lalr1.cc: M4 quotation changes to highlight code duplication
with glr.cc.
* tests/calc.at: Check glr.cc with and without %location.
While at it, fuse multiple %parse-params into one.
* tests/actions.at: Simplify.
* NEWS: Doc this.
Some other wording changes.
$ 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