This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/44478] -Wunused- but-set-variable is incredible noisy in kernel builds
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2010 09:53:58 -0000
- Subject: [Bug c/44478] -Wunused- but-set-variable is incredible noisy in kernel builds
- References: <bug-44478-7834@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from jakub at gcc dot gnu dot org 2010-06-09 09:53 -------
The warning is useful and can find (and already found) several real bugs e.g.
in gcc itself. Icc has similar warning.
If kernel has lots of useless code like that and doesn't wish to use this
warning, it can add -Wno-unused-but-set-{variable,parameter} to CFLAGS it uses.
Note that in the snippet you mentioned -Wunused would warn always, no matter
whether SYMBOL is defined or not. When it is not defined, var is unused (also
warned with 4.5 and earlier), when it is defined, var is only set but never
used.
I guess what you really mean is that kernel has lots of snippets that set some
variable to some value and then only conditionally (in #ifdef guarded code)
uses it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44478