Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL

This commit is contained in:
Anonymous Maarten committed 2023-03-28 19:29:44 +02:00
1 parent 99095a89f1
commit bc160b55fe
2 files changed
+8 -8

No files matched your search

+7 -7
View File
@@ -44,7 +44,7 @@
#include <tlhelp32.h> #include <tlhelp32.h>
#endif #endif
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
#include "./virtual/SDL_virtualjoystick_c.h" #include "./virtual/SDL_virtualjoystick_c.h"
#endif #endif
@@ -631,7 +631,7 @@ SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int n
SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc) SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
{ {
#if SDL_JOYSTICK_VIRTUAL #if defined(SDL_JOYSTICK_VIRTUAL)
SDL_JoystickID retval; SDL_JoystickID retval;
SDL_LockJoysticks(); SDL_LockJoysticks();
@@ -645,7 +645,7 @@ SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id) int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
{ {
#if SDL_JOYSTICK_VIRTUAL #if defined(SDL_JOYSTICK_VIRTUAL)
int retval; int retval;
SDL_LockJoysticks(); SDL_LockJoysticks();
@@ -659,7 +659,7 @@ int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id) SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id)
{ {
#if SDL_JOYSTICK_VIRTUAL #if defined(SDL_JOYSTICK_VIRTUAL)
SDL_JoystickDriver *driver; SDL_JoystickDriver *driver;
int device_index; int device_index;
SDL_bool is_virtual = SDL_FALSE; SDL_bool is_virtual = SDL_FALSE;
@@ -686,7 +686,7 @@ int SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value)
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL #if defined(SDL_JOYSTICK_VIRTUAL)
retval = SDL_SetJoystickVirtualAxisInner(joystick, axis, value); retval = SDL_SetJoystickVirtualAxisInner(joystick, axis, value);
#else #else
retval = SDL_SetError("SDL not built with virtual-joystick support"); retval = SDL_SetError("SDL not built with virtual-joystick support");
@@ -705,7 +705,7 @@ int SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL #if defined(SDL_JOYSTICK_VIRTUAL)
retval = SDL_SetJoystickVirtualButtonInner(joystick, button, value); retval = SDL_SetJoystickVirtualButtonInner(joystick, button, value);
#else #else
retval = SDL_SetError("SDL not built with virtual-joystick support"); retval = SDL_SetError("SDL not built with virtual-joystick support");
@@ -724,7 +724,7 @@ int SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value)
{ {
CHECK_JOYSTICK_MAGIC(joystick, -1); CHECK_JOYSTICK_MAGIC(joystick, -1);
#if SDL_JOYSTICK_VIRTUAL #if defined(SDL_JOYSTICK_VIRTUAL)
retval = SDL_SetJoystickVirtualHatInner(joystick, hat, value); retval = SDL_SetJoystickVirtualHatInner(joystick, hat, value);
#else #else
retval = SDL_SetError("SDL not built with virtual-joystick support"); retval = SDL_SetError("SDL not built with virtual-joystick support");
+1 -1
View File
@@ -23,7 +23,7 @@
#ifndef SDL_VIRTUALJOYSTICK_C_H #ifndef SDL_VIRTUALJOYSTICK_C_H
#define SDL_VIRTUALJOYSTICK_C_H #define SDL_VIRTUALJOYSTICK_C_H
#if SDL_JOYSTICK_VIRTUAL #ifdef SDL_JOYSTICK_VIRTUAL
/** /**
* Data for a virtual, software-only joystick. * Data for a virtual, software-only joystick.