This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC PATCH] Add set but not used warning support for the C FE (PR c/18624)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: d binderman <dcb314 at hotmail dot com>
- Cc: rguenther at suse dot de, gcc-patches at gcc dot gnu dot org, joseph at codesourcery dot com
- Date: Wed, 25 Nov 2009 11:09:40 -0500
- Subject: Re: [RFC PATCH] Add set but not used warning support for the C FE (PR c/18624)
- References: <BLU108-W2215C687687B113F60C4439C9C0@phx.gbl>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 25, 2009 at 10:44:56AM +0000, d binderman wrote:
> >attached is a list of these warnings during bootstrap
>
> There are over 400 of them. It looks to me like all of these need fixing,
> to get this patch into the mainstream bootstrap. That's quite a lot of work.
True, but e.g. many of them are solvable in just one spot (e.g. all
_operandN unused in insn-emit.c is one fix, etc.), and some aren't in files
compiled with -Werror (e.g. libbid, soft-fp).
> >I wonder whether we want to control this warning with a separate -Wunused-* switch
>
> If you invent a new name, then folks initially won't use it.
Having a separate option to control it has the advantage that it can be
separately turned off or on. It could certainly be included in -Wunused,
like -Wunused-variables and -Wunused-parameters is (-Wunused-set-variables
and -Wunused-set-parameters ??).
> >If anyone has suggestions what else should be tested in
> >the testsuite of this warning
>
> How about this one
>
> static int fred;
>
> void
> f()
> {
> fred = 1;
> }
> /*no more uses of fred */
>
> where file static data is set but not used, might also be worth a warning,
> even if only with -Os.
This would need to wait until all FEs set the flag, because the checking
would need to be performed again in generic code.
Jakub