summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2020-04-19 11:31:28 +0300
committerIvan Maidanski <ivmai@mail.ru>2020-04-19 11:40:33 +0300
commit95175f0db3daa9f79d08e097cd41b90a06138a4d (patch)
treec39140c1d52c8937ed4c3dcb85ece2fd83864f2a /misc.c
parentb78dd64a2bfd18d64608f8592ab4f7ec9ab562de (diff)
downloadbdwgc-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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/misc.c b/misc.c
index d178790e..e60ea6c5 100644
--- a/misc.c
+++ b/misc.c
@@ -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);