https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64644

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Harald van Dijk from comment #2)
> A question, though: I see that like many other existing warnings, this
> doesn't handle -Werror=pedantic. Is that something that should be addressed
> as well, or is that something that should at some later point be handled for
> all relevant warnings at once?

From: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options

-pedantic-errors
    Give an error whenever the base standard (see -Wpedantic) requires a
diagnostic, in some cases where there is undefined behavior at compile-time and
in some other cases that do not prevent compilation of programs that are valid
according to the standard. This is not equivalent to -Werror=pedantic, since
there are errors enabled by this option and not enabled by the latter and vice
versa.

From: https://gcc.gnu.org/wiki/DiagnosticsGuidelines

pedwarn is for code that is accepted by GCC but it should be rejected or
diagnosed according to the current standard, or it conflicts with the standard
(either the default or the one selected by -std=). Most pedwarns are controlled
by -Wpedantic, a few are controlled by options that are enabled by -Wpedantic
and others are enabled by default. That is, although -Wpedantic is only used
for pedwarns, the choice between using pedwarn or warning is independent of
-Wpedantic and only depends on the current -std= value. 

In my ideal world, -pedantic-errors would be a deprecated (but forever kept for
backwards compatibility) alias of some -Werror=X, where X is either pedantic or
a new -W option. However, the difference between pedwarn(), -Wpedantic and
-pedantic-errors is not very straightforward. You can try to follow the
discussion here: https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01799.html and
if you manage to make some sense out of it and come up with a course of action
(which option to add? what should it enable? what should be its relation with
Wpedantic and -pedantic-errors?) that convinces Joseph Myers, please add it to
PR53075 and I will eventually implement it.

Reply via email to