This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Switch -Wunused-variable on?
>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
Jan> IIRC the counterargument for -Wunused-variable was that GDB
Jan> contains various #if-compiled code where is a nightmare to get the
Jan> code right with matching #if-clauses also for the variables being
Jan> used by various #if-compiled code chunks. I could not find that
Jan> mail now in the time I gave to it.
Sergio> Yes, this is a counter-argument, and I was also thinking about it. I
Sergio> don't know how people prefer to deal with this issue, but something
Sergio> like:
Sergio> #define USED_VAR(var) ((void) var)
Sergio> Would be OK?
That sort of thing obscures whether the variable later dies.
I'd say that the best approach would be to make the declarations
conditional in the same way that the uses are.
If there are a lot of problem cases with this approach, or if it makes
the code too ugly, then maybe it would be better just not to use this
flag.
Tom