diagnostics: "-Werror -Wno-error=foo" must not emit errors

Currently "-Werror -Wno-error=foo" still turns "foo" warnings into errors.
Reported by Alexandre Duret-Lutz.
See http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html.

* src/complain.c (errority, errority_flag): New.
(complain_init): Initialize the latter.
(warning_argmatch): Extract the loop iterating on the flag's bits.
Set and unset errority_flag here.
(warnings_argmatch): -Wno-error is not the same as -Wno-error=everything:
we must remember if category foo was explicitly turned in an error/warning
via -W(no-)error=foo.
(warning_severity): Use errority_flag.

* tests/input.at (Symbols): Just check --yacc, not -Wyacc, that's the
job of tests on -W.
(-Werror is not affected by -Wnone and -Wall): Rename as...
(-Werror combinations): this.
Tests more combinations of -W, -W(no-)error, and -W(no-)error=foo.
* tests/local.at (AT_BISON_CHECK_WARNINGS): Don't expect -Werror
to turn runs that issue warnings into runs with errors, as the
warnings might be enforced as warnings by -Wno-error=foo, in which
case -Werror does not change anything.

* doc/bison.texi (Bison Options): Try to be clearer about how
-W(no-)error and -W(no-)error=foo interact.
This commit is contained in:
Akim Demaille
2013-10-16 10:55:28 +02:00
parent 2b7fe38c36
commit e4678430c2
5 changed files with 102 additions and 57 deletions

View File

@@ -10065,18 +10065,16 @@ A category can be turned off by prefixing its name with @samp{no-}. For
instance, @option{-Wno-yacc} will hide the warnings about
POSIX Yacc incompatibilities.
@item -Werror[=@var{category}]
@itemx -Wno-error[=@var{category}]
Enable warnings falling in @var{category}, and treat them as errors. If no
@var{category} is given, it defaults to making all enabled warnings into errors.
@item -Werror
Turn enabled warnings for every @var{category} into errors, unless they are
explicitly disabled by @option{-Wno-error=@var{category}}.
@item -Werror=@var{category}
Enable warnings falling in @var{category}, and treat them as errors.
@var{category} is the same as for @option{--warnings}, with the exception that
it may not be prefixed with @samp{no-} (see above).
Prefixed with @samp{no}, it deactivates the error treatment for this
@var{category}. However, the warning itself won't be disabled, or enabled, by
this option.
Note that the precedence of the @samp{=} and @samp{,} operators is such that
the following commands are @emph{not} equivalent, as the first will not treat
S/R conflicts as errors.
@@ -10086,6 +10084,14 @@ $ bison -Werror=yacc,conflicts-sr input.y
$ bison -Werror=yacc,error=conflicts-sr input.y
@end example
@item -Wno-error
Do not turn enabled warnings for every @var{category} into errors, unless
they are explicitly enabled by @option{-Werror=@var{category}}.
@item -Wno-error=@var{category}
Deactivate the error treatment for this @var{category}. However, the warning
itself won't be disabled, or enabled, by this option.
@item -f [@var{feature}]
@itemx --feature[=@var{feature}]
Activate miscellaneous @var{feature}. @var{feature} can be one of: