Commit 4417844f authored by Stefan Behnel's avatar Stefan Behnel

Fix function signature casts in PyMethodDef structs that lead to warnings in...

Fix function signature casts in PyMethodDef structs that lead to warnings in gcc-8 (and actually make use of the warnings in gcc-8).
parent 9564b99f
......@@ -2195,9 +2195,12 @@ class CCodeWriter(object):
method_flags += [method_coexist]
func_ptr = entry.func_cname
# Add required casts, but try not to shadow real warnings.
cast = '__Pyx_PyCFunctionFast' if 'METH_FASTCALL' in method_flags else 'PyCFunction'
if 'METH_KEYWORDS' in method_flags:
cast += 'WithKeywords'
if 'METH_NOARGS' in method_flags:
cast = 'PyNoArgsFunction'
else:
cast = '__Pyx_PyCFunctionFast' if 'METH_FASTCALL' in method_flags else 'PyCFunction'
if 'METH_KEYWORDS' in method_flags:
cast += 'WithKeywords'
if cast != 'PyCFunction':
func_ptr = '(void*)(%s)%s' % (cast, func_ptr)
self.putln(
......
......@@ -259,6 +259,11 @@ __Pyx_async_gen_anext(PyObject *g)
return __Pyx_async_gen_asend_new(o, NULL);
}
static PyObject *
__Pyx_async_gen_anext_method(PyObject *g, CYTHON_UNUSED PyObject *arg) {
return __Pyx_async_gen_anext(g);
}
static PyObject *
__Pyx_async_gen_asend(__pyx_PyAsyncGenObject *o, PyObject *arg)
......@@ -279,6 +284,7 @@ __Pyx_async_gen_aclose(__pyx_PyAsyncGenObject *o, CYTHON_UNUSED PyObject *arg)
return __Pyx_async_gen_athrow_new(o, NULL);
}
static PyObject *
__Pyx_async_gen_athrow(__pyx_PyAsyncGenObject *o, PyObject *args)
{
......@@ -289,6 +295,12 @@ __Pyx_async_gen_athrow(__pyx_PyAsyncGenObject *o, PyObject *args)
}
static PyObject *
__Pyx_async_gen_self_method(PyObject *g, CYTHON_UNUSED PyObject *arg) {
return __Pyx_NewRef(g);
}
static PyGetSetDef __Pyx_async_gen_getsetlist[] = {
{(char*) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
(char*) PyDoc_STR("name of the async generator"), 0},
......@@ -328,8 +340,8 @@ static PyMethodDef __Pyx_async_gen_methods[] = {
{"asend", (PyCFunction)__Pyx_async_gen_asend, METH_O, __Pyx_async_asend_doc},
{"athrow",(PyCFunction)__Pyx_async_gen_athrow, METH_VARARGS, __Pyx_async_athrow_doc},
{"aclose", (PyCFunction)__Pyx_async_gen_aclose, METH_NOARGS, __Pyx_async_aclose_doc},
{"__aiter__", (PyCFunction)PyObject_SelfIter, METH_NOARGS, __Pyx_async_aiter_doc},
{"__anext__", (PyCFunction)__Pyx_async_gen_anext, METH_NOARGS, __Pyx_async_anext_doc},
{"__aiter__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_aiter_doc},
{"__anext__", (PyCFunction)__Pyx_async_gen_anext_method, METH_NOARGS, __Pyx_async_anext_doc},
{0, 0, 0, 0} /* Sentinel */
};
......@@ -563,7 +575,7 @@ static PyMethodDef __Pyx_async_gen_asend_methods[] = {
{"send", (PyCFunction)__Pyx_async_gen_asend_send, METH_O, __Pyx_async_gen_send_doc},
{"throw", (PyCFunction)__Pyx_async_gen_asend_throw, METH_VARARGS, __Pyx_async_gen_throw_doc},
{"close", (PyCFunction)__Pyx_async_gen_asend_close, METH_NOARGS, __Pyx_async_gen_close_doc},
{"__await__", (PyCFunction)PyObject_SelfIter, METH_NOARGS, __Pyx_async_gen_await_doc},
{"__await__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_gen_await_doc},
{0, 0, 0, 0} /* Sentinel */
};
......@@ -952,7 +964,7 @@ static PyMethodDef __Pyx_async_gen_athrow_methods[] = {
{"send", (PyCFunction)__Pyx_async_gen_athrow_send, METH_O, __Pyx_async_gen_send_doc},
{"throw", (PyCFunction)__Pyx_async_gen_athrow_throw, METH_VARARGS, __Pyx_async_gen_throw_doc},
{"close", (PyCFunction)__Pyx_async_gen_athrow_close, METH_NOARGS, __Pyx_async_gen_close_doc},
{"__await__", (PyCFunction)PyObject_SelfIter, METH_NOARGS, __Pyx_async_gen_await_doc},
{"__await__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_gen_await_doc},
{0, 0, 0, 0} /* Sentinel */
};
......
......@@ -438,7 +438,7 @@ typedef struct {
PyObject *coroutine;
} __pyx_CoroutineAwaitObject;
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self); /*proto*/
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg); /*proto*/
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args); /*proto*/
......@@ -831,7 +831,7 @@ static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
return -1;
} else
if (__Pyx_CoroutineAwait_CheckExact(yf)) {
retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
if (!retval)
return -1;
} else
......@@ -905,6 +905,10 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) {
return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
PyObject *retval, *raised_exception;
......@@ -1362,7 +1366,7 @@ static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, Py
return __Pyx_Coroutine_Throw(self->coroutine, args);
}
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self) {
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, CYTHON_UNUSED PyObject *arg) {
return __Pyx_Coroutine_Close(self->coroutine);
}
......@@ -1488,7 +1492,7 @@ static PyMethodDef __pyx_Coroutine_methods[] = {
(char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
{"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
(char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")},
{"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
{"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
(char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
#if PY_VERSION_HEX < 0x030500B1
{"__await__", (PyCFunction) __Pyx_Coroutine_await, METH_NOARGS,
......@@ -1718,7 +1722,7 @@ static PyMethodDef __pyx_Generator_methods[] = {
(char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
{"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
(char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
{"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
{"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
(char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
{0, 0, 0, 0}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment