From da6fdc6a3c5c6c490b4ebfdba86a3da1bca496ce Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 27 Mar 2023 14:55:22 +0200 Subject: [PATCH] Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED --- src/SDL.c | 4 ++-- src/joystick/SDL_gamepad.c | 8 ++++---- src/joystick/SDL_joystick.c | 26 +++++++++++++------------- src/joystick/apple/SDL_mfijoystick.m | 2 +- src/sensor/SDL_sensor.c | 8 ++++---- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 13bb1539c2..a0031221c9 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -199,7 +199,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the event subsystem */ if (flags & SDL_INIT_EVENTS) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) { SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS); if (SDL_InitEvents() < 0) { @@ -438,7 +438,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (flags & SDL_INIT_EVENTS) { if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) { SDL_QuitEvents(); diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index 5c50e38fbd..3919e95900 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -30,7 +30,7 @@ #include "usb_ids.h" #include "hidapi/SDL_hidapi_nintendo.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -3056,7 +3056,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) { SDL_Event event; event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION; @@ -3076,7 +3076,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadButton button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -3118,7 +3118,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(event.type)) { event.common.timestamp = timestamp; event.gbutton.which = gamepad->joystick->instance_id; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 88dca2ebf7..1fc10f18a1 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -27,7 +27,7 @@ #include "SDL_gamepad_c.h" #include "SDL_joystick_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif #include "../video/SDL_sysvideo.h" @@ -301,7 +301,7 @@ int SDL_InitJoysticks(void) SDL_joystick_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -1304,7 +1304,7 @@ void SDL_QuitJoysticks(void) SDL_joystick_player_count = 0; } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -1404,7 +1404,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id) SDL_SetJoystickIDForPlayerIndex(player_index, instance_id); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED { SDL_Event event; @@ -1454,7 +1454,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id) { SDL_Joystick *joystick = NULL; int player_index; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; #endif @@ -1469,7 +1469,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id) } } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED event.type = SDL_EVENT_JOYSTICK_REMOVED; event.common.timestamp = 0; @@ -1538,7 +1538,7 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) { SDL_Event event; event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION; @@ -1580,7 +1580,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) { SDL_Event event; event.type = SDL_EVENT_JOYSTICK_HAT_MOTION; @@ -1597,7 +1597,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -1638,7 +1638,7 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(event.type)) { event.common.timestamp = timestamp; event.jbutton.which = joystick->instance_id; @@ -2850,7 +2850,7 @@ void SDL_SendJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */ if (ePowerLevel != joystick->epowerlevel) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) { SDL_Event event; event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED; @@ -2954,7 +2954,7 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(event_type)) { SDL_Event event; event.type = event_type; @@ -2994,7 +2994,7 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT SDL_memcpy(sensor->data, data, num_values * sizeof(*data)); /* Post the event, if desired */ -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) { SDL_Event event; event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE; diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index d6bcf803b1..db45d108f7 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -28,7 +28,7 @@ #include "SDL_mfijoystick_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" #endif diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c index 68e33523d2..980e6a662c 100644 --- a/src/sensor/SDL_sensor.c +++ b/src/sensor/SDL_sensor.c @@ -24,7 +24,7 @@ #include "SDL_syssensor.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -71,7 +71,7 @@ int SDL_InitSensors(void) SDL_sensor_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -464,7 +464,7 @@ void SDL_QuitSensors(void) SDL_UnlockSensors(); -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -488,7 +488,7 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) { SDL_Event event; event.type = SDL_EVENT_SENSOR_UPDATE;