From b716db204d19da9449c9a83103e294b13220d5d3 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 27 Mar 2023 19:22:24 +0200 Subject: [PATCH] Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS --- src/SDL.c | 4 ++-- src/core/linux/SDL_dbus.c | 2 +- src/core/linux/SDL_ibus.c | 5 +++++ src/core/linux/SDL_threadprio.c | 6 +++--- src/power/linux/SDL_syspower.c | 4 ++-- src/video/wayland/SDL_waylandmouse.c | 4 ++-- src/video/wayland/SDL_waylandwindow.c | 2 +- src/video/x11/SDL_x11events.c | 4 ++-- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 0a9679447b..70f8dd3d3d 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -171,7 +171,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Clear the error message */ SDL_ClearError(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Init(); #endif @@ -496,7 +496,7 @@ void SDL_Quit(void) SDL_ClearHints(); SDL_AssertionsQuit(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index 16a7c13f94..687cb85498 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -23,7 +23,7 @@ #include "SDL_sandbox.h" #include "../../stdlib/SDL_vacopy.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* we never link directly to libdbus. */ static const char *dbus_library = "libdbus-1.so.3"; static void *dbus_handle = NULL; diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 7f10a0c127..5d97c58401 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -23,6 +23,9 @@ #ifdef HAVE_IBUS_IBUS_H #include "SDL_ibus.h" #include "SDL_dbus.h" + +#ifdef SDL_USE_LIBDBUS + #include "../../video/SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" @@ -748,4 +751,6 @@ void SDL_IBus_PumpEvents(void) } } +#endif // SDL_USE_LIBDBUS + #endif diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c index 88a536a1c5..23b4473346 100644 --- a/src/core/linux/SDL_threadprio.c +++ b/src/core/linux/SDL_threadprio.c @@ -40,7 +40,7 @@ #include "SDL_dbus.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* d-bus queries to org.freedesktop.RealtimeKit1. */ #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1" @@ -258,7 +258,7 @@ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) return 0; } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: @@ -314,7 +314,7 @@ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int sc } } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index a50ba9a0ee..0941c7027d 100644 --- a/src/power/linux/SDL_syspower.c +++ b/src/power/linux/SDL_syspower.c @@ -525,7 +525,7 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second } /* d-bus queries to org.freedesktop.UPower. */ -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS #define UPOWER_DBUS_NODE "org.freedesktop.UPower" #define UPOWER_DBUS_PATH "/org/freedesktop/UPower" #define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" @@ -616,7 +616,7 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second { SDL_bool retval = SDL_FALSE; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBusContext *dbus = SDL_DBus_GetContext(); char **paths = NULL; int i, numpaths = 0; diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index ac9cd257e7..be960608bb 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -177,7 +177,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa if ((xcursor_size = SDL_getenv("XCURSOR_SIZE"))) { size = SDL_atoi(xcursor_size); } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (size <= 0) { wayland_dbus_read_cursor_size(&size); } @@ -213,7 +213,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa return SDL_FALSE; } xcursor_theme = SDL_getenv("XCURSOR_THEME"); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (xcursor_theme == NULL) { /* Allocates the string with SDL_strdup, which must be freed. */ free_theme_str = wayland_dbus_read_cursor_theme(&xcursor_theme); diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 7a35fbe08f..eff09523a1 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -2167,7 +2167,7 @@ int Wayland_SuspendScreenSaver(_THIS) { SDL_VideoData *data = _this->driverdata; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return 0; } diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index fa5a34cd97..0410da2587 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -1729,7 +1729,7 @@ void X11_PumpEvents(_THIS) if (!data->screensaver_activity || now >= (data->screensaver_activity + 30000)) { X11_XResetScreenSaver(data->display); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_ScreensaverTickle(); #endif @@ -1775,7 +1775,7 @@ int X11_SuspendScreenSaver(_THIS) int major_version, minor_version; #endif /* SDL_VIDEO_DRIVER_X11_XSCRNSAVER */ -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return 0; }