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,6 +2195,9 @@ class CCodeWriter(object): ...@@ -2195,6 +2195,9 @@ class CCodeWriter(object):
method_flags += [method_coexist] method_flags += [method_coexist]
func_ptr = entry.func_cname func_ptr = entry.func_cname
# Add required casts, but try not to shadow real warnings. # Add required casts, but try not to shadow real warnings.
if 'METH_NOARGS' in method_flags:
cast = 'PyNoArgsFunction'
else:
cast = '__Pyx_PyCFunctionFast' if 'METH_FASTCALL' in method_flags else 'PyCFunction' cast = '__Pyx_PyCFunctionFast' if 'METH_FASTCALL' in method_flags else 'PyCFunction'
if 'METH_KEYWORDS' in method_flags: if 'METH_KEYWORDS' in method_flags:
cast += 'WithKeywords' cast += 'WithKeywords'
......
...@@ -259,6 +259,11 @@ __Pyx_async_gen_anext(PyObject *g) ...@@ -259,6 +259,11 @@ __Pyx_async_gen_anext(PyObject *g)
return __Pyx_async_gen_asend_new(o, NULL); 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 * static PyObject *
__Pyx_async_gen_asend(__pyx_PyAsyncGenObject *o, PyObject *arg) __Pyx_async_gen_asend(__pyx_PyAsyncGenObject *o, PyObject *arg)
...@@ -279,6 +284,7 @@ __Pyx_async_gen_aclose(__pyx_PyAsyncGenObject *o, CYTHON_UNUSED 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); return __Pyx_async_gen_athrow_new(o, NULL);
} }
static PyObject * static PyObject *
__Pyx_async_gen_athrow(__pyx_PyAsyncGenObject *o, PyObject *args) __Pyx_async_gen_athrow(__pyx_PyAsyncGenObject *o, PyObject *args)
{ {
...@@ -289,6 +295,12 @@ __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[] = { static PyGetSetDef __Pyx_async_gen_getsetlist[] = {
{(char*) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, {(char*) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
(char*) PyDoc_STR("name of the async generator"), 0}, (char*) PyDoc_STR("name of the async generator"), 0},
...@@ -328,8 +340,8 @@ static PyMethodDef __Pyx_async_gen_methods[] = { ...@@ -328,8 +340,8 @@ static PyMethodDef __Pyx_async_gen_methods[] = {
{"asend", (PyCFunction)__Pyx_async_gen_asend, METH_O, __Pyx_async_asend_doc}, {"asend", (PyCFunction)__Pyx_async_gen_asend, METH_O, __Pyx_async_asend_doc},
{"athrow",(PyCFunction)__Pyx_async_gen_athrow, METH_VARARGS, __Pyx_async_athrow_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}, {"aclose", (PyCFunction)__Pyx_async_gen_aclose, METH_NOARGS, __Pyx_async_aclose_doc},
{"__aiter__", (PyCFunction)PyObject_SelfIter, METH_NOARGS, __Pyx_async_aiter_doc}, {"__aiter__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_aiter_doc},
{"__anext__", (PyCFunction)__Pyx_async_gen_anext, METH_NOARGS, __Pyx_async_anext_doc}, {"__anext__", (PyCFunction)__Pyx_async_gen_anext_method, METH_NOARGS, __Pyx_async_anext_doc},
{0, 0, 0, 0} /* Sentinel */ {0, 0, 0, 0} /* Sentinel */
}; };
...@@ -563,7 +575,7 @@ static PyMethodDef __Pyx_async_gen_asend_methods[] = { ...@@ -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}, {"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}, {"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}, {"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 */ {0, 0, 0, 0} /* Sentinel */
}; };
...@@ -952,7 +964,7 @@ static PyMethodDef __Pyx_async_gen_athrow_methods[] = { ...@@ -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}, {"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}, {"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}, {"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 */ {0, 0, 0, 0} /* Sentinel */
}; };
......
...@@ -438,7 +438,7 @@ typedef struct { ...@@ -438,7 +438,7 @@ typedef struct {
PyObject *coroutine; PyObject *coroutine;
} __pyx_CoroutineAwaitObject; } __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*/ 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) { ...@@ -831,7 +831,7 @@ static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
return -1; return -1;
} else } else
if (__Pyx_CoroutineAwait_CheckExact(yf)) { if (__Pyx_CoroutineAwait_CheckExact(yf)) {
retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
if (!retval) if (!retval)
return -1; return -1;
} else } else
...@@ -905,6 +905,10 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) { ...@@ -905,6 +905,10 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) {
return __Pyx_Coroutine_SendEx(gen, Py_None, 0); 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) { static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
PyObject *retval, *raised_exception; PyObject *retval, *raised_exception;
...@@ -1362,7 +1366,7 @@ static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, Py ...@@ -1362,7 +1366,7 @@ static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, Py
return __Pyx_Coroutine_Throw(self->coroutine, args); 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); return __Pyx_Coroutine_Close(self->coroutine);
} }
...@@ -1488,7 +1492,7 @@ static PyMethodDef __pyx_Coroutine_methods[] = { ...@@ -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.")}, (char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")},
{"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, {"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.")}, (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.")}, (char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")},
#if PY_VERSION_HEX < 0x030500B1 #if PY_VERSION_HEX < 0x030500B1
{"__await__", (PyCFunction) __Pyx_Coroutine_await, METH_NOARGS, {"__await__", (PyCFunction) __Pyx_Coroutine_await, METH_NOARGS,
...@@ -1718,7 +1722,7 @@ static PyMethodDef __pyx_Generator_methods[] = { ...@@ -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.")}, (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
{"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, {"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.")}, (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.")}, (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
{0, 0, 0, 0} {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