Commit 82b1bf61 authored by Stefan Behnel's avatar Stefan Behnel

Fix function signature casts in PyMethodDef structs that lead to warnings in...

Fix function signature casts in PyMethodDef structs that lead to warnings in gcc-8 (and actually make use of the warnings in gcc-8).
parent f9a6085b
...@@ -2193,10 +2193,18 @@ class CCodeWriter(object): ...@@ -2193,10 +2193,18 @@ class CCodeWriter(object):
if method_flags: if method_flags:
if entry.is_special: if entry.is_special:
method_flags += [method_coexist] method_flags += [method_coexist]
func_ptr = entry.func_cname
# Add extra casts, but try not to shadow real warnings.
cast = '__Pyx_PyCFunctionFast' if 'METH_FASTCALL' in method_flags else 'PyCFunction'
if 'METH_KEYWORDS' in method_flags:
# Need an extra cast
cast += 'WithKeywords'
if cast != 'PyCFunction':
func_ptr = '(void*)(%s)%s' % (cast, func_ptr)
self.putln( self.putln(
'{"%s", (PyCFunction)%s, %s, %s}%s' % ( '{"%s", (PyCFunction)%s, %s, %s}%s' % (
entry.name, entry.name,
entry.func_cname, func_ptr,
"|".join(method_flags), "|".join(method_flags),
doc_code, doc_code,
term)) term))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment