Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED

This commit is contained in:
Anonymous Maarten committed 2023-03-28 19:29:43 +02:00
1 parent 897c40285e
commit da6fdc6a3c
5 files changed
+24 -24

No files matched your search

+2 -2
View File
@@ -199,7 +199,7 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the event subsystem */ /* Initialize the event subsystem */
if (flags & SDL_INIT_EVENTS) { if (flags & SDL_INIT_EVENTS) {
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) { if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS); SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS);
if (SDL_InitEvents() < 0) { if (SDL_InitEvents() < 0) {
@@ -438,7 +438,7 @@ void SDL_QuitSubSystem(Uint32 flags)
} }
#endif #endif
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (flags & SDL_INIT_EVENTS) { if (flags & SDL_INIT_EVENTS) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) { if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) {
SDL_QuitEvents(); SDL_QuitEvents();
+4 -4
View File
@@ -30,7 +30,7 @@
#include "usb_ids.h" #include "usb_ids.h"
#include "hidapi/SDL_hidapi_nintendo.h" #include "hidapi/SDL_hidapi_nintendo.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"
#endif #endif
@@ -3056,7 +3056,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
/* translate the event, if desired */ /* translate the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) { if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) {
SDL_Event event; SDL_Event event;
event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION; 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) static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadButton button, Uint8 state)
{ {
int posted; int posted;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_Event event; SDL_Event event;
SDL_AssertJoysticksLocked(); SDL_AssertJoysticksLocked();
@@ -3118,7 +3118,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
/* translate the event, if desired */ /* translate the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(event.type)) { if (SDL_EventEnabled(event.type)) {
event.common.timestamp = timestamp; event.common.timestamp = timestamp;
event.gbutton.which = gamepad->joystick->instance_id; event.gbutton.which = gamepad->joystick->instance_id;
+13 -13
View File
@@ -27,7 +27,7 @@
#include "SDL_gamepad_c.h" #include "SDL_gamepad_c.h"
#include "SDL_joystick_c.h" #include "SDL_joystick_c.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"
#endif #endif
#include "../video/SDL_sysvideo.h" #include "../video/SDL_sysvideo.h"
@@ -301,7 +301,7 @@ int SDL_InitJoysticks(void)
SDL_joystick_lock = SDL_CreateMutex(); SDL_joystick_lock = SDL_CreateMutex();
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
return -1; return -1;
} }
@@ -1304,7 +1304,7 @@ void SDL_QuitJoysticks(void)
SDL_joystick_player_count = 0; SDL_joystick_player_count = 0;
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_QuitSubSystem(SDL_INIT_EVENTS); SDL_QuitSubSystem(SDL_INIT_EVENTS);
#endif #endif
@@ -1404,7 +1404,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
SDL_SetJoystickIDForPlayerIndex(player_index, instance_id); SDL_SetJoystickIDForPlayerIndex(player_index, instance_id);
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
{ {
SDL_Event event; SDL_Event event;
@@ -1454,7 +1454,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
{ {
SDL_Joystick *joystick = NULL; SDL_Joystick *joystick = NULL;
int player_index; int player_index;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_Event event; SDL_Event event;
#endif #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.type = SDL_EVENT_JOYSTICK_REMOVED;
event.common.timestamp = 0; event.common.timestamp = 0;
@@ -1538,7 +1538,7 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) { if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) {
SDL_Event event; SDL_Event event;
event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION; 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 */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) { if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) {
SDL_Event event; SDL_Event event;
event.type = SDL_EVENT_JOYSTICK_HAT_MOTION; 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 SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 button, Uint8 state)
{ {
int posted; int posted;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_Event event; SDL_Event event;
SDL_AssertJoysticksLocked(); SDL_AssertJoysticksLocked();
@@ -1638,7 +1638,7 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(event.type)) { if (SDL_EventEnabled(event.type)) {
event.common.timestamp = timestamp; event.common.timestamp = timestamp;
event.jbutton.which = joystick->instance_id; 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 */ SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */
if (ePowerLevel != joystick->epowerlevel) { if (ePowerLevel != joystick->epowerlevel) {
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) { if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) {
SDL_Event event; SDL_Event event;
event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED; 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 */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(event_type)) { if (SDL_EventEnabled(event_type)) {
SDL_Event event; SDL_Event event;
event.type = event_type; 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)); SDL_memcpy(sensor->data, data, num_values * sizeof(*data));
/* Post the event, if desired */ /* Post the event, if desired */
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) { if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) {
SDL_Event event; SDL_Event event;
event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE; event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE;
+1 -1
View File
@@ -28,7 +28,7 @@
#include "SDL_mfijoystick_c.h" #include "SDL_mfijoystick_c.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
#endif #endif
+4 -4
View File
@@ -24,7 +24,7 @@
#include "SDL_syssensor.h" #include "SDL_syssensor.h"
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"
#endif #endif
@@ -71,7 +71,7 @@ int SDL_InitSensors(void)
SDL_sensor_lock = SDL_CreateMutex(); SDL_sensor_lock = SDL_CreateMutex();
} }
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
return -1; return -1;
} }
@@ -464,7 +464,7 @@ void SDL_QuitSensors(void)
SDL_UnlockSensors(); SDL_UnlockSensors();
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
SDL_QuitSubSystem(SDL_INIT_EVENTS); SDL_QuitSubSystem(SDL_INIT_EVENTS);
#endif #endif
@@ -488,7 +488,7 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
#if !SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) { if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) {
SDL_Event event; SDL_Event event;
event.type = SDL_EVENT_SENSOR_UPDATE; event.type = SDL_EVENT_SENSOR_UPDATE;