[Numpy-discussion] Toward a numpy build with warning: handling unused variable
Sun Aug 3 05:25:43 CDT 2008
I have recently tried various warning flags with numpy, and already discover
several potential errors in the C code. Now, because of the huge amount of warning
we get with e.g. -W -Wall, it would be nice to clean the code for this
kind of warning 'level' because we have a huge amount of garbage right now at this level.
One big proportion of warning with -W is the unused variable, which happens with the dummy/self variable in the
typical C functions.
I know of two ways to handle this:
- the simple: use the variable in some way, e.g. Add a (void)dummy;
in the function code. Problem: it is not really nice, and if later you
want to use the variable, it may hide other useful warnings, although I
am not sure about the later.
- more sophisticated way: using compiler specific handling (gcc
attribute) + mangling:
It is more complicated, is compiler specific, but it prevents accidental
use of the variable (thanks to the mangling). The compiler-specific is
not that much of a problem IMHO, since this is for warnings (and most of
use use gcc ?).
What do people think ? If nobody has anything against it, I will prepare a patch to support this.
More information about the Numpy-discussion