tclMacOSXNotify.c: function pointer cast to incompatible type
Closed / Fixed6f1dd8a1be789a75a3e85f21b5f243ba5620dc5bCreated 364 days agoUpdated 364 days ago
Descriptionmarkdown2025-12-03 21:47:47
macosx/tclMacOSXNotify.c:659:3: warning: cast from 'void (*)(void *) __attribute__((noreturn))' to 'void *(*)(void *)' converts to incompatible function type [-Wcast-function-type-mismatch]
659 | (void * (*)(void *)) NotifierThreadProc, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I do not see this warning on 8.6, but I am not aware why.
While an intermediate (void *) cast would silence this warning, I wonder if Tcl should instead just declare/define NotifierThreadProc() as the expected type and remove the cast.
Referenced by1
9c3bb02ddfFix [6f1dd8a1be]: tclMacOSXNotify.c: function pointer cast to incompatible type check-in2025-12-03 23:01:08
jan.nijtmanswiki2025-12-03 22:43:09
> I wonder if Tcl should instead just declare/define NotifierThreadProc() as the expected type and remove the cast
Unfortunately, that wouldn't help. The last functions in NotifierThreadProc() is a "pthread_exit(0)" call. If we change the signature, we need to add a "return NULL" statement, which then would become unreachable, so another warning we need to handle.
So, I think that the additional cast is the best we can do here.
Thanks!
jan.nijtmanswiki2025-12-03 23:27:51
Fixed [here] (and in all other active branches)
Log in (anonymous is fine) to add a comment.