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)
 #define __Pyx_SetupRefcountContext(name) \
   void* __pyx_refchk = __Pyx_Refnanny_NewContext(name, __LINE__)
 #define __Pyx_FinishRefcountContext()
__Pyx_Refnanny_FinishContext(__pyx_refchk)
@@ -2347,6 +2347,6 @@
 #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)
 """)


Can I push this?

Other possible way would be to use "do { ... } while(0)" blocks, I
prefer them much more, but that is not a common pattern in Python C
source code.




-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to