On Thu, Oct 12, 2017 at 9:40 PM, Andrew Pinski <pins...@gmail.com>

> -Wno-unkown-warning has already been handled silently since 4.6.0
> (which was released March 25, 2011):
> https://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Warning-Options.html
>
> When an unrecognized warning option is requested (e.g.,
> -Wunknown-warning), GCC emits a diagnostic stating that the option is
> not recognized. However, if the -Wno- form is used, the behavior is
> slightly different: no diagnostic is produced for -Wno-unknown-warning
> unless other diagnostics are being produced. This allows the use of
> new -Wno- options with old compilers, but if something goes wrong, the
> compiler warns that an unrecognized option is present.
>

True, writing -Wno-some-future-version-warning-option is silently ignored.
But -Wsome-future-version-warning-option currently generates a diagnostic
message. The proposal is to have an explicit `-Wno-unknown-warnings` flag
to suppress this diagnostic message.

The documentation uses `-Wno-unknown-warning` as an example name (instead
of saying something unwieldy like
`-Wno-some-future-version-warning-option`). There's no actual
`-Wno-unknown-warning` option.

Here is a concrete example to make this less abstract: Suppose one wants to
use `-Wsuggest-final-methods`. That's nice but versions 4.* of g++ do not
support this flag; the build tool needs to avoid specifying this command
line option if a 4.* g++ version is used.

The problem isn't specifically about this flag and version; this is just an
example; there are plenty of new useful warnings added in the recent past,
such as (partial list): `-Wnonnull-compare`, `-Wnull-dereference`,
`-Walloc-zero`, `-Wduplicated-cond`, `-Wrestrict`, ...

Thanks,

Oren.

Reply via email to