summaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-11-28 15:34:42 +0100
committerArmin Rigo <arigo@tunes.org>2020-11-28 15:34:42 +0100
commitaf10fd9a35440297b586a006b9ab9fbaade4d68f (patch)
tree7858018f3b803e4d627ba2fe5c9fab978543049b /c
parentcfc8d5f8eb4ba4b1d197eb1f3c19293f5a0db313 (diff)
downloadcffi-af10fd9a35440297b586a006b9ab9fbaade4d68f.tar.gz
gcc-4.4.7: this pragma must not be inside functions
Diffstat (limited to 'c')
-rw-r--r--c/_cffi_backend.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
index 1c2ca2d..a40ee34 100644
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -6268,6 +6268,17 @@ static PyObject *prepare_callback_info_tuple(CTypeDescrObject *ct,
return infotuple;
}
+/* messily try to silence a gcc/clang deprecation warning for
+ ffi_prep_closure. Don't miss the "pragma pop" after the function.
+ This is done around the whole function because very old GCCs don't
+ support it inside a function. */
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
static PyObject *b_callback(PyObject *self, PyObject *args)
{
CTypeDescrObject *ct;
@@ -6336,21 +6347,8 @@ static PyObject *b_callback(PyObject *self, PyObject *args)
PyErr_Format(PyExc_SystemError, "ffi_prep_closure_loc() is missing");
goto error;
#else
-/* messily try to silence a gcc/clang deprecation warning here */
-# if defined(__clang__)
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wdeprecated-declarations"
-# elif defined(__GNUC__)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-# endif
status = ffi_prep_closure(closure, &cif_descr->cif,
invoke_callback, infotuple);
-# if defined(__clang__)
-# pragma clang diagnostic pop
-# elif defined(__GNUC__)
-# pragma GCC diagnostic pop
-# endif
#endif
}
@@ -6393,6 +6391,11 @@ static PyObject *b_callback(PyObject *self, PyObject *args)
Py_XDECREF(infotuple);
return NULL;
}
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#elif defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
static PyObject *b_new_enum_type(PyObject *self, PyObject *args)
{