This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
A strange gcc behavior, and an argument against -Wno-unused
- From: Michael Snyder <msnyder at vmware dot com>
- To: gdb at sourceware dot org
- Date: Fri, 09 Oct 2009 17:43:35 -0700
- Subject: A strange gcc behavior, and an argument against -Wno-unused
Hey all,
We have "-Wno-unused" in our Makefile.in, as a result of which
we have accumulated a huge pool of unused variables, which
probably get optimized away and so don't hurt anything, but
which clutter up the code.
I was playing around with the idea of cleaning them up, and
so I removed the "-Wno-unused" from the makefile.
But the first thing that happened was that my compile failed
with the following warning (which of course was treated as an
error, because we also have -Werror):
i386-tdep.c:4149: warning: statement with no effect
Now here's the line in question, from i386_process_record:
ir.rm != ir.rex_b;
From context and other examples, I'm pretty sure that this
is a typo, and was meant to read "|=", not "!=". No sweat,
I'll fix it, or submit it for review anyway.
BUT! The fact that this escaped being detected by the compiler
bothers me a lot! I don't know whether to think of it as a
compiler bug, or to reason "well, we said "don't warn us about
things that are unused, and this is basically an unused
statement".
So, for discussion, should we remove -Wno-unused?
Michael