[Cython] fixing refnanny macros to avoid GCC warnings
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
<at> <at> -2334,7 +2334,7 <at> <at>
#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)
#define __Pyx_SetupRefcountContext(name) \
void* __pyx_refchk = __Pyx_Refnanny_NewContext(name, __LINE__)
#define __Pyx_FinishRefcountContext()
__Pyx_Refnanny_FinishContext(__pyx_refchk)
<at> <at> -2347,6 +2347,6 <at> <at>
#define __Pyx_SetupRefcountContext(name)
#define __Pyx_FinishRefcountContext() 0
#endif /* CYTHON_REFNANNY */
-#define __Pyx_XGIVEREF(r) (r ? __Pyx_GIVEREF(r) : 0)
-#define __Pyx_XGOTREF(r) (r ? __Pyx_GOTREF(r) : 0)
+#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
+#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
(Continue reading)