[Numpy-discussion] Toward a numpy build with warning: handling unused variable

Charles R Harris charlesr.harris@gmail....
Sun Aug 3 10:35:46 CDT 2008

On Sun, Aug 3, 2008 at 5:25 AM, David Cournapeau <
david@ar.media.kyoto-u.ac.jp> wrote:

> Hi,
>    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:
> http://sourcefrog.net/weblog/software/languages/C/unused.html
> 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...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080803/7bd0ff6c/attachment-0001.html 

More information about the Numpy-discussion mailing list