Commit Graph

4802 Commits

Author SHA1 Message Date
Akim Demaille
1048a1c901 errors: change output, and improve -y coherence
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.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-27 12:19:09 +02:00
Theophile Ranquet
9503b0a4a8 errors: introduce the -Werror=CATEGORY option
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.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-27 11:08:07 +02:00
Akim Demaille
11b192127c Merge branch 'maint'
* maint:
  warnings: introduce -Wdeprecated in the usage info
  errors: prefix the output with "error: "
  errors: indent "invalid value for %define" context
  errors: indent "%define var" redefinition context
  errors: indent "symbol redeclaration" context
  errors: indent "result type clash" error context

Conflicts:
	src/complain.c
	src/muscle-tab.c
	src/reader.c
	src/symtab.c
	tests/conflicts.at
	tests/input.at
	tests/named-refs.at
	tests/output.at
	tests/skeletons.at
2012-09-26 14:51:11 +02:00
Theophile Ranquet
bd52638008 warnings: introduce -Wdeprecated in the usage info
The deprecated warning, introduced some time ago, was not displayed in
the usage message. This patch addresses the issue.

* src/getargs.c (usage): Insert here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-26 12:28:10 +02:00
Akim Demaille
37cfa1195d regen 2012-09-26 12:20:44 +02:00
Akim Demaille
6c05543cb0 Merge remote-tracking branch 'origin/maint'
* origin/maint:
  regen
  yacc: fix handling of CPP guards when no header is generated
  gnulib: update
2012-09-26 12:19:15 +02:00
Theophile Ranquet
b8e7ad5887 errors: prefix the output with "error: "
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.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-26 12:11:51 +02:00
Theophile Ranquet
a974c1ec26 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.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-26 12:08:55 +02:00
Theophile Ranquet
6b1e1872d4 errors: indent "%define var" redefinition context
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.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-26 12:06:03 +02:00
Theophile Ranquet
cbaea0106d errors: indent "symbol redeclaration" context
This is the continuation of the work on the readability of errors
context.

For example, what used to be:
  input.y:5.10-24: %printer redeclaration for <field2>
  input.y:3.11-25: previous declaration

is now:
  input.y:5.10-24: %printer redeclaration for <field2>
  input.y:3.11-25:     previous declaration

* NEWS: Document this change.
* src/symtab.c (symbol_redeclaration, semantic_type_redeclaration,
user_token_number_redeclaration, default_tagged_destructor_set,
default_tagless_destructor_set, default_tagged_printer_set,
default_tagless_printer_set): Use complain_at_indent to
output with increased indentation level.
* tests/input.at: Apply this change.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-26 12:03:57 +02:00
Theophile Ranquet
24d96dd3eb errors: indent "result type clash" error context
This used to be the format of the error report:

  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.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-09-26 12:00:29 +02:00
Akim Demaille
d87ea54cf6 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 be7280480c 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.
2012-09-25 20:19:41 +02:00
Akim Demaille
63fec1eeba regen 2012-09-25 10:29:02 +02:00
Akim Demaille
6b4cb804b5 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.
2012-09-25 10:24:37 +02:00
Akim Demaille
53425dbfaa gnulib: update 2012-09-25 10:24:36 +02:00
Akim Demaille
6c094ad0e3 conflicts: refactor the counting routines
* src/conflicts.c (count_sr_conflicts, count_rr_conflicts): Rename as...
(count_sr_conflicts, count_rr_conflicts): these.
Use size_t for counts.
(count_sr_conflicts, count_rr_conflicts): New.
Use them.
2012-09-21 15:48:56 +02:00
Akim Demaille
d140056923 %expect-rr is for GLR only
* 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.
2012-09-21 15:29:24 +02:00
Akim Demaille
51c994d8f0 TODO: lalr1.cc master vs maint
* TODO: here.
2012-09-21 09:16:11 +02:00
Akim Demaille
77a1a208a9 c++: coding style fixes
* data/lalr1.cc, tests/c++.at: Formatting changes.
2012-09-21 09:16:11 +02:00
Akim Demaille
0d43e6057b Revert "introduced a GCC-like -Werror=type"
This reverts commit 981c53e257.
2012-09-21 09:16:11 +02:00
Akim Demaille
6652eeba58 Revert "made previous commit less hairy"
This reverts commit fd01e1d05e.
2012-09-21 09:16:11 +02:00
Akim Demaille
fcd7e48cb6 Revert "new Werror report format fixed in a test"
This reverts commit 41511178a7.
2012-09-21 09:16:11 +02:00
Theophile Ranquet
41511178a7 new Werror report format fixed in a test
* tests/input.at : replaced [-Wyacc] with [-Werror=yacc]

