[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

Chih-Hsuan Yen report at bugs.python.org
Mon May 28 03:12:54 EDT 2018


Chih-Hsuan Yen <yan12125 at gmail.com> added the comment:

There are still quite a few similar warnings on git-master. Do they indicate the same problem or should I open new issues?

For example:

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration   -I. -I./Include    -DPy_BUILD_CORE -o Objects/bytearrayobject.o Objects/bytearrayobject.c
In file included from Objects/bytearrayobject.c:96:
Objects/clinic/bytearrayobject.c.h:677:23: warning: cast between incompatible function types from ‘PyObject * (*)(PyByteArrayObject *, PyObject * const*, Py_ssize_t)’ {aka ‘struct _object * (*)(struct <anonymous> *, struct _object * const*, long int)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
     {"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_FASTCALL, bytearray_reduce_ex__doc__},
                       ^
Objects/bytearrayobject.c:2136:5: note: in expansion of macro ‘BYTEARRAY_REDUCE_EX_METHODDEF’
     BYTEARRAY_REDUCE_EX_METHODDEF
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm using GCC 8.1.0 on Arch Linux.

----------
nosy: +yan12125

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33012>
_______________________________________


More information about the Python-bugs-list mailing list