[Cython] fixing refnanny macros to avoid GCC warnings

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Mon Feb 2 18:31:54 CET 2009


Lisandro Dalcin wrote:
> I'm now getting many warnings like below:
> 
> src/petsc4py_PETSc.c: In function '__pyx_f_8petsc4py_5PETSc_asarray':
> src/petsc4py_PETSc.c:3793: warning: value computed is not used
> 
> A possible fix, written following the way core Python Py_XDECREF,
> would be the following:
> 
> 
> diff -r 83075bb3a319 Cython/Compiler/ModuleNode.py
> --- a/Cython/Compiler/ModuleNode.py	Fri Jan 30 23:10:52 2009 +0100
> +++ b/Cython/Compiler/ModuleNode.py	Mon Feb 02 14:08:33 2009 -0300
> @@ -2334,7 +2334,7 @@
>  #define __Pyx_GOTREF(r) __Pyx_Refnanny_GOTREF(__pyx_refchk, r, __LINE__)
>  #define __Pyx_GIVEREF(r) __Pyx_Refnanny_GIVEREF(__pyx_refchk, r, __LINE__)
>  #define __Pyx_DECREF(r) __Pyx_Refnanny_DECREF(__pyx_refchk, r, __LINE__)
> -#define __Pyx_XDECREF(r) (r ? __Pyx_Refnanny_DECREF(__pyx_refchk, r,
> __LINE__) : 0)
> +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
...
> Can I push this?

Go ahead!

-- 
Dag Sverre


More information about the Cython-dev mailing list