Cleanup: ignore GCC cast-function-type warning for PyMethodDef's

While these warnings point to real errors in the code,
PyMethodDef are an exception where functions with different numbers
of arguments are all cast to the same function type.
This commit is contained in:
Campbell Barton
2023-07-21 13:42:35 +10:00
parent 1153e9f69c
commit 0777c1861e
26 changed files with 316 additions and 14 deletions

View File

@@ -2749,6 +2749,11 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
/** \name Vector Type: Get/Set Item Definitions
* \{ */
#if (defined(__GNUC__) && !defined(__clang__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
static PyGetSetDef Vector_getseters[] = {
{"x", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_x_doc, (void *)0},
{"y", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_y_doc, (void *)1},
@@ -3233,12 +3238,21 @@ static PyGetSetDef Vector_getseters[] = {
{nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
};
#if (defined(__GNUC__) && !defined(__clang__))
# pragma GCC diagnostic pop
#endif
/** \} */
/* -------------------------------------------------------------------- */
/** \name Vector Type: Method Definitions
* \{ */
#if (defined(__GNUC__) && !defined(__clang__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
static PyMethodDef Vector_methods[] = {
/* Class Methods */
{"Fill", (PyCFunction)C_Vector_Fill, METH_VARARGS | METH_CLASS, C_Vector_Fill_doc},
@@ -3290,6 +3304,10 @@ static PyMethodDef Vector_methods[] = {
{nullptr, nullptr, 0, nullptr},
};
#if (defined(__GNUC__) && !defined(__clang__))
# pragma GCC diagnostic pop
#endif
/** \} */
/* -------------------------------------------------------------------- */