summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-11-27 11:27:31 (GMT)
committerGitHub <noreply@github.com>2018-11-27 11:27:31 (GMT)
commit62be74290aca26d16f3f55ece7ff6dad14e60e8d (patch)
tree656625bee7ca61fd87c6370407162522d8fb277f /Objects
parent81524022d0c0df7a41f9b2b2df41e2ebe140e610 (diff)
downloadcpython-62be74290aca26d16f3f55ece7ff6dad14e60e8d.zip
cpython-62be74290aca26d16f3f55ece7ff6dad14e60e8d.tar.gz
cpython-62be74290aca26d16f3f55ece7ff6dad14e60e8d.tar.bz2
bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/call.c14
-rw-r--r--Objects/dictobject.c18
-rw-r--r--Objects/memoryobject.c2
-rw-r--r--Objects/odictobject.c4
-rw-r--r--Objects/typeobject.c6
-rw-r--r--Objects/unicodeobject.c2
6 files changed, 23 insertions, 23 deletions
diff --git a/Objects/call.c b/Objects/call.c
index ba2ddcb..be8e90d 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -514,7 +514,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
}
if (flags & METH_KEYWORDS) {
- result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs);
+ result = (*(PyCFunctionWithKeywords)(void(*)(void))meth) (self, argstuple, kwargs);
}
else {
result = (*meth) (self, argstuple);
@@ -529,7 +529,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
goto no_keyword_error;
}
- result = (*(_PyCFunctionFast)meth) (self, args, nargs);
+ result = (*(_PyCFunctionFast)(void(*)(void))meth) (self, args, nargs);
break;
}
@@ -537,7 +537,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
{
PyObject *const *stack;
PyObject *kwnames;
- _PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)meth;
+ _PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)(void(*)(void))meth;
if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) {
goto exit;
@@ -650,12 +650,12 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
if (nkwargs) {
goto no_keyword_error;
}
- result = ((_PyCFunctionFast)meth) (self, args, nargs);
+ result = ((_PyCFunctionFast)(void(*)(void))meth) (self, args, nargs);
break;
case METH_FASTCALL | METH_KEYWORDS:
/* Fast-path: avoid temporary dict to pass keyword arguments */
- result = ((_PyCFunctionFastWithKeywords)meth) (self, args, nargs, kwnames);
+ result = ((_PyCFunctionFastWithKeywords)(void(*)(void))meth) (self, args, nargs, kwnames);
break;
case METH_VARARGS:
@@ -689,7 +689,7 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
kwdict = NULL;
}
- result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict);
+ result = (*(PyCFunctionWithKeywords)(void(*)(void))meth) (self, argtuple, kwdict);
Py_XDECREF(kwdict);
}
else {
@@ -752,7 +752,7 @@ cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs)
return NULL;
}
- result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs);
+ result = (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, args, kwargs);
Py_LeaveRecursiveCall();
}
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 2f108bd..72cb4c5 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -3095,15 +3095,15 @@ PyDoc_STRVAR(values__doc__,
static PyMethodDef mapp_methods[] = {
DICT___CONTAINS___METHODDEF
- {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST,
+ {"__getitem__", (PyCFunction)(void(*)(void))dict_subscript, METH_O | METH_COEXIST,
getitem__doc__},
- {"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS,
+ {"__sizeof__", (PyCFunction)(void(*)(void))dict_sizeof, METH_NOARGS,
sizeof__doc__},
DICT_GET_METHODDEF
DICT_SETDEFAULT_METHODDEF
{"pop", (PyCFunction)dict_pop, METH_VARARGS,
pop__doc__},
- {"popitem", (PyCFunction)dict_popitem, METH_NOARGS,
+ {"popitem", (PyCFunction)(void(*)(void))dict_popitem, METH_NOARGS,
popitem__doc__},
{"keys", dictkeys_new, METH_NOARGS,
keys__doc__},
@@ -3111,7 +3111,7 @@ static PyMethodDef mapp_methods[] = {
items__doc__},
{"values", dictvalues_new, METH_NOARGS,
values__doc__},
- {"update", (PyCFunction)dict_update, METH_VARARGS | METH_KEYWORDS,
+ {"update", (PyCFunction)(void(*)(void))dict_update, METH_VARARGS | METH_KEYWORDS,
update__doc__},
DICT_FROMKEYS_METHODDEF
{"clear", (PyCFunction)dict_clear, METH_NOARGS,
@@ -3420,9 +3420,9 @@ dictiter_reduce(dictiterobject *di, PyObject *Py_UNUSED(ignored));
PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
static PyMethodDef dictiter_methods[] = {
- {"__length_hint__", (PyCFunction)dictiter_len, METH_NOARGS,
+ {"__length_hint__", (PyCFunction)(void(*)(void))dictiter_len, METH_NOARGS,
length_hint_doc},
- {"__reduce__", (PyCFunction)dictiter_reduce, METH_NOARGS,
+ {"__reduce__", (PyCFunction)(void(*)(void))dictiter_reduce, METH_NOARGS,
reduce_doc},
{NULL, NULL} /* sentinel */
};
@@ -4209,7 +4209,7 @@ PyDoc_STRVAR(reversed_keys_doc,
static PyMethodDef dictkeys_methods[] = {
{"isdisjoint", (PyCFunction)dictviews_isdisjoint, METH_O,
isdisjoint_doc},
- {"__reversed__", (PyCFunction)dictkeys_reversed, METH_NOARGS,
+ {"__reversed__", (PyCFunction)(void(*)(void))dictkeys_reversed, METH_NOARGS,
reversed_keys_doc},
{NULL, NULL} /* sentinel */
};
@@ -4315,7 +4315,7 @@ PyDoc_STRVAR(reversed_items_doc,
static PyMethodDef dictitems_methods[] = {
{"isdisjoint", (PyCFunction)dictviews_isdisjoint, METH_O,
isdisjoint_doc},
- {"__reversed__", (PyCFunction)dictitems_reversed, METH_NOARGS,
+ {"__reversed__", (PyCFunction)(void(*)(void))dictitems_reversed, METH_NOARGS,
reversed_items_doc},
{NULL, NULL} /* sentinel */
};
@@ -4396,7 +4396,7 @@ PyDoc_STRVAR(reversed_values_doc,
"Return a reverse iterator over the dict values.");
static PyMethodDef dictvalues_methods[] = {
- {"__reversed__", (PyCFunction)dictvalues_reversed, METH_NOARGS,
+ {"__reversed__", (PyCFunction)(void(*)(void))dictvalues_reversed, METH_NOARGS,
reversed_values_doc},
{NULL, NULL} /* sentinel */
};
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index 0f528ee..c1350b7 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -3086,7 +3086,7 @@ static PyMethodDef memory_methods[] = {
{"tobytes", (PyCFunction)memory_tobytes, METH_NOARGS, memory_tobytes_doc},
{"hex", (PyCFunction)memory_hex, METH_NOARGS, memory_hex_doc},
{"tolist", (PyCFunction)memory_tolist, METH_NOARGS, memory_tolist_doc},
- {"cast", (PyCFunction)memory_cast, METH_VARARGS|METH_KEYWORDS, memory_cast_doc},
+ {"cast", (PyCFunction)(void(*)(void))memory_cast, METH_VARARGS|METH_KEYWORDS, memory_cast_doc},
{"toreadonly", (PyCFunction)memory_toreadonly, METH_NOARGS, memory_toreadonly_doc},
{"__enter__", memory_enter, METH_NOARGS, NULL},
{"__exit__", memory_exit, METH_VARARGS, NULL},
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 0f54200..689062c 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -1311,7 +1311,7 @@ static PyMethodDef odict_methods[] = {
{"__reduce__", (PyCFunction)odict_reduce, METH_NOARGS,
odict_reduce__doc__},
ORDEREDDICT_SETDEFAULT_METHODDEF
- {"pop", (PyCFunction)odict_pop,
+ {"pop", (PyCFunction)(void(*)(void))odict_pop,
METH_VARARGS | METH_KEYWORDS, odict_pop__doc__},
ORDEREDDICT_POPITEM_METHODDEF
{"keys", odictkeys_new, METH_NOARGS,
@@ -1320,7 +1320,7 @@ static PyMethodDef odict_methods[] = {
odict_values__doc__},
{"items", odictitems_new, METH_NOARGS,
odict_items__doc__},
- {"update", (PyCFunction)odict_update, METH_VARARGS | METH_KEYWORDS,
+ {"update", (PyCFunction)(void(*)(void))odict_update, METH_VARARGS | METH_KEYWORDS,
odict_update__doc__},
{"clear", (PyCFunction)odict_clear, METH_NOARGS,
odict_clear__doc__},
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 2345b7c..73d385b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3481,7 +3481,7 @@ type___sizeof___impl(PyTypeObject *self)
static PyMethodDef type_methods[] = {
TYPE_MRO_METHODDEF
TYPE___SUBCLASSES___METHODDEF
- {"__prepare__", (PyCFunction)type_prepare,
+ {"__prepare__", (PyCFunction)(void(*)(void))type_prepare,
METH_FASTCALL | METH_KEYWORDS | METH_CLASS,
PyDoc_STR("__prepare__() -> dict\n"
"used to create the namespace for the class statement")},
@@ -5944,7 +5944,7 @@ tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
}
static struct PyMethodDef tp_new_methoddef[] = {
- {"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS,
+ {"__new__", (PyCFunction)(void(*)(void))tp_new_wrapper, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("__new__($type, *args, **kwargs)\n--\n\n"
"Create and return a new object. "
"See help(type) for accurate signature.")},
@@ -7140,7 +7140,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
}
else if (Py_TYPE(descr) == &PyCFunction_Type &&
PyCFunction_GET_FUNCTION(descr) ==
- (PyCFunction)tp_new_wrapper &&
+ (PyCFunction)(void(*)(void))tp_new_wrapper &&
ptr == (void**)&type->tp_new)
{
/* The __new__ wrapper is not a wrapper descriptor,
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 3da40dd..cdfc2f6 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13948,7 +13948,7 @@ static PyMethodDef unicode_methods[] = {
UNICODE_ISIDENTIFIER_METHODDEF
UNICODE_ISPRINTABLE_METHODDEF
UNICODE_ZFILL_METHODDEF
- {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
+ {"format", (PyCFunction)(void(*)(void)) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
{"format_map", (PyCFunction) do_string_format_map, METH_O, format_map__doc__},
UNICODE___FORMAT___METHODDEF
UNICODE_MAKETRANS_METHODDEF