Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV

This commit is contained in:
Anonymous Maarten
2023-03-27 19:48:06 +02:00
parent 95dc4fbdd5
commit 41e7335a0f
4 changed files with 16 additions and 16 deletions

View File

@@ -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

View File

@@ -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 */

View File

@@ -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

View File

@@ -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();