2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-12 12:32:10 +00:00

Fix warning on mingw about casting a function pointer through a void *.

Fix warning on MSVC about GetModuleHandle potentially failing.
This commit is contained in:
Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)
2015-02-06 12:04:22 +00:00
parent f599783444
commit 9c67be287e

View File

@@ -657,12 +657,16 @@ namespace boost
{
return SetWaitableTimer(hTimer, lpDueTime, lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, FALSE);
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6387) // MSVC sanitiser warns that GetModuleHandleA() might fail
#endif
static inline setwaitabletimerex_t SetWaitableTimerEx()
{
static setwaitabletimerex_t setwaitabletimerex_impl;
if(setwaitabletimerex_impl)
return setwaitabletimerex_impl;
void *addr=(void *) GetProcAddress(
void (*addr)()=(void (*)()) GetProcAddress(
#if !defined(BOOST_NO_ANSI_APIS)
GetModuleHandleA("KERNEL32.DLL"),
#else
@@ -675,6 +679,9 @@ namespace boost
setwaitabletimerex_impl=&SetWaitableTimerEx_emulation;
return setwaitabletimerex_impl;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
#endif
#endif