[Numpy-discussion] Toward a numpy build with warning: handling unused variable
Charles R Harris
Sun Aug 3 10:35:46 CDT 2008
On Sun, Aug 3, 2008 at 5:25 AM, David Cournapeau <
> I have recently tried various warning flags with numpy, and already
> several potential errors in the C code. Now, because of the huge amount of
> 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.
I say leave these warnings alone. If nothing else, they point to possible
cleanups in some future refactoring.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion