STINNER Victor <vstin...@redhat.com> added the comment:

func_cast.c: C program reproducing the issue. Using an additional (void*) cast, 
it's possible to workaround the cast warning.

/* Test GCC 8.1 -Wcast-function-type for https://bugs.python.org/issue33015
 *
 * Compiled on Linux with:
 * gcc x.c -o x -Wall -Wextra -lpthread
 *
 * Workaround the cast:
 * gcc x.c -o x -Wall -Wextra -lpthread -D UGLY_CAST
 */


/* No result value */
typedef void (*python_callback) (void *);

/* Result type: "void*" (untyped pointer) */
typedef void* (*pthread_callback) (void *);

int test_cast(python_callback func)
{
    ...
#ifdef UGLY_CAST
    pthread_callback func2 = (pthread_callback)(void *)func;
#else
    pthread_callback func2 = (pthread_callback)func;
#endif
    ...
}

----------
Added file: https://bugs.python.org/file47888/func_cast.c

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to