From 41e7335a0f662ae6d062e23227791a6ee3d6e0be Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 27 Mar 2023 19:48:06 +0200 Subject: [PATCH] Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV --- src/core/linux/SDL_evdev.c | 10 +++++----- src/haptic/linux/SDL_syshaptic.c | 10 +++++----- src/hidapi/SDL_hidapi.c | 2 +- src/joystick/linux/SDL_sysjoystick.c | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 4f228063e5..3e2cc29f5d 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -124,7 +124,7 @@ static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); static int SDL_EVDEV_device_removed(const char *dev_path); static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ @@ -153,7 +153,7 @@ int SDL_EVDEV_Init(void) return SDL_OutOfMemory(); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { SDL_free(_this); _this = NULL; @@ -216,7 +216,7 @@ void SDL_EVDEV_Quit(void) _this->ref_count -= 1; if (_this->ref_count < 1) { -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ @@ -237,7 +237,7 @@ void SDL_EVDEV_Quit(void) } } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path) { @@ -280,7 +280,7 @@ void SDL_EVDEV_Poll(void) return; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index f59b541e65..5aa16cd63e 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -38,7 +38,7 @@ #define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */ static int MaybeAddDevice(const char *path); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ @@ -156,7 +156,7 @@ int SDL_SYS_HapticInit(void) MaybeAddDevice(path); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { return SDL_SetError("Could not initialize UDEV"); } @@ -195,7 +195,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index) return item; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { @@ -285,7 +285,7 @@ static int MaybeAddDevice(const char *path) return numhaptics; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path) { SDL_hapticlist_item *item; @@ -601,7 +601,7 @@ void SDL_SYS_HapticQuit(void) SDL_free(item); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_DelCallback(haptic_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index b28243deae..26851beb4d 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -559,7 +559,7 @@ HIDAPI_ShutdownDiscovery() #undef HIDAPI_H__ #if __LINUX__ -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static const SDL_UDEV_Symbols *udev_ctx = NULL; #define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index f0146754c6..897ae3f0f2 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -189,7 +189,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick if (ioctl(fd, JSIOCGNAME(sizeof(product_string)), product_string) >= 0) { SDL_zero(inpid); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version); #endif } else { @@ -237,7 +237,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick return 1; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL) { @@ -677,7 +677,7 @@ static void LINUX_FallbackJoystickDetect(void) static void LINUX_JoystickDetect(void) { -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { SDL_UDEV_Poll(); } else @@ -730,7 +730,7 @@ static int LINUX_JoystickInit(void) /* Manually scan first, since we sort by device number and udev doesn't */ LINUX_JoystickDetect(); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_UNSET) { if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, @@ -1594,7 +1594,7 @@ static void LINUX_JoystickQuit(void) numjoysticks = 0; -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_Quit();