This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR7651 Define -Wextra strictly in terms of other warning flags
- From: Ian Lance Taylor <iant at google dot com>
- To: Manuel LÃpez-Ib ÃÃez <lopezibanez at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: 15 Dec 2006 08:47:05 -0800
- Subject: Re: PR7651 Define -Wextra strictly in terms of other warning flags
- References: <6c33472e0612150430r6595072fu129b63512b903019@mail.gmail.com>
"Manuel LÃpez-IbÃÃez" <lopezibanez@gmail.com> writes:
> The following patch is a little step towards that goal. It adds a new
> option -Wempty-body that takes over the function of warning for an
> empty body occurring in an if or else statement. The new option is
> enabled by -Wextra, so we keep the current behaviour but add the
> ability to enable/disable this individual warning.
I think this is in general a good idea, although I can't approve the
patch.
> Index: gcc/doc/invoke.texi
> ===================================================================
> --- gcc/doc/invoke.texi (revision 119813)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -2916,7 +2916,8 @@ void foo(bar) @{ @}
> @end smallexample
>
> @item
> -An empty body occurs in an @samp{if} or @samp{else} statement.
> +An empty body occurs in an @samp{if} or @samp{else} statement. This
> +warning can be independently controlled by @option{-Wempty-body}.
I think you should make a separate entry in the list for -Wempty-body,
and then say that -Wextra turns it on. Ideally each warning should
have its own @item and @opindex in the full list of warnings.
Ian