Some background discussion in PR 44774 and http://gcc.gnu.org/ml/gcc-patches/2012-04/msg01324.html A currently visible effect is that $ cc1 ~/trunk/src/gcc/testsuite/gcc.dg/c90-init-1.c -pedantic-errors prints -Wpedantic while $ cc1 ~/trunk/src/gcc/testsuite/gcc.dg/c90-init-1.c -Werror=pedantic prints -Werror=pedantic (as it should).
More discussion in the topic: https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01799.html
Confirmed.
(In reply to Manuel López-Ibáñez from comment #0) > Some background discussion in PR 44774 and > http://gcc.gnu.org/ml/gcc-patches/2012-04/msg01324.html bug 53072 came up under that discussion; adding it under "See Also" here > > A currently visible effect is that > > $ cc1 ~/trunk/src/gcc/testsuite/gcc.dg/c90-init-1.c -pedantic-errors > > prints -Wpedantic while > > $ cc1 ~/trunk/src/gcc/testsuite/gcc.dg/c90-init-1.c -Werror=pedantic > > prints -Werror=pedantic (as it should).
This patch resolves this. diff --git a/gcc/opts.c b/gcc/opts.c index 1417dba..2e71fef 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -3212,7 +3212,7 @@ option_name (diagnostic_context *context, int option_index, if (option_index) { /* A warning classified as an error. */ - if ((orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN) + if ((context->pedantic_errors || orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN) && diag_kind == DK_ERROR) return concat (cl_options[OPT_Werror_].opt_text, /* Skip over "-W". */
(In reply to Kamlesh Kumar from comment #4) > This patch resolves this. No, it doesn't. As the documentation says: -pedantic-errors is not equivalent to @option{-Werror=pedantic}, since there are errors enabled by this option and not enabled by the latter and vice versa. According to the discussion in the email threads above, it is not possible to make them equivalent, one would need to create a new options for everything that is in the disjoint set of -pedantic-errors and -Werror=pedantic (but there may be some bugs worth fixing there to reduce this set). In any case, patches are sent to gcc-patches: https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps