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: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Gerald Pfeifer <gerald at pfeifer dot com>
- Date: Fri, 17 Oct 2014 20:46:59 +0000
- 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>
On Fri, 17 Oct 2014, Manuel López-Ibáñez wrote:
> +Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
> +options, such as @option{-Wunused}, which may turn on further options,
> +such as @option{-Wunused-value}. The combined effect of positive and
> +negative forms is that more specific options have priority over less
> +specific ones, independently of their position in the command-line. For
> +options of the same specificity, the last one takes effect. Options
> +enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
> +as if they appeared at the end of the command-line.
This part is OK.
> @@ -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).
--
Joseph S. Myers
joseph@codesourcery.com