Skip to content

Commit ba14f05

Browse files
Anselm Kruisakruis
authored andcommitted
Stackless issue python#265: Fix invalid function cast warnings
Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
1 parent cd48a58 commit ba14f05

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

Stackless/changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ What's New in Stackless 3.X.X?
99

1010
*Release date: 20XX-XX-XX*
1111

12+
- https://github.com/stackless-dev/stackless/issues/265
13+
Fix invalid function cast warnings with gcc 8 for method conventions
14+
different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic
15+
generated code.
16+
1217
- https://github.com/stackless-dev/stackless/issues/265
1318
Most (getter)-functions, (setter)-functions and (PyCFunction)-functions with
1419
flag METH_NOARGS used to lack an unused last argument, "void *" for (getter)

Stackless/module/_teststackless.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,11 @@ static PyObject* test_PyEval_EvalFrameEx(PyObject *self, PyObject *args, PyObjec
494494
static PyMethodDef _teststackless_methods[] = {
495495
{"softswitchablefunc", _teststackless_softswitchabledemo, METH_VARARGS | METH_STACKLESS,
496496
_teststackless_softswitchabledemo_doc},
497-
{ "test_cframe", (PyCFunction) test_cframe, METH_VARARGS | METH_KEYWORDS,
497+
{ "test_cframe", (PyCFunction)(void(*)(void))test_cframe, METH_VARARGS | METH_KEYWORDS,
498498
test_cframe__doc__ },
499499
{ "test_cstate", (PyCFunction) test_cstate, METH_O,
500500
test_cstate__doc__ },
501-
{ "test_PyEval_EvalFrameEx", (PyCFunction) test_PyEval_EvalFrameEx, METH_VARARGS | METH_KEYWORDS,
501+
{ "test_PyEval_EvalFrameEx", (PyCFunction)(void(*)(void))test_PyEval_EvalFrameEx, METH_VARARGS | METH_KEYWORDS,
502502
test_PyEval_EvalFrameEx__doc__ },
503503
{NULL, NULL} /* sentinel */
504504
};

Stackless/module/stacklessmodule.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ schedule_remove(PyObject *self, PyObject *args, PyObject *kwds);
227227
static PyObject *
228228
PyStackless_Schedule_M(PyObject *retval, int remove)
229229
{
230-
PyMethodDef sched = {"schedule", (PyCFunction)schedule, METH_VARARGS|METH_KEYWORDS};
231-
PyMethodDef s_rem = {"schedule", (PyCFunction)schedule_remove, METH_VARARGS|METH_KEYWORDS};
230+
PyMethodDef sched = {"schedule", (PyCFunction)(void(*)(void))schedule, METH_VARARGS|METH_KEYWORDS};
231+
PyMethodDef s_rem = {"schedule", (PyCFunction)(void(*)(void))schedule_remove, METH_VARARGS|METH_KEYWORDS};
232232
if (remove)
233233
return PyStackless_CallCMethod_Main(&s_rem, NULL, "O", retval);
234234
else
@@ -510,7 +510,7 @@ run_watchdog(PyObject *self, PyObject *args, PyObject *kwds);
510510
static PyObject *
511511
PyStackless_RunWatchdog_M(long timeout, long flags)
512512
{
513-
PyMethodDef def = {"run", (PyCFunction)run_watchdog, METH_VARARGS | METH_KEYWORDS};
513+
PyMethodDef def = {"run", (PyCFunction)(void(*)(void))run_watchdog, METH_VARARGS | METH_KEYWORDS};
514514
int threadblock, soft, ignore_nesting, totaltimeout;
515515
threadblock = (flags & Py_WATCHDOG_THREADBLOCK) ? 1 : 0;
516516
soft = (flags & PY_WATCHDOG_SOFT) ? 1 : 0;
@@ -1663,11 +1663,11 @@ PyDoc_STRVAR(slpmodule_getthreads__doc__,
16631663
static PyMethodDef stackless_methods[] = {
16641664
_STACKLESS_PICKLE_FLAGS_DEFAULT_METHODDEF
16651665
_STACKLESS_PICKLE_FLAGS_METHODDEF
1666-
{"schedule", (PCF)schedule, METH_KS,
1666+
{"schedule", (PCF)(void(*)(void))schedule, METH_KS,
16671667
schedule__doc__},
1668-
{"schedule_remove", (PCF)schedule_remove, METH_KS,
1668+
{"schedule_remove", (PCF)(void(*)(void))schedule_remove, METH_KS,
16691669
schedule__doc__},
1670-
{"run", (PCF)run_watchdog, METH_VARARGS | METH_KEYWORDS,
1670+
{"run", (PCF)(void(*)(void))run_watchdog, METH_VARARGS | METH_KEYWORDS,
16711671
run_watchdog__doc__},
16721672
{"getruncount", (PCF)getruncount, METH_NOARGS,
16731673
getruncount__doc__},
@@ -1679,9 +1679,9 @@ static PyMethodDef stackless_methods[] = {
16791679
getmain__doc__},
16801680
{"enable_softswitch", (PCF)enable_softswitch, METH_O,
16811681
enable_soft__doc__},
1682-
{"_test_cframe_nr", (PCF)_test_cframe_nr, METH_VARARGS | METH_KEYWORDS,
1682+
{"_test_cframe_nr", (PCF)(void(*)(void))_test_cframe_nr, METH_VARARGS | METH_KEYWORDS,
16831683
_test_cframe_nr__doc__},
1684-
{"_test_outside", (PCF)_test_outside, METH_NOARGS,
1684+
{"_test_outside", (PCF)_test_outside, METH_NOARGS,
16851685
_test_outside__doc__},
16861686
{"set_channel_callback", (PCF)set_channel_callback, METH_O,
16871687
set_channel_callback__doc__},

Stackless/module/taskletobject.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ static PyObject *
14141414
PyTasklet_Throw_M(PyTaskletObject *self, int pending, PyObject *exc,
14151415
PyObject *val, PyObject *tb)
14161416
{
1417-
PyMethodDef def = {"throw", (PyCFunction)tasklet_throw, METH_VARARGS|METH_KEYWORDS};
1417+
PyMethodDef def = {"throw", (PyCFunction)(void(*)(void))tasklet_throw, METH_VARARGS|METH_KEYWORDS};
14181418
if (!val)
14191419
val = Py_None;
14201420
if (!tb)
@@ -2574,15 +2574,15 @@ static PyMethodDef tasklet_methods[] = {
25742574
tasklet_set_atomic__doc__},
25752575
{"set_ignore_nesting", (PCF)tasklet_set_ignore_nesting, METH_O,
25762576
tasklet_set_ignore_nesting__doc__},
2577-
{"throw", (PCF)tasklet_throw, METH_KS,
2577+
{"throw", (PCF)(void(*)(void))tasklet_throw, METH_KS,
25782578
tasklet_throw__doc__},
2579-
{"raise_exception", (PCF)tasklet_raise_exception, METH_VS,
2579+
{"raise_exception", (PCF)tasklet_raise_exception, METH_VS,
25802580
tasklet_raise_exception__doc__},
2581-
{"kill", (PCF)tasklet_kill, METH_KS,
2581+
{"kill", (PCF)(void(*)(void))tasklet_kill, METH_KS,
25822582
tasklet_kill__doc__},
2583-
{"bind", (PCF)tasklet_bind, METH_VARARGS | METH_KEYWORDS,
2583+
{"bind", (PCF)(void(*)(void))tasklet_bind, METH_VARARGS | METH_KEYWORDS,
25842584
tasklet_bind__doc__},
2585-
{"setup", (PCF)tasklet_setup, METH_VARARGS | METH_KEYWORDS,
2585+
{"setup", (PCF)(void(*)(void))tasklet_setup, METH_VARARGS | METH_KEYWORDS,
25862586
tasklet_setup__doc__},
25872587
{"__reduce__", (PCF)tasklet_reduce, METH_NOARGS,
25882588
tasklet_reduce__doc__},
@@ -2592,7 +2592,7 @@ static PyMethodDef tasklet_methods[] = {
25922592
tasklet_setstate__doc__},
25932593
{"bind_thread", (PCF)tasklet_bind_thread, METH_VARARGS,
25942594
tasklet_bind_thread__doc__},
2595-
{"context_run", (PCF)tasklet_context_run, METH_FASTCALL | METH_KEYWORDS | METH_STACKLESS,
2595+
{"context_run", (PCF)(void(*)(void))tasklet_context_run, METH_FASTCALL | METH_KEYWORDS | METH_STACKLESS,
25962596
tasklet_context_run__doc__},
25972597
_STACKLESS_TASKLET_SET_CONTEXT_METHODDEF
25982598
{NULL, NULL} /* sentinel */

Stackless/pickling/prickelpit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ _wrap_clear(PyObject *ob)
144144
static PyMethodDef prefix##_methods[] = { \
145145
{"__reduce__", (PyCFunction)reduce, METH_NOARGS, NULL}, \
146146
{"__setstate__", (PyCFunction)setstate, METH_O, NULL}, \
147-
{"__new__", (PyCFunction)_new_wrapper, METH_VARARGS | METH_KEYWORDS, \
147+
{"__new__", (PyCFunction)(void(*)(void))_new_wrapper, METH_VARARGS | METH_KEYWORDS, \
148148
PyDoc_STR("wwwwwaaaaaT.__new__(S, ...) -> " \
149149
"a new object with type S, a subtype of T")}, \
150150
{NULL, NULL} \
@@ -289,7 +289,7 @@ unwrap_frame_arg(PyObject * args) {
289289
}
290290

291291
static struct PyMethodDef _new_methoddef[] = {
292-
{"__new__", (PyCFunction)_new_wrapper, METH_VARARGS | METH_KEYWORDS,
292+
{"__new__", (PyCFunction)(void(*)(void))_new_wrapper, METH_VARARGS | METH_KEYWORDS,
293293
PyDoc_STR("T.__new__(S, ...) -> "
294294
"a new object with type S, a subtype of T.__base__")},
295295
{0}

0 commit comments

Comments
 (0)