summaryrefslogtreecommitdiff
path: root/src/complain.h
Commit message (Collapse)AuthorAgeFilesLines
* diagnostics: modernize the display of submessagesVictor Morales Cayuela2020-02-151-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since Bison 2.7, output was indented four spaces for explanatory statements. For example: input.y:2.7-13: error: %type redeclaration for exp input.y:1.7-11: previous declaration Since the introduction of caret-diagnostics, it became less clear. Remove the indentation and display submessages as in GCC: input.y:2.7-13: error: %type redeclaration for exp 2 | %type <float> exp | ^~~~~~~ input.y:1.7-11: note: previous declaration 1 | %type <int> exp | ^~~~~ * src/complain.h (SUB_INDENT): Remove. (warnings): Add "note" to the enum. * src/complain.h, src/complain.c (complain_indent): Replace by... (subcomplain): this. Adjust all dependencies. * tests/actions.at, tests/diagnostics.at, tests/glr-regression.at, * tests/input.at, tests/named-refs.at, tests/regression.at: Adjust expectations.
* diagnostics: modernize bison's syntax errorsAkim Demaille2020-01-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to display the unexpected token first: $ bison foo.y foo.y:1.8-13: error: syntax error, unexpected %token, expecting character literal or identifier or <tag> 1 | %token %token | ^~~~~~ GCC uses a different format: $ gcc-mp-9 foo.c foo.c:1:5: error: expected identifier or '(' before ')' token 1 | int()()() | ^ and so does Clang: $ clang-mp-9.0 foo.c foo.c:1:5: error: expected identifier or '(' int()()() ^ 1 error generated. They display the unexpected token last (or not at all). Also, they don't waste width with "syntax error". Let's try that. It gives, for the same example as above: $ bison foo.y foo.y:1.8-13: error: expected character literal or identifier or <tag> before %token 1 | %token %token | ^~~~~~ * src/complain.h, src/complain.c (syntax_error): New. * src/parse-gram.y (yyreport_syntax_error): Use it.
* package: bump copyrights to 2020Akim Demaille2020-01-051-1/+1
| | | | Run 'make update-copyright'.
* diagnostics: style changesAkim Demaille2019-12-021-0/+2
| | | | | | * src/complain.h, src/complain.c: Comment changes. * src/scan-skel.l: Reduce scopes. * data/skeletons/bison.m4: Factor diagnostic functions.
* diagnostics: complain about undeclared string tokensAkim Demaille2019-11-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | String literals, which allow for better error messages, are (too) liberally accepted by Bison, which might result in silent errors. For instance %type <exVal> cond "condition" does not define “condition” as a string alias to 'cond' (nonterminal symbols do not have string aliases). It is rather equivalent to %nterm <exVal> cond %token <exVal> "condition" i.e., it gives the type 'exVal' to the "condition" token, which was clearly not the intention. Introduce -Wdangling-alias to catch this. * src/complain.h, src/complain.c: Add support for -Wdangling-alias. (argmatch_warning_args): Sort. * src/symtab.c (symbol_check_defined): Complain about dangling aliases. * doc/bison.texi: Document it. * tests/input.at (Dangling aliases): New test.
* Prefer signed to unsigned integersPaul Eggert2019-10-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains more fixes to prefer signed to unsigned integer types, as modern tools like 'gcc -fsanitize=undefined' can check for signed integer overflow but not unsigned overflow. * NEWS: Document the API change. * boostrap.conf (gnulib_modules): Add intprops. * data/skeletons/glr.c: Include stddef.h and stdint.h, since this skeleton can assume C99 or later. (YYSIZEMAX): Now signed, and the minimum of SIZE_MAX and PTRDIFF_MAX. (yybool) [!__cplusplus]: Now signed (which is how bool behaves). (YYTRANSLATE): Avoid use of unsigned, and make the macro safe even for values greater than UINT_MAX. (yytnamerr, struct yyGLRState, struct yyGLRStateSet, struct yyGLRStack) (yyaddDeferredAction, yyinitStateSet, yyinitGLRStack) (yyexpandGLRStack, yymarkStackDeleted, yyremoveDeletes) (yyglrShift, yyglrShiftDefer, yy_reduce_print, yydoAction) (yyglrReduce, yysplitStack, yyreportTree, yycompressStack) (yyprocessOneStack, yyreportSyntaxError, yyrecoverSyntaxError) (yyparse, yy_yypstack, yypstack, yypdumpstack): * tests/input.at (Torturing the Scanner): Prefer ptrdiff_t to size_t. * data/skeletons/c++.m4 (b4_yytranslate_define): * src/AnnotationList.c (AnnotationList__computePredecessorAnnotations): * src/AnnotationList.h (AnnotationIndex): * src/InadequacyList.h (InadequacyListNodeCount): * src/closure.c (closure_new): * src/complain.c (error_message, complains, complain_indent) (complain_args, duplicate_directive, duplicate_rule_directive): * src/gram.c (nritems, ritem_print, grammar_dump): * src/ielr.c (ielr_compute_ritem_sees_lookahead_set) (ielr_item_has_lookahead, ielr_compute_annotation_lists) (ielr_compute_lookaheads): * src/location.c (columns, boundary_print, location_print): * src/muscle-tab.c (muscle_percent_define_insert) (muscle_percent_define_check_values): * src/output.c (prepare_rules, prepare_actions): * src/parse-gram.y (id, handle_require): * src/reader.c (record_merge_function_type, packgram): * src/reduce.c (nuseless_productions, nuseless_nonterminals) (inaccessable_symbols): * src/relation.c (relation_print): * src/scan-code.l (variant, variant_table_size, variant_count) (variant_add, get_at_spec, show_sub_message, show_sub_messages) (parse_ref): * src/scan-gram.l (<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>) (scan_integer, convert_ucn_to_byte, handle_syncline): * src/scan-skel.l (at_complain): * src/symtab.c (complain_symbol_redeclared) (complain_semantic_type_redeclared, complain_class_redeclared) (symbol_class_set, complain_user_token_number_redeclared): * src/tables.c (conflict_tos, conflrow, conflict_table) (conflict_list, save_row, pack_vector): * tests/local.at (AT_YYLEX_DEFINE(c)): Prefer signed to unsigned integer. * data/skeletons/lalr1.cc (yy_lac_check_): * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): * tests/local.at (AT_YYLEX_DEFINE(c)): Omit now-unnecessary casts. * data/skeletons/location.cc (b4_location_define): * doc/bison.texi (Mfcalc Lexer, C++ position, C++ location): Prefer int to unsigned for line and column numbers. Change example to abort explicitly on memory exhaustion, and fix an off-by-one bug that led to undefined behavior. * data/skeletons/stack.hh (stack::operator[]): Also allow ptrdiff_t indexes. (stack::pop, slice::slice, slice::operator[]): Index arg is now ptrdiff_t, not int. (stack::ssize): New method. (slice::range_): Now ptrdiff_t, not int. * data/skeletons/yacc.c (b4_state_num_type): Remove. All uses replaced by b4_int_type. (YY_CONVERT_INT_BEGIN, YY_CONVERT_INT_END): New macros. (yylac, yyparse): Use them around conversions that -Wconversion would give false alarms about. Omit unnecessary casts. (yy_stack_print): Use int rather than unsigned, and omit a cast that doesn’t seem to be needed here any more. * examples/c++/variant.yy (yylex): * examples/c++/variant-11.yy (yylex): Omit no-longer-needed conversions to unsigned. * src/InadequacyList.c (InadequacyList__new_conflict): Don’t assume *node_count is unsigned. * src/output.c (muscle_insert_unsigned_table): Remove; no longer used.
* diagnostics: use the modern argmatch interfaceAkim Demaille2019-07-261-13/+11
| | | | | | | | | | * src/complain.h (warnings): Remove Werror. Adjust dependencies. Sort. Remove useless comments (see the doc in argmatch group). * src/complain.c (warnings_args, warnings_types): Remove. (warning_argmatch): Use argmatch_warning_value. (warnings_print_categories): Use argmatch_warning_argument.
* gnulib: use new features of the argmatch moduleAkim Demaille2019-07-031-0/+2
| | | | | | | | | | | | It can now generate the usage message. * src/complain.h (feature_fixit_parsable): Rename as... (feature_fixit): this, for column economy. Adjust dependencies. (warning_usage): New. Use it. * src/complain.h, src/complain.c, src/getargs.h, src/getargs.c: Use ARGMATCH_DEFINE_GROUP instead of the older interface.
* diagnostics: expose a means to know whether a warning is enabledAkim Demaille2019-04-241-0/+3
| | | | * src/complain.h, src/complain.c (warning_is_enabled): New.
* diagnostics: fix memory leak in libtextstyleAkim Demaille2019-04-181-0/+3
| | | | | * src/complain.h, src/complain.c (complain_free): New. * src/main.c: Use it.
* diagnostics: use libtextstyle for colored outputAkim Demaille2019-03-161-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Bruno Haible released libtextstyle, a library for colored output based on CSS. Let's use it to generate colored diagnostics, provided libtextstyle is available. See https://lists.gnu.org/archive/html/bug-gnulib/2019-01/msg00176.html https://lists.gnu.org/archive/html/bison-patches/2019-02/msg00073.html https://lists.gnu.org/archive/html/bison-patches/2019-02/msg00084.html https://lists.gnu.org/archive/html/bison-patches/2019-03/msg00007.html * bootstrap.conf (gnulib_modules): Use libtextstyle when possible. * data/diagnostics.css: New. * src/complain.c (begin_use_class, end_use_class, flush) (severity_style, complain_init_color): New. Use them. * src/getargs.c (getargs_colors): New. (getargs): Use it. Skip --color and --style. * src/location.h, src/location.c (location_print): Use a style. * tests/bison.in: Force --color=yes when stderr is a tty. * tests/local.at: Disable colors during the test suite. * tests/input.at: Adjust expectations to the extra options passed on the command line.
* fixits: report duplicate %yacc directivesAkim Demaille2019-01-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should use -ffixit and --update to clean files with duplicate directives. And we should complain only once about duplicate obsolete directives: keep only the "duplicate" warning. Let's start with %yacc. For instance on: %fixed-output_files %fixed-output-files %yacc %% exp: This run of bison: $ bison /tmp/foo.y -u foo.y:1.1-19: warning: deprecated directive, use '%fixed-output-files' [-Wdeprecated] %fixed-output_files ^~~~~~~~~~~~~~~~~~~ foo.y:2.1-19: warning: duplicate directive [-Wother] %fixed-output-files ^~~~~~~~~~~~~~~~~~~ foo.y:1.1-19: previous declaration %fixed-output_files ^~~~~~~~~~~~~~~~~~~ foo.y:3.1-5: warning: duplicate directive [-Wother] %yacc ^~~~~ foo.y:1.1-19: previous declaration %fixed-output_files ^~~~~~~~~~~~~~~~~~~ bison: file 'foo.y' was updated (backup: 'foo.y~') gives: %fixed-output-files %% exp: * src/location.h, src/location.c (location_empty): New. * src/complain.h, src/complain.c (duplicate_directive): New. * src/getargs.h, src/getargs.c (yacc_flag): Instead of a Boolean, be the location of the definition. Update dependencies. * src/scan-gram.l (%yacc, %fixed-output-files): Move the handling of its warnings to... * src/parse-gram.y (do_yacc): This new function. * tests/input.at (Deprecated Directives): Adjust expectations.
* style: rename duplicate_directive as duplicate_rule_directiveAkim Demaille2019-01-161-2/+2
| | | | | * src/complain.h, src/complain.c: here. Adjust callers.
* package: bump copyrights to 2019Akim Demaille2019-01-051-1/+1
|
* diagnostics: complain about Bison directives when -WyaccAkim Demaille2018-11-291-0/+3
| | | | | | * src/complain.h, src/complain.c (bison_directive): New. * src/scan-gram.l (BISON_DIRECTIVE): New. Use it for Bison extensions.
* %nterm: do not accept character literalsAkim Demaille2018-11-271-2/+1
| | | | | | | | | | Reported by Rici Lake. http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html * src/complain.h: Formatting change. * src/parse-gram.y (id): Reject character literals used in a context for non-terminals. * tests/input.at (Invalid %nterm uses): Check that.
* Update copyright yearsAkim Demaille2018-05-121-2/+2
| | | | Run `make update-copyright`.
* package: bump to 2015Akim Demaille2015-01-041-1/+1
| | | | | | Which also requires: * gnulib: Update.
* package: bump to 2014Akim Demaille2014-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README, * README-alpha, README-hacking, THANKS, TODO, bootstrap.conf, * build-aux/darwin11.4.0.valgrind, build-aux/local.mk, * build-aux/update-b4-copyright, * build-aux/update-package-copyright-year, cfg.mk, configure.ac, * data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4, * data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc, * data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java, * data/local.mk, data/location.cc, data/stack.hh, data/variant.hh, * data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl, * data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint, * djgpp/README.in, djgpp/config.bat, djgpp/config.sed, * djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat, * djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h, * djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex, * etc/README, etc/bench.pl.in, etc/local.mk, * examples/calc++/calc++.test, examples/calc++/local.mk, * examples/extexi, examples/local.mk, examples/mfcalc/local.mk, * examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk, * examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy, * lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c, * lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h, * lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c, * lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c, * lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h, * lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def, * lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c, * m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4, * m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h, * src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h, * src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h, * src/closure.c, src/closure.h, src/complain.c, src/complain.h, * src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h, * src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c, * src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c, * src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h, * src/local.mk, src/location.c, src/location.h, src/main.c, * src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c, * src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c, * src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c, * src/print-xml.h, src/print.c, src/print.h, src/print_graph.c, * src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c, * src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h, * src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h, * src/scan-skel.l, src/state.c, src/state.h, src/symlist.c, * src/symlist.h, src/symtab.c, src/symtab.h, src/system.h, * src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h, * tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at, * tests/calc.at, tests/conflicts.at, tests/cxx-type.at, * tests/existing.at, tests/glr-regression.at, tests/headers.at, * tests/input.at, tests/java.at, tests/javapush.at, tests/local.at, * tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at, * tests/reduce.at, tests/regression.at, tests/sets.at, * tests/skeletons.at, tests/synclines.at, tests/testsuite.at, * tests/torture.at, tests/types.at: here.
* comment changesAkim Demaille2013-10-161-6/+6
| | | | * src/complain.h, src/complain.c: More documentation, more comments.
* diagnostics: no longer include the yacc category in -WallAkim Demaille2013-03-041-1/+2
| | | | | | | | | | | | | | It would be a pity to warn the users against Bison features... http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00107.html * src/complain.h, src/complain.c (Wall): Disable Wyacc. (Weverything): New (hidden so far) category which really denotes all the categories (what used to be Wall). (warnings_args, warnings_types): Adjust. (warning_argmatch): Now !none = Weverything and conversely, no longer Wall. * NEWS, doc/bison.texi, src/getargs.c: Adjust the documentation. * tests/input.at (-Werror is not affected by -Wnone and -Wall): Adjust by not using a -Wyacc type of warning.
* diagnostics: factor and enhance messages about duplicate rule directivesAkim Demaille2013-02-181-0/+4
| | | | | | | | | | | | | | | | | | | When reporting a duplicate directive on a rule, point to its first occurrence: one.y:11.10-15: error: only one %empty allowed per rule %empty {} %empty ^^^^^^ one.y:11.3-8: previous declaration %empty {} %empty ^^^^^^ And consistently discard the second one. * src/complain.h, src/complain.c (duplicate_directive): New. * src/reader.c: Use it where appropriate. * src/symlist.h, src/symlist.c (symbol_list): Add a dprec_location member. * tests/actions.at: Adjust expected output.
* diagnostics: %empty enables -Wempty-ruleAkim Demaille2013-02-181-0/+3
| | | | | | | | * src/complain.h, src/complain.c (warning_is_unset): New. * src/reader.c (grammar_current_rule_empty_set): If enabled -Wempty-rule, if not disabled. * tests/actions.at (Implicitly empty rule): Check this feature. Also check that -Wno-empty-rule does disable this warning.
* -Wempty-rule: diagnose empty rules without %emptyAkim Demaille2013-02-181-0/+2
| | | | | | | | | | * src/complain.h, src/complain.c (warning_empty_rule, Wempty_rule): New warning category. (warnings_args, warnings_types): Adjust. * src/reader.c (grammar_rule_check): Check the empty rules are flagged by %empty. * tests/actions.at (Implicitly empty rule): New. * tests/existing.at: Add expected warnings.
* style: move argument handling of -W into the diagnostics moduleAkim Demaille2013-02-161-19/+33
| | | | | | | | | | | | | | | This allows to reduce the number of public interfaces. * src/getargs.c (--yacc): Use warning_argmatch instead of tweaking directly warnings_flag (which will be private). (warning_argmatch, warnings_argmatch): Move to... * src/complain.h, src/complain.c: here. * src/getargs.h, src/getargs.c (warnings_args, warnings_types): Move to... * src/complain.c: here, now private. * src/complain.h (severity, warnings_flag): Move to... * src/complain.c: here, now private.
* diagnostics: revamp the handling of -WerrorAkim Demaille2013-02-161-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent discussions with Joel E. Denny (http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00026.html) show that it is desirable to tell the difference between an option that was explicitly disabled with -Wno-foo, as opposed to be left unset. The current framework does not allow this. Instead of having a first int to store which options are enabled, and another to store which are turned into errors, use an array that for each warning category tells its status: disabled, unset, warning, error. * src/complain.h, src/complain.c (warning_bit): New enum. (warnings): Use it. (severity): New enum. (warnings_flag): Now an array of severity. (errors_flag): Remove, now done by warnings_flag. (complain_init): New function, to initialie warnings_flag. (warnings_are_errors): New Boolean, for -Werror. * src/complain.c (warning_severity): New. (warnings_print_categories, complains): Use it. * src/getargs.c (warning_argmatch): Adjust to use warnings_flag. (warnings_argmatch): Ditto. Handle -Werror and -Wno-error here. (getargs): Adjust. * src/main.c (main): Call complain_init. * tests/input.at (Invalid options): Add more corner cases.
* diagnostics: factor the list of warning namesAkim Demaille2013-02-141-3/+0
| | | | | | | | | | | | * src/getargs.h, src/getargs.c (warnings_args, warnings_types): Make them public. * src/complain.h, src/complain.c (warnings_print_categories): Its only use outside complain.c was removed in a recent commit, so make it static. Simplify its implementation. Use warnings_args and warnings_types. * src/muscle-tab.c (muscle_percent_define_check_values): Make it silent.
* warnings: introduce -WprecedenceValentin Tolmer2013-01-301-1/+3
| | | | | | | | | | | | | | | | | | | The new warning category "precedence" flags useless precedence and associativity. -Wprecedence can now be used, it is disabled by default. The warnings about precedence and associativity are grouped into one, and the testsuite was corrected accordingly. * src/complain.h (warnings): Introduce "precedence". * src/complain.c (warnings_print_categories): Adjust. * src/getargs.c (warnings_args, warning_types): Likewise. * src/symtab.h, src/symtab.c (print_associativity_warnings): Remove. * src/symtab.h (register_assoc): Correct arguments. * src/symtab.c (print_precedence_warnings): Print both warnings together. * doc/bison.texi (Bison options): Document the warnings and provide an example. * tests/conflicts.at, tests/existing.at, tests/local.at, * tests/regression.at: Adapt the testsuite for the new category (-Wprecedence instead of -Wother where appropriate).
* maint: update copyright yearsAkim Demaille2013-01-121-1/+1
| | | | | Suggested by Stefano Lattarini. Run "make update-copyright".
* diagnostics: factor the deprecated directive messageAkim Demaille2012-12-231-0/+4
| | | | | * src/complain.h, src/complain.c (deprecated_directive): New. * src/muscle-tab.c: Use it.
* style changes: run cppiAkim Demaille2012-12-211-1/+1
| | | | | | | | | | | Run it in src/ for a start. * src/AnnotationList.h, src/InadequacyList.h, src/Sbitset.h, * src/closure.c, src/complain.h, src/flex-scanner.h, src/getargs.h, * src/gram.h, src/graphviz.h, src/ielr.h, src/location.h, * src/muscle-tab.h, src/named-ref.h, src/relation.h, src/scan-code.h, * src/state.h, src/symtab.h, src/system.h, src/uniqstr.h: Reindent preprocessor directives.
* diagnostics: improve -fcaret for list of accepted valuesAkim Demaille2012-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither' %define api.push_pull "neither" ^^^^^^^^^^^^^ input.y:1.9-21: accepted value: 'pull' %define api.push_pull "neither" ^^^^^^^^^^^^^ input.y:1.9-21: accepted value: 'push' %define api.push_pull "neither" ^^^^^^^^^^^^^ input.y:1.9-21: accepted value: 'both' %define api.push_pull "neither" ^^^^^^^^^^^^^ report input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither' %define api.push_pull "neither" ^^^^^^^^^^^^^ input.y:1.9-21: accepted value: 'pull' input.y:1.9-21: accepted value: 'push' input.y:1.9-21: accepted value: 'both' * src/complain.h (no_caret): New. * src/complain.c (error_message): Use it. * src/muscle-tab.c (muscle_percent_define_check_values): Use it. * src/scan-skel.l (flag): Ditto. * tests/input.at: Adjust and check.
* warnings: fix early exit of warnings treated as errorsTheophile Ranquet2012-10-261-1/+12
| | | | | | | | | | | | | | | 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.
* errors: support indented context info in m4 macrosTheophile Ranquet2012-10-041-1/+2
| | | | | | | | | | | | | * TODO: Address the issue, so remove it. * data/bison.m4: Use b4_error with [[note]] rather than a complain_at for context information. * src/complain.c (complain_args): Take an additional argument, an indentation pointer, to allow the dispatching of context information. * src/complain.h (complain_args): Adjust prototype. * src/scan-skel.l (at_directive_perform): Recognize the new @note mark. * tests/input.at: Adjust. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
* errors: pointerize complain_at_indentTheophile Ranquet2012-10-041-3/+3
| | | | | | | | | * src/complain.c (complain_at_indent): Rename as... (complaint_indent): This, and take the location as a pointer. * src/complain.h, src/muscle-tab.c, src/reader.c, src/scan-code.l, src/symtab.c: Adjust. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
* warnings: organize variadic complaints callTheophile Ranquet2012-10-011-0/+3
| | | | | | | | | | Move the dispatch of variadic complains to complain.c, rather than do it in a scanner. * src/complain.h, src/complain.c (complain_args): New. * src/scan-skel.l (at_directive_perform): Use it. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
* warnings: fusion of complain and complain_atTheophile Ranquet2012-10-011-6/+2
| | | | | | | | | | | | | | | | | | | These functions are very similar, and keeping them seperate makes future improvements difficult, so merge them. This impacts 89 calls. * src/bootstrap.conf: Adjust. * src/complain.c (complain, complain_at): Merge into... (complain): this. (complain_args): Adjust. * src/complain.h, src/conflicts.c, src/files.c, src/getargs.c, * src/gram.c, src/location.c, src/muscle-tab.c, src/parse-gram.y, * src/reader.c, src/reduce.c, src/scan-code.l, src/scan-gram.l, * src/scan-skel.l, src/symlist.c, src/symtab.c: Adjust. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
* errors: don't display "warnings treated as errors"Theophile Ranquet2012-09-271-10/+3
| | | | | | | | | | | | | | | | | | 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. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
* errors: introduce the -Werror=CATEGORY optionTheophile Ranquet2012-09-271-3/+9
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'maint'Akim Demaille2012-09-261-0/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * errors: indent "result type clash" error contextTheophile Ranquet2012-09-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * maint: run "make update-copyright".Akim Demaille2012-01-131-1/+1
| |
| * Add -Wconflicts-sr and -Wconflicts-rr.Joel E. Denny2011-04-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thus, conflict reports are now affected by -Werror and -Wnone (unless %expect or %expect-rr is specified). Reported by George Neuner at <http://lists.gnu.org/archive/html/bug-bison/2010-08/msg00002.html>. * NEWS (2.5): Document. * doc/bison.texinfo (Bison Options): Document. * src/complain.c, src/complain.h (set_warning_issued): Export function. * src/conflicts.c (conflicts_print): Suppress conflict report based on -Wno-conflicts-sr and -Wno-conflicts-rr, and treat conflicts as errors if -Werror. * src/getargs.c (warnings_flag): Initialize with warnings_conflicts_sr and warnings_conflicts_rr as well. (warnings_args, warnings_types): Add entries for warnings_conflicts_sr and warnings_conflicts_rr. (usage): Update. * src/getargs.h (enum warnings): Add entries for warnings_conflicts_sr and warnings_conflicts_rr. * tests/conflicts.at (-W versus %expect and %expect-rr): New test group. * tests/local.at (AT_BISON_CHECK_NO_XML): Update now that the conflict report can produce a "warnings being treated as errors" message. Also, check that stderr is now fully scrubbed by -Wnone when the exit status is 0.
| * Add -Wother so -Wnone suppresses all warnings.Joel E. Denny2011-04-031-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by George Neuner at <http://lists.gnu.org/archive/html/bug-bison/2010-08/msg00002.html>. * NEWS (2.5): Document. * THANKS (George Neuner): Add. * doc/bison.texinfo (Bison Options): Document. * src/complain.c, src/complain.h (warn_at, warn_at_indent, warn): Suppress warning if -Wno-other. (midrule_value_at): New warning function, similar to yacc_at in that it's controlled by its own warning category. * src/getargs.c (warnings_flag): Initialize to warnings_other. (warnings_args, warnings_types): Add entry for warnings_other. (usage): Update. * src/getargs.h (enum warnings): Add entry for warnings_other. * src/gram.c (grammar_rules_useless_report): If -Wno-other, then don't print useless rules. * src/reader.c (symbol_should_be_used): Rather than adjusting the return value based on whether midrule value warnings are enabled, accept a new parameter for telling the caller whether true is being returned for a potential midrule warning. (grammar_rule_check): Use midrule_value_at for midrule value warnings, and continue to use warn_at for all other warnings. Let them check whether the warnings are enabled. * tests/local.at (AT_BISON_CHECK): Update documentation. (AT_BISON_CHECK_NO_XML): Check that -Wnone and --warnings=none disable all warnings exercised in the test suite.
| * maint: run "make update-copyright".Joel E. Denny2011-01-021-2/+2
| |
| * Do not use date ranges in copyright notices.Paul Eggert2010-06-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices * HACKING, Makefile.am, NEWS, PACKAGING, README, README-alpha: * TODO, bootstrap, bootstrap.conf: * build-aux/update-b4-copyright, cfg.mk, configure.ac: * data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4: * data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc: * data/java-skel.m4, data/java.m4, data/lalr1.cc: * data/lalr1.java, data/location.cc: * data/xslt/bison.xsl: * data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl: * data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint: * djgpp/README.in, djgpp/config.bat, djgpp/config.sed: * djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat: * djgpp/subpipe.c, djgpp/subpipe.h: * djgpp/testsuite.sed, doc/bison.texinfo: * doc/refcard.tex, etc/README, etc/bench.pl.in: * examples/calc++/Makefile.am, examples/extexi: * lib/abitset.c, lib/abitset.h: * lib/bbitset.h, lib/bitset.c, lib/bitset.h: * lib/bitset_stats.c, lib/bitset_stats.h, lib/bitsetv-print.c: * lib/bitsetv-print.h, lib/bitsetv.c, lib/bitsetv.h: * lib/ebitset.c, lib/ebitset.h, lib/get-errno.c: * lib/get-errno.h, lib/lbitset.c, lib/lbitset.h: * lib/libiberty.h, lib/main.c, lib/timevar.c: * lib/timevar.def, lib/timevar.h, lib/vbitset.c: * lib/vbitset.h, lib/yyerror.c, m4/bison-i18n.m4: * m4/c-working.m4, m4/cxx.m4, m4/subpipe.m4, m4/timevar.m4: * src/AnnotationList.c, src/AnnotationList.h: * src/InadequacyList.c, src/InadequacyList.h, src/LR0.c: * src/LR0.h, src/Sbitset.c, src/Sbitset.h, src/assoc.c: * src/assoc.h, src/closure.c, src/closure.h, src/complain.c: * src/complain.h, src/conflicts.c, src/conflicts.h: * src/derives.c, src/derives.h, src/files.c, src/files.h: * src/flex-scanner.h, src/getargs.c, src/getargs.h: * src/gram.c, src/gram.h, src/graphviz.c, src/ielr.c: * src/ielr.h, src/lalr.c, src/lalr.h: * src/location.c, src/location.h, src/main.c: * src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c: * src/named-ref.h, src/nullable.c, src/nullable.h: * src/output.c, src/output.h, src/parse-gram.y: * src/print-xml.c, src/print-xml.h, src/print.c, src/print.h: * src/print_graph.c, src/print_graph.h, src/reader.c: * src/reader.h, src/reduce.c, src/reduce.h, src/relation.c: * src/relation.h, src/scan-code.h, src/scan-code.l: * src/scan-gram.h, src/scan-gram.l, src/scan-skel.h: * src/scan-skel.l, src/state.c, src/state.h, src/symlist.c: * src/symlist.h, src/symtab.c, src/symtab.h, src/system.h: * src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h: * tests/actions.at, tests/atlocal.in, tests/c++.at: * tests/calc.at, tests/conflicts.at, tests/cxx-type.at: * tests/existing.at, tests/glr-regression.at: * tests/headers.at, tests/input.at, tests/java.at: * tests/local.at, tests/named-refs.at: * tests/output.at, tests/push.at, tests/reduce.at: * tests/regression.at, tests/sets.at, tests/skeletons.at: * tests/synclines.at, tests/testsuite.at, tests/torture.at: * data/Makefile.am, data/location.cc, doc/Makefile.am, src/Makefile.am: * tests/Makefile.am, lib/Makefile.am, examples/Makefile.am: * etc/Makefile.am: Don't use date ranges in copyright notices. Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
| * maint: run "make update-copyright"Joel E. Denny2010-01-041-1/+2
| |
| * Keep sub-messages aligned. Fix strings for translation.Alex Rozenman2009-09-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/location.h: (location_print): Add return value. * src/location.c: (location_print): Return number of printed characters. * src/complain.h: Two new functions (complain_at_indent, warn_at_indent). * src/complain.cpp: Implement the alignment mechanism. Add new static variable (indent_ptr). Use and update it (error_message, complain_at_indent, warn_at_indent). * src/scan-code.l: Fix strings for translations. Use new *_indent functions (parse_ref, show_sub_messages). * tests/named-ref.at: Adjust testcases. * NEWS (2.5): Add an announcement about named references.
| * variables: accept dashes.Akim Demaille2009-04-291-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/scan-gram.l ({id}): Also accept dashes after the initial letter. ({directive}): Use {id}. * src/parse-gram.y: Comment and formatting changes. * doc/bison.texinfo (Symbols): Adjust the lexical definitions of symbols. * src/complain.h, src/complain.c (yacc_at): New. * src/symtab.c (symbol_new): Use yacc_at to report inappropriate symbol names. * src/output.c (token_definitions_output): Do not #define token names with dashes. (cherry picked from commit 4f646c3794c45940aaf96d5409eff02a2c74978e) Conflicts: data/bison.m4 src/parse-gram.y
* | Revert "introduced a GCC-like -Werror=type"Akim Demaille2012-09-211-9/+2
| | | | | | | | This reverts commit 981c53e257f1974854edc4f6ad0e88c7f18e2bea.