todo: fix the other failed test of the suite, tests/conflicts.at:1554
2012-09-21 05:08:47 +02:00
Theophile Ranquet
fd01e1d05e made previous commit less hairy
* src/getargs.c : here
2012-09-21 05:03:08 +02:00
Theophile Ranquet
981c53e257 introduced a GCC-like -Werror=type
* 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
2012-09-20 12:27:14 +02:00
Akim Demaille
47f6a236ec regen 2012-09-04 18:53:45 +02:00
Akim Demaille
6b5a748937 Merge remote-tracking branch 'origin/maint'
* 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

Conflicts:
	src/system.h
2012-09-04 18:51:55 +02:00
Akim Demaille
403ddfb7e0 maint: remove useless file
* externals/bootstrap.cfg: Remove.
This file was used by a specific build system.
It was added to the master repository by accident.
2012-09-04 11:00:11 +02:00
Akim Demaille
76e5017732 update files to ignore
* 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>.
2012-09-04 10:50:30 +02:00
Akim Demaille
592bdad15e remove useless include
* 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.
2012-09-04 09:51:12 +02:00
Jim Meyering
457bf91968 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.
2012-09-03 19:45:03 +02:00
Akim Demaille
2e350a617f gnulib: update 2012-09-03 16:40:03 +02:00
Akim Demaille
d740d2b541 --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.
2012-09-03 16:40:03 +02:00
Akim Demaille
1f77b2e095 news: style changes
* NEWS: Minor improvements.
2012-09-03 16:23:15 +02:00
Akim Demaille
2a8be426c3 use -Wdeprecated for obsolete %define variable names
* src/muscle-tab.c (muscle_percent_variable_update): Here.
* tests/input.at (%define backward compatibility): Update expectations.
2012-09-03 16:23:15 +02:00
Akim Demaille
518e88308f introduce -Wdeprecated
GCC seems to be using "deprecated" consistently over "obsoleted", so
use -Wdeprecated rather than -Wobsolete.

* src/complain.h (warnings): Add Wdeprecated.
* src/complain.c (warnings_print_categories): Adjust.
* src/getargs.c: Likewise.
* doc/bison.texi: Document it.

* src/scan-code.l: Use this category for the trailing ';' support.
* tests/actions.at: Adjust expected output.
2012-09-03 16:23:15 +02:00
Akim Demaille
31557b9ead 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.
2012-09-03 16:23:15 +02:00
Akim Demaille
e4c0985b5c 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.
2012-09-03 16:23:15 +02:00
Akim Demaille
836dc3342b todo: check push parsers 2012-09-03 16:23:15 +02:00
Akim Demaille
70a04dce64 style: remove useless C++ provisio
* src/complain.h: here.
2012-09-03 16:23:15 +02:00
Akim Demaille
5320fffdd8 parser: style changes
* src/parse-gram.y: Avoid deprecated directives.
2012-09-03 16:23:14 +02:00
Akim Demaille
a76c741d9b doc: address a fixme
* doc/bison.texi (Calc++ Parser): Add a cross-reference.
2012-09-03 16:23:14 +02:00
Akim Demaille
3edfae0490 style changes
* data/glr.cc, tests/actions.at: Fix comments.
* src/symtab.h, src/symtab.c: Fix indentation/comments.
* src/symlist.c: Fix indentation.
2012-09-03 16:22:06 +02:00
Akim Demaille
e411069eee 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.
2012-08-31 17:50:43 +02:00
Akim Demaille
ae62d0fc4f tests: fix push-pull test
* tests/torture.at: %push-pull-parser is no longer supported.
2012-08-31 17:50:43 +02:00
Akim Demaille
e3f8c4ef69 yacc.c: style changes
* data/yacc.c: (yytoken): Define with initial value.
2012-08-31 17:50:31 +02:00
Akim Demaille
1ad6f4daa3 refactoring: define variables with a value
* src/muscle-tab.c: Where possible, fuse definition and initial assignment.
2012-08-12 09:52:46 +02:00
Akim Demaille
b9c3c10c1c 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.
2012-08-12 09:52:11 +02:00
Akim Demaille
6fbe73b6a0 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.
2012-08-12 09:52:11 +02:00
Akim Demaille
c7324354fb 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.
2012-08-12 09:52:06 +02:00