summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2021-04-26 16:16:47 +0200
committerStefan Behnel <stefan_ml@behnel.de>2021-04-26 16:16:47 +0200
commite98e24055293fbc6cc92332984939657b91f1df4 (patch)
tree5a99adad2a6b1a9b1b16007314d1515c396df9bd
parent4e45cc92ec4a7d6109c65908f2e47b80881a0f30 (diff)
downloadcython-e98e24055293fbc6cc92332984939657b91f1df4.tar.gz
Try to avoid C compiler warnings about unused utility functions.
-rw-r--r--Cython/Utility/ExtensionTypes.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/Cython/Utility/ExtensionTypes.c b/Cython/Utility/ExtensionTypes.c
index 6ecc7eda1..b0929d3ef 100644
--- a/Cython/Utility/ExtensionTypes.c
+++ b/Cython/Utility/ExtensionTypes.c
@@ -94,10 +94,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
/////////////// ValidateBasesTuple.proto ///////////////
+#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); /*proto*/
+#endif
/////////////// ValidateBasesTuple ///////////////
+#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
// Loop over all bases (except the first) and check that those
// really are heap types. Otherwise, it would not be safe to
@@ -147,29 +150,30 @@ static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffs
}
return 0;
}
+#endif
/////////////// PyType_Ready.proto ///////////////
-// FIXME: is this really suitable for CYTHON_COMPILING_IN_LIMITED_API?
-#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API
-#if !CYTHON_USE_TYPE_SPECS
static int __Pyx_PyType_Ready(PyTypeObject *t);/*proto*/
-#endif
-#else
-// avoid C warning about unused helper function
-#define __Pyx_PyType_Ready(t) ((void)__Pyx_PyObject_CallMethod0, (void)__Pyx_validate_bases_tuple, PyType_Ready(t))
-#endif
/////////////// PyType_Ready ///////////////
//@requires: ObjectHandling.c::PyObjectCallMethod0
//@requires: ValidateBasesTuple
-#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API
// Wrapper around PyType_Ready() with some runtime checks and fixes
// to deal with multiple inheritance.
-#if !CYTHON_USE_TYPE_SPECS
static int __Pyx_PyType_Ready(PyTypeObject *t) {
+
+// FIXME: is this really suitable for CYTHON_COMPILING_IN_LIMITED_API?
+#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API)
+ // avoid C warning about unused helper function
+ (void)__Pyx_PyObject_CallMethod0;
+ (void)__Pyx_validate_bases_tuple;
+
+ return PyType_Ready(t);
+
+#else
int r;
if (t->tp_bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, t->tp_bases) == -1))
return -1;
@@ -245,9 +249,8 @@ static int __Pyx_PyType_Ready(PyTypeObject *t) {
#endif
return r;
-}
-#endif
#endif
+}
/////////////// PyTrashcan.proto ///////////////