diff options
author | Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> | 2018-04-29 18:59:33 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-04-29 18:59:33 (GMT) |
commit | 55edd0c185ad2d895b5d73e47d67049bc156b654 (patch) | |
tree | d609dfc924b59b89816a610ba86cd3e6c34a641c /Modules/_threadmodule.c | |
parent | 9f3535c9cde8813ce631d6ebe4d790682f594828 (diff) | |
download | cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.zip cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.gz cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.bz2 |
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments. This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r-- | Modules/_threadmodule.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 43898d8..69e27be 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -163,7 +163,7 @@ and the return value reflects whether the lock is acquired.\n\ The blocking operation is interruptible."); static PyObject * -lock_PyThread_release_lock(lockobject *self) +lock_PyThread_release_lock(lockobject *self, PyObject *Py_UNUSED(ignored)) { /* Sanity check: the lock must be locked */ if (!self->locked) { @@ -185,7 +185,7 @@ the lock to acquire the lock. The lock must be in the locked state,\n\ but it needn't be locked by the same thread that unlocks it."); static PyObject * -lock_locked_lock(lockobject *self) +lock_locked_lock(lockobject *self, PyObject *Py_UNUSED(ignored)) { return PyBool_FromLong((long)self->locked); } @@ -333,7 +333,7 @@ internal counter is simply incremented. If nobody holds the lock,\n\ the lock is taken and its internal counter initialized to 1."); static PyObject * -rlock_release(rlockobject *self) +rlock_release(rlockobject *self, PyObject *Py_UNUSED(ignored)) { unsigned long tid = PyThread_get_thread_ident(); @@ -392,7 +392,7 @@ PyDoc_STRVAR(rlock_acquire_restore_doc, For internal use by `threading.Condition`."); static PyObject * -rlock_release_save(rlockobject *self) +rlock_release_save(rlockobject *self, PyObject *Py_UNUSED(ignored)) { unsigned long owner; unsigned long count; @@ -418,7 +418,7 @@ For internal use by `threading.Condition`."); static PyObject * -rlock_is_owned(rlockobject *self) +rlock_is_owned(rlockobject *self, PyObject *Py_UNUSED(ignored)) { unsigned long tid = PyThread_get_thread_ident(); @@ -1087,7 +1087,7 @@ when the function raises an unhandled exception; a stack trace will be\n\ printed unless the exception is SystemExit.\n"); static PyObject * -thread_PyThread_exit_thread(PyObject *self) +thread_PyThread_exit_thread(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyErr_SetNone(PyExc_SystemExit); return NULL; @@ -1101,7 +1101,7 @@ This is synonymous to ``raise SystemExit''. It will cause the current\n\ thread to exit silently unless the exception is caught."); static PyObject * -thread_PyThread_interrupt_main(PyObject * self) +thread_PyThread_interrupt_main(PyObject * self, PyObject *Py_UNUSED(ignored)) { PyErr_SetInterrupt(); Py_RETURN_NONE; @@ -1117,7 +1117,7 @@ A subthread can use this function to interrupt the main thread." static lockobject *newlockobject(void); static PyObject * -thread_PyThread_allocate_lock(PyObject *self) +thread_PyThread_allocate_lock(PyObject *self, PyObject *Py_UNUSED(ignored)) { return (PyObject *) newlockobject(); } @@ -1130,7 +1130,7 @@ Create a new lock object. See help(type(threading.Lock())) for\n\ information about locks."); static PyObject * -thread_get_ident(PyObject *self) +thread_get_ident(PyObject *self, PyObject *Py_UNUSED(ignored)) { unsigned long ident = PyThread_get_thread_ident(); if (ident == PYTHREAD_INVALID_THREAD_ID) { @@ -1152,7 +1152,7 @@ be relied upon, and the number should be seen purely as a magic cookie.\n\ A thread's identity may be reused for another thread after it exits."); static PyObject * -thread__count(PyObject *self) +thread__count(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyThreadState *tstate = PyThreadState_Get(); return PyLong_FromLong(tstate->interp->num_threads); @@ -1192,7 +1192,7 @@ release_sentinel(void *wr) } static PyObject * -thread__set_sentinel(PyObject *self) +thread__set_sentinel(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *wr; PyThreadState *tstate = PyThreadState_Get(); @@ -1289,23 +1289,23 @@ static PyMethodDef thread_methods[] = { METH_VARARGS, start_new_doc}, {"start_new", (PyCFunction)thread_PyThread_start_new_thread, METH_VARARGS, start_new_doc}, - {"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, + {"allocate_lock", thread_PyThread_allocate_lock, METH_NOARGS, allocate_doc}, - {"allocate", (PyCFunction)thread_PyThread_allocate_lock, + {"allocate", thread_PyThread_allocate_lock, METH_NOARGS, allocate_doc}, - {"exit_thread", (PyCFunction)thread_PyThread_exit_thread, + {"exit_thread", thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, - {"exit", (PyCFunction)thread_PyThread_exit_thread, + {"exit", thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, - {"interrupt_main", (PyCFunction)thread_PyThread_interrupt_main, + {"interrupt_main", thread_PyThread_interrupt_main, METH_NOARGS, interrupt_doc}, - {"get_ident", (PyCFunction)thread_get_ident, + {"get_ident", thread_get_ident, METH_NOARGS, get_ident_doc}, - {"_count", (PyCFunction)thread__count, + {"_count", thread__count, METH_NOARGS, _count_doc}, {"stack_size", (PyCFunction)thread_stack_size, METH_VARARGS, stack_size_doc}, - {"_set_sentinel", (PyCFunction)thread__set_sentinel, + {"_set_sentinel", thread__set_sentinel, METH_NOARGS, _set_sentinel_doc}, {NULL, NULL} /* sentinel */ }; |