mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 03:29:14 +00:00
Fix GCC 8 cast warnings
Silences the following warnings when compiling with GCC 8. The fix is to use an intermediate pointer to anonymous function: ``` misc.cpp: In function 'int WinProcGroup::get_group(size_t)': misc.cpp:241:77: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'fun1_t' {aka 'bool (*)(_LOGICAL_PROCESSOR_RELATIONSHIP, _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*, long unsigned int*)'} [-Wcast-function-type] auto fun1 = (fun1_t)GetProcAddress(k32, "GetLogicalProcessorInformationEx"); ^ misc.cpp: In function 'void WinProcGroup::bindThisThread(size_t)': misc.cpp:309:71: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'fun2_t' {aka 'bool (*)(short unsigned int, _GROUP_AFFINITY*)'} [-Wcast-function-type] auto fun2 = (fun2_t)GetProcAddress(k32, "GetNumaNodeProcessorMaskEx"); ^ misc.cpp:310:67: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'fun3_t' {aka 'bool (*)(void*, const _GROUP_AFFINITY*, _GROUP_AFFINITY*)'} [-Wcast-function-type] auto fun3 = (fun3_t)GetProcAddress(k32, "SetThreadGroupAffinity"); ^ ``` No functional change.
This commit is contained in:
parent
745160572f
commit
06a853eb9c
1 changed files with 3 additions and 3 deletions
|
@ -238,7 +238,7 @@ int get_group(size_t idx) {
|
|||
|
||||
// Early exit if the needed API is not available at runtime
|
||||
HMODULE k32 = GetModuleHandle("Kernel32.dll");
|
||||
auto fun1 = (fun1_t)GetProcAddress(k32, "GetLogicalProcessorInformationEx");
|
||||
auto fun1 = (fun1_t)(void(*)())GetProcAddress(k32, "GetLogicalProcessorInformationEx");
|
||||
if (!fun1)
|
||||
return -1;
|
||||
|
||||
|
@ -306,8 +306,8 @@ void bindThisThread(size_t idx) {
|
|||
|
||||
// Early exit if the needed API are not available at runtime
|
||||
HMODULE k32 = GetModuleHandle("Kernel32.dll");
|
||||
auto fun2 = (fun2_t)GetProcAddress(k32, "GetNumaNodeProcessorMaskEx");
|
||||
auto fun3 = (fun3_t)GetProcAddress(k32, "SetThreadGroupAffinity");
|
||||
auto fun2 = (fun2_t)(void(*)())GetProcAddress(k32, "GetNumaNodeProcessorMaskEx");
|
||||
auto fun3 = (fun3_t)(void(*)())GetProcAddress(k32, "SetThreadGroupAffinity");
|
||||
|
||||
if (!fun2 || !fun3)
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue