From 56449f167d58d7ad78e380eff9bdf00306cb5436 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 21 Jun 2025 14:11:02 +0300 Subject: [PATCH] hidapi/libusb: disable C5287 warning in MSVC builds A quick search implies that it is a bogus warning: https://www.google.com/search?q=visual+studio+C5287 (cherry picked from commit 81e3066303dfbd16e27e773846b95749bb7b8839) --- src/hidapi/libusb/hid.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index c911f7e715..6557b5c683 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -71,6 +71,11 @@ extern "C" { #define DETACH_KERNEL_DRIVER #endif +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:5287) /* operands are different enum types */ +#endif + /* Uncomment to enable the retrieval of Usage and Usage Page in hid_enumerate(). Warning, on platforms different from FreeBSD this is very invasive as it requires the detach @@ -2140,6 +2145,10 @@ uint16_t get_usb_code_for_current_locale(void) return 0x0; } +#if defined(_MSC_VER) +#pragma warning (pop) +#endif + #ifdef __cplusplus } #endif