From: Mark Lodato Date: Tue, 6 Oct 2009 08:54:49 +0000 (-0700) Subject: fix -Wextra warning for empty `else' body X-Git-Tag: 0.13.beta0~2^2~121^2~102^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5d8d9abf4d3e7885739d83ca4a95a5f6cda4a68d;p=cython.git fix -Wextra warning for empty `else' body From faba5d52ae82239f522c108b51fa18dbb1ae9a8b Mon Sep 17 00:00:00 2001 Date: Mon, 5 Oct 2009 22:49:07 -0400 The macros XDECREF, XGIVEREF, and XGOTREF used ";" to denote an empty if and else body, but these raised the following warning when compiled with "gcc -Wall -Wextra": warning: suggest braces around empty body in an `else' statement --- Cython/Compiler/ModuleNode.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 5fc77ca5..0a396c40 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -2472,7 +2472,7 @@ static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; #define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) #define __Pyx_SetupRefcountContext(name) \ void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) #define __Pyx_FinishRefcountContext() \ @@ -2486,8 +2486,8 @@ static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; #define __Pyx_SetupRefcountContext(name) #define __Pyx_FinishRefcountContext() #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) -#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) """)