From ba3274e3a11f494098fc37296202ec1aa2dfe0ef Mon Sep 17 00:00:00 2001
From: RaceTheMaSe <[EMAIL REDACTED]>
Date: Sat, 7 Feb 2026 19:10:50 +0100
Subject: [PATCH] hidapi, windows: Fix -Wjump-misses-init warning (#14990)
Clang: jump from this goto statement to its label is incompatible with C++ [-Wjump-misses-init]
---
src/hidapi/windows/hid.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c
index aa67a466d3c60..7579978232a08 100644
--- a/src/hidapi/windows/hid.c
+++ b/src/hidapi/windows/hid.c
@@ -1027,6 +1027,12 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
continue;
}
+#ifdef HIDAPI_IGNORE_DEVICE
+ hid_bus_type bus_type = HID_API_BUS_UNKNOWN;
+ PHIDP_PREPARSED_DATA pp_data = NULL;
+ HIDP_CAPS caps = { 0 };
+#endif
+
/* Get the Vendor ID and Product ID for this device. */
attrib.Size = sizeof(HIDD_ATTRIBUTES);
if (!HidD_GetAttributes(device_handle, &attrib)) {
@@ -1035,9 +1041,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
#ifdef HIDAPI_IGNORE_DEVICE
/* See if there are any devices we should skip in enumeration */
- hid_bus_type bus_type = get_bus_type(device_interface);
- PHIDP_PREPARSED_DATA pp_data = NULL;
- HIDP_CAPS caps = { 0 };
+ bus_type = get_bus_type(device_interface);
if (HidD_GetPreparsedData(device_handle, &pp_data)) {
HidP_GetCaps(pp_data, &caps);
HidD_FreePreparsedData(pp_data);