Changeset - r25634:8c500d511c41
[Not reviewed]
master
0 1 0
glx22 - 3 years ago 2021-05-14 13:41:00
glx@openttd.org
Fix: [MinGW] Ignore wglGetProcAddress() cast warnings
1 file changed with 9 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/video/win32_v.cpp
Show inline comments
 
@@ -1262,12 +1262,18 @@ static void LoadWGLExtensions()
 
	if (SelectPixelFormat(dc, false) == nullptr) {
 
		/* Create rendering context. */
 
		HGLRC rc = wglCreateContext(dc);
 
		if (rc != nullptr) {
 
			wglMakeCurrent(dc, rc);
 

	
 
#ifdef __MINGW32__
 
			/* GCC doesn't understand the expected usage of wglGetProcAddress(). */
 
#pragma GCC diagnostic push
 
#pragma GCC diagnostic ignored "-Wcast-function-type"
 
#endif /* __MINGW32__ */
 

	
 
			/* Get list of WGL extensions. */
 
			PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
 
			if (wglGetExtensionsStringARB != nullptr) {
 
				const char *wgl_exts = wglGetExtensionsStringARB(dc);
 
				/* Bind supported functions. */
 
				if (FindStringInExtensionList(wgl_exts, "WGL_ARB_create_context") != nullptr) {
 
@@ -1276,12 +1282,15 @@ static void LoadWGLExtensions()
 
				_hasWGLARBCreateContextProfile = FindStringInExtensionList(wgl_exts, "WGL_ARB_create_context_profile") != nullptr;
 
				if (FindStringInExtensionList(wgl_exts, "WGL_EXT_swap_control") != nullptr) {
 
					_wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
 
				}
 
			}
 

	
 
#ifdef __MINGW32__
 
#pragma GCC diagnostic pop
 
#endif
 
			wglMakeCurrent(nullptr, nullptr);
 
			wglDeleteContext(rc);
 
		}
 
	}
 

	
 
	ReleaseDC(wnd, dc);
0 comments (0 inline, 0 general)