diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2020-04-19 11:31:28 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2020-04-19 11:40:33 +0300 |
commit | 95175f0db3daa9f79d08e097cd41b90a06138a4d (patch) | |
tree | c39140c1d52c8937ed4c3dcb85ece2fd83864f2a /misc.c | |
parent | b78dd64a2bfd18d64608f8592ab4f7ec9ab562de (diff) | |
download | bdwgc-95175f0db3daa9f79d08e097cd41b90a06138a4d.tar.gz |
Eliminate 'cast between incompatible func types' warnings for FARPROC vars
Direct conversion of GetProcAddress() result (of FARPROC type) to the
required functional type is performed by casting the result to word
type first.
* misc.c [MSGBOX_ON_ERROR && DONT_USE_USER32_DLL]
(GC_win32_MessageBoxA): Cast pfn to word type first.
* win32_threads.c [WOW64_THREAD_CONTEXT_WORKAROUND] (GC_thr_init):
Likewise.
* misc.c [GC_WIN32_THREADS && !GC_PTHREADS && !MSWINRT_FLAVOR
&& !MSWINCE] (GC_init): Change pfn type to FARPROC; cast pfn to word
type first and, then, to the required functional type.
* os_dep.c [!OS2 && GWW_VDB] (GetWriteWatch_func): Change type to
FARPROC.
* os_dep.c [!OS2 && GWW_VDB] (GC_GWW_AVAILABLE): Compare
GetWriteWatch_func to 0 instead of NULL.
* os_dep.c [GWW_VDB] (detect_GetWriteWatch, GC_gww_read_dirty): Cast
GetWriteWatch_func to word type first and, then, to the required
functional type.
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -831,7 +831,7 @@ GC_API int GC_CALL GC_is_init_called(void) if (hU32) { FARPROC pfn = GetProcAddress(hU32, "MessageBoxA"); if (pfn) - (void)(*(int (WINAPI *)(HWND, LPCSTR, LPCSTR, UINT))pfn)( + (void)(*(int (WINAPI *)(HWND, LPCSTR, LPCSTR, UINT))(word)pfn)( NULL /* hWnd */, msg, caption, flags); (void)FreeLibrary(hU32); } @@ -958,14 +958,14 @@ GC_API void GC_CALL GC_init(void) # else { # ifndef MSWINCE - BOOL (WINAPI *pfn)(LPCRITICAL_SECTION, DWORD) = 0; + FARPROC pfn = 0; HMODULE hK32 = GetModuleHandle(TEXT("kernel32.dll")); if (hK32) - pfn = (BOOL (WINAPI *)(LPCRITICAL_SECTION, DWORD)) - GetProcAddress(hK32, - "InitializeCriticalSectionAndSpinCount"); + pfn = GetProcAddress(hK32, + "InitializeCriticalSectionAndSpinCount"); if (pfn) { - pfn(&GC_allocate_ml, SPIN_COUNT); + (*(BOOL (WINAPI *)(LPCRITICAL_SECTION, DWORD))(word)pfn)( + &GC_allocate_ml, SPIN_COUNT); } else # endif /* !MSWINCE */ /* else */ InitializeCriticalSection(&GC_allocate_ml); |