summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-11-16 23:59:55 (GMT)
committerGitHub <noreply@github.com>2020-11-16 23:59:55 (GMT)
commitcce3f0b0c88eba98bc11abe703a444bee7880ff8 (patch)
treec17677c90aa451325853294e7a84102d0a1b8935
parent9cc9e277254023c0ca08e1a9e379fd89475ca9c2 (diff)
downloadcpython-cce3f0b0c88eba98bc11abe703a444bee7880ff8.zip
cpython-cce3f0b0c88eba98bc11abe703a444bee7880ff8.tar.gz
cpython-cce3f0b0c88eba98bc11abe703a444bee7880ff8.tar.bz2
Add GCC pragmas to silence compiler warning about ffi_prep_closure (GH-23327)
-rw-r--r--Modules/_ctypes/callbacks.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 3686287..654cb93 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -427,15 +427,22 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing");
goto error;
#else
-#ifdef MACOSX
+#if defined(__clang__) || defined(MACOSX)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
+#if defined(__GNUC__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p);
-#ifdef MACOSX
+#if defined(__clang__) || defined(MACOSX)
#pragma clang diagnostic pop
#endif
+#if defined(__GNUC__)
+ #pragma GCC diagnostic pop
+#endif
#endif
}