From cd12b35a348abc51110a86274e50f56ce536ea38 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 27 Mar 2023 19:42:37 +0200 Subject: [PATCH] Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND --- src/hidapi/SDL_hidapi.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 2d2df9f933..b28243deae 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -899,7 +899,7 @@ struct hidapi_backend const wchar_t *(*hid_error)(void *device); }; -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND static const struct hidapi_backend PLATFORM_Backend = { (void *)PLATFORM_hid_write, (void *)PLATFORM_hid_read_timeout, @@ -958,7 +958,7 @@ struct SDL_hid_device_ }; static char device_magic; -#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) static SDL_hid_device * CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend) @@ -986,7 +986,7 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device) } #ifndef SDL_HIDAPI_DISABLED -#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) #define COPY_IF_EXISTS(var) \ if (pSrc->var != NULL) { \ @@ -1134,7 +1134,7 @@ int SDL_hid_init(void) } #endif /* HAVE_LIBUSB */ -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND ++attempts; #if __LINUX__ udev_ctx = SDL_UDEV_GetUdevSyms(); @@ -1169,7 +1169,7 @@ int SDL_hid_exit(void) HIDAPI_ShutdownDiscovery(); #endif -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { result |= PLATFORM_hid_exit(); } @@ -1224,7 +1224,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned struct SDL_hid_device_info *driver_devs = NULL; struct SDL_hid_device_info *driver_dev; #endif -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND struct SDL_hid_device_info *raw_devs = NULL; struct SDL_hid_device_info *raw_dev; #endif @@ -1280,7 +1280,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } #endif /* HAVE_DRIVER_BACKEND */ -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id); #ifdef DEBUG_HIDAPI @@ -1368,14 +1368,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs) SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) { -#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#if defined(HAVE_PLATFORM_BACKEND) if (udev_ctx) { pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number); if (pDevice != NULL) { @@ -1407,14 +1407,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */) { -#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#if defined(HAVE_PLATFORM_BACKEND) if (udev_ctx) { pDevice = PLATFORM_hid_open_path(path, bExclusive); if (pDevice != NULL) {