Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX

This commit is contained in:
Anonymous Maarten
2023-03-27 18:43:22 +02:00
parent 74209d4452
commit 87aec3429b

View File

@@ -31,7 +31,7 @@
struct SDL_mutex
{
pthread_mutex_t id;
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
int recursive;
pthread_t owner;
#endif
@@ -76,7 +76,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
/* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
pthread_t this_thread;
#endif
@@ -84,7 +84,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
return 0;
}
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
this_thread = pthread_self();
if (mutex->owner == this_thread) {
++mutex->recursive;
@@ -112,7 +112,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
{
int retval;
int result;
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
pthread_t this_thread;
#endif
@@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
}
retval = 0;
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
this_thread = pthread_self();
if (mutex->owner == this_thread) {
++mutex->recursive;
@@ -159,7 +159,7 @@ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doe
return 0;
}
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
/* We can only unlock the mutex if we own it */
if (pthread_self() == mutex->owner) {
if (mutex->recursive) {