Skip to content

Commit 1654556

Browse files
committed
do not error out on incompatible function pointer casts
In many cases, the callback function pointers in PyMethodDef definitions are cast to PyCFunction type where as their actual signature matches that of PyCFunctionWithKeywords type. This issue exists throughout in python 2.7 codebase in general. On newer compilers, this produces a compile time failure like the following: build/grub/grub-core/contrib/python/bitsmodule.c:558:16: error: cast between incompatible function types from 'PyObject * (*)(PyObject *, PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *, struct _object *)'} to 'PyObject * (*)(PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *)'} [-Werror=cast-function-type] 558 | {"get_xy", (PyCFunction)bits_get_xy, METH_KEYWORDS, "get_xy(term) -> (cursor_x, cursor_y)"}, Pass -Wno-cast-function-type in compiler cflags in order to suppress this failure. Signed-off-by: Ani Sinha <[email protected]>
1 parent 2e41220 commit 1654556

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,9 @@ yes)
11211121
BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
11221122
fi
11231123

1124+
# disable cast function type warning for newer compilers
1125+
BASECFLAGS="$BASECFLAGS -Wno-cast-function-type"
1126+
11241127
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
11251128
# support. Without this, treatment of subnormals doesn't follow
11261129
# the standard.

0 commit comments

Comments
 (0)