Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ jobs:
- name: Install dependencies
run: |
pacman -Sy
pacman -S --noconfirm glibc lib32-glibc gcc pkg-config autoconf automake libtool libusb libudev0 cmake make
pacman -S --noconfirm glibc lib32-glibc gcc pkg-config autoconf automake libtool libusb cmake make
- name: Configure CMake
run: |
rm -rf build install
Expand Down
15 changes: 7 additions & 8 deletions windows/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ static int lookup_functions()
goto err;
}

#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#define RESOLVE(lib_handle, x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) goto err;
/* Avoid direct function-pointer cast from FARPROC to typed callback pointer.
Using memcpy keeps this warning-free regardless of the compiler and compiler settings. */
#define RESOLVE(lib_handle, x) do { \
FARPROC proc_addr = GetProcAddress(lib_handle, #x); \
if (!proc_addr) goto err; \
memcpy(&x, &proc_addr, sizeof(x)); \
} while (0)

RESOLVE(hid_lib_handle, HidD_GetHidGuid);
RESOLVE(hid_lib_handle, HidD_GetAttributes);
Expand All @@ -167,9 +169,6 @@ static int lookup_functions()
RESOLVE(cfgmgr32_lib_handle, CM_Get_Device_Interface_ListW);

#undef RESOLVE
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif

return 0;

Expand Down
Loading