bpo-33015: Fix func cast warn in PyThread_start_new_thread()#10057
bpo-33015: Fix func cast warn in PyThread_start_new_thread()#10057vstinner wants to merge 1 commit into
Conversation
Fix a warning on a cast between two different function pointer types in the pthread implementation of PyThread_start_new_thread(). Cast the function pointer temporarily to "void *" to mute the warning. The overall cast changes the return type of the function pointer: convert "void" return type (no return type) to "void*" return type. Python uses pthread_detach() and doesn't use pthread_join(), the thread return value is ignored.
|
Hum, first I pushed a big change with unrelated cleanup changes. I rewrote my PR to only fix the compiler warning. Once this change is merged, I will write a second PR to cleanup the code. |
Sorry, something went wrong.
|
The cast in this solution is still undefined behavior. Asking around with the C and C++ experts at work it was pointed out that the C99 spec covers this: "A pointer to a function of one type may be converted to a pointer to a function of another type and back again; the result shall compare equal to the original pointer. If a converted pointer is used to call a function whose type is not compatible with the pointed-to type, the behavior is undefined." from http://c0x.coding-guidelines.com/6.3.2.3.html |
Sorry, something went wrong.
|
Control Flow Integrity killed my PR :-) |
Sorry, something went wrong.
Fix a warning on a cast between two different function pointer types
in the pthread implementation of PyThread_start_new_thread().
Cast the function pointer temporarily to "void *" to mute the
warning. The overall cast changes the return type of the function
pointer: convert "void" return type (no return type) to "void*"
return type.
Python uses pthread_detach() and doesn't use pthread_join(), the
thread return value is ignored.
https://bugs.python.org/issue33015