MinGW: Avoid GCC -Wcast-function-type warnings on GetProcAddress

Using the same method as GNUlib and various other projects.
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00109.html

The warning is valid, but there's no way around it since the issue
comes from the Windows SDK. It's also harmless in this case.

Part of #29801.
This commit is contained in:
Rémi Verschelde 2020-01-16 12:07:58 +01:00
parent a2c90fe2f3
commit e33914e0c1
3 changed files with 15 additions and 0 deletions

View file

@ -43,6 +43,11 @@
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define wglGetProcAddress (void *)wglGetProcAddress
#endif
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *); typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *);
void ContextGL_Windows::release_current() { void ContextGL_Windows::release_current() {

View file

@ -37,6 +37,11 @@
#define __builtin_bswap32 _byteswap_ulong #define __builtin_bswap32 _byteswap_ulong
#endif #endif
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE *pState) { DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE *pState) {
return ERROR_DEVICE_NOT_CONNECTED; return ERROR_DEVICE_NOT_CONNECTED;
} }

View file

@ -74,6 +74,11 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#define WM_POINTERUPDATE 0x0245 #define WM_POINTERUPDATE 0x0245
#endif #endif
#if defined(__GNUC__)
// Workaround GCC warning from -Wcast-function-type.
#define GetProcAddress (void *)GetProcAddress
#endif
typedef struct { typedef struct {
int count; int count;
int screen; int screen;