From d730a00d4c82c7402d27700965482b9eba426103 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 31 Dec 2013 11:19:00 +0100 Subject: [PATCH] fix C compiler warnings about unused utility code --- Cython/Compiler/Nodes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index f76f872..810542d 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -6577,11 +6577,13 @@ class TryFinallyStatNode(StatNode): if self.is_try_finally_in_nogil: code.put_ensure_gil(declare_gilstate=False) - code.putln("#if PY_MAJOR_VERSION >= 3") + # not using preprocessor here to avoid warnings about + # unused utility functions and/or temps + code.putln("if (PY_MAJOR_VERSION >= 3) {") for var in exc_vars[3:]: code.put_xgiveref(var) code.putln("__Pyx_ExceptionReset(%s, %s, %s);" % exc_vars[3:]) - code.putln("#endif") + code.putln("}") for var in exc_vars[:3]: code.put_xgiveref(var) code.putln("__Pyx_ErrRestore(%s, %s, %s);" % exc_vars[:3]) @@ -6600,11 +6602,13 @@ class TryFinallyStatNode(StatNode): code.globalstate.use_utility_code(reset_exception_utility_code) if self.is_try_finally_in_nogil: code.put_ensure_gil(declare_gilstate=False) - code.putln("#if PY_MAJOR_VERSION >= 3") + # not using preprocessor here to avoid warnings about + # unused utility functions and/or temps + code.putln("if (PY_MAJOR_VERSION >= 3) {") for var in exc_vars[3:]: code.put_xgiveref(var) code.putln("__Pyx_ExceptionReset(%s, %s, %s);" % exc_vars[3:]) - code.putln("#endif") + code.putln("}") for var in exc_vars[:3]: code.put_xdecref_clear(var, py_object_type) if self.is_try_finally_in_nogil: -- 2.7.4