]> git.saurik.com Git - bison.git/commit
diagnostics: revamp the handling of -Werror
authorAkim Demaille <akim@lrde.epita.fr>
Thu, 14 Feb 2013 08:25:36 +0000 (09:25 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Sat, 16 Feb 2013 06:45:06 +0000 (07:45 +0100)
commit808e523db40335778897b413d446dff1d41d0e85
tree34184f75d5a0c9a0ad3ea00fbe10a1c6a8042047
parent4a3c55cf1abd36bebf3058f67b130d0a17305db6
diagnostics: revamp the handling of -Werror

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.
src/complain.c
src/complain.h
src/getargs.c
src/main.c
tests/input.at