On Sun, 15 Sep 2024, Pali Rohár wrote:
When casting from function pointer which takes some parameters and returns
void to function pointer which returns non-void and may take some
parameters, then gcc throws following warning:
warning: wspiapi.h:50:20: warning: cast between incompatible function types
from ‘void (__attribute__((stdcall)) *)(struct addrinfo *)’ to ‘int
(__attribute__((stdcall)) *)()’ [-Wcast-function-type]
Avoid this warning by first casting to (void(*)(void)) pointer and then to
final (FARPROC) function pointer. Casting from and to (void(*)(void)) gcc
and clang does not throw incompatible cast warnings.
See: https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
---
mingw-w64-crt/libsrc/wspiapi/WspiapiFreeAddrInfo.c | 2 +-
mingw-w64-headers/include/wspiapi.h | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
This seems to work fine with Clang too, so I pushed this patch.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public