This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/44478] -Wunused- but-set-variable is incredible noisy in kernel builds



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]