This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH doc] Explain options precedence and difference between -pedantic-errors and -Werror=pedantic
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 18 Oct 2014 01:31:44 +0200
- Subject: Re: [PATCH doc] Explain options precedence and difference between -pedantic-errors and -Werror=pedantic
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQBi5c6KCnyB3iR7OR_xHxsoe0tie2d-bP3xjuX6y273dg at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1410172043260 dot 14369 at digraph dot polyomino dot org dot uk>
On 17 October 2014 22:46, Joseph S. Myers <joseph@codesourcery.com> wrote:
>> @@ -3318,8 +3327,8 @@
>>
>> @item -pedantic-errors
>> @opindex pedantic-errors
>> -Like @option{-Wpedantic}, except that errors are produced rather than
>> -warnings.
>> +This is equivalent to @option{-Werror=pedantic} plus making into errors
>> +a few warnings that are not controlled by @option{-Wpedantic}.
>
> But I think the previous version is better here. Maybe at present your
> version is true, but in principle -Wpedantic can control warnings that
> aren't pedwarns. Some of the -Wformat warnings are conditional on having
> both -Wformat and -Wpedantic enabled - we can only represent those using
> OPT_Wformat in the warning calls at present, but there's at least as case
> for -Werror=pedantic to turn them into errors (while -pedantic-errors
> definitely should not turn them into errors, as the code is only invalid
> at runtime and is valid at compile time as long as it never gets
> executed).
The previous version also does not match your description. You are saying that
-Wpedantic = warning(OPT_Wpedantic) + pedwarn(OPT_Wpedantic)
and -pedantic-errors = pedwarn(OPT_Wpedantic).+ pedwarn(0)
The current version says that
-Wpedantic = warning(OPT_Wpedantic) + pedwarn(OPT_Wpedantic)
and -pedantic-errors = warning(OPT_Wpedantic) + pedwarn(OPT_Wpedantic)
My proposal says that:
-Wpedantic = warning(OPT_Wpedantic) + pedwarn(OPT_Wpedantic)
and -pedantic-errors = warning(OPT_Wpedantic) + pedwarn(OPT_Wpedantic)
+ pedwarn(0)
which perhaps is not how it should be, but it is strictly more correct
in the sense that it is wrong in exactly the same thing but it is
right in one more than the current version.
Cheers,
Manuel.