Add GCC pragmas to silence compiler warning about ffi_prep_closure (GH-23327) (GH-23590)

(cherry picked from commit cce3f0b0c8)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-12-01 07:07:50 -08:00 committed by GitHub
parent 4a44f53aa8
commit ae48dd4db5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -426,15 +426,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
}