win32: drop -Wno-incompatible-pointer-types when pedantic #1094
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
27e0c3c (win32: allow building with pedantic mode enabled, 2021-09-03)
adds -W as a workaround to the use of
void *
to hold a pointer to afunction, punting the final solution.
The type used in Windows is a generic function type, but assigning it
from a different function interface will require a cast that was
missing from the original implementation, so lets add that.
Sadly; that is not enough, as gcc will helpfully raise a -Wcast-function-type
warnig when casting between functions that might have incompatible
return types (ex: GetUserNameExW returns bool which is only half the
size of the return type from FAPROC), so create a new type that could be
used as a completely generic function pointer, which then could be assigned
to the correct function pointer through a cast.
This has the advantage that the generic pointer functions then will be
opaque and not useful as functions without being assigned to the right
function pointer variable (just like
void *
was meant to be in POSIX).Signed-off-by: Carlo Marcelo Arenas Belón carenas@gmail.com