Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX

This commit is contained in:
Anonymous Maarten committed 2023-03-28 19:29:44 +02:00
1 parent 74209d4452
commit 87aec3429b
1 file changed
+6 -6
+6 -6
View File
@@ -31,7 +31,7 @@
struct SDL_mutex struct SDL_mutex
{ {
pthread_mutex_t id; pthread_mutex_t id;
#if FAKE_RECURSIVE_MUTEX #ifdef FAKE_RECURSIVE_MUTEX
int recursive; int recursive;
pthread_t owner; pthread_t owner;
#endif #endif
@@ -76,7 +76,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
/* Lock the mutex */ /* Lock the mutex */
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ 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; pthread_t this_thread;
#endif #endif
@@ -84,7 +84,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
return 0; return 0;
} }
#if FAKE_RECURSIVE_MUTEX #ifdef FAKE_RECURSIVE_MUTEX
this_thread = pthread_self(); this_thread = pthread_self();
if (mutex->owner == this_thread) { if (mutex->owner == this_thread) {
++mutex->recursive; ++mutex->recursive;
@@ -112,7 +112,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
{ {
int retval; int retval;
int result; int result;
#if FAKE_RECURSIVE_MUTEX #ifdef FAKE_RECURSIVE_MUTEX
pthread_t this_thread; pthread_t this_thread;
#endif #endif
@@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
} }
retval = 0; retval = 0;
#if FAKE_RECURSIVE_MUTEX #ifdef FAKE_RECURSIVE_MUTEX
this_thread = pthread_self(); this_thread = pthread_self();
if (mutex->owner == this_thread) { if (mutex->owner == this_thread) {
++mutex->recursive; ++mutex->recursive;
@@ -159,7 +159,7 @@ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doe
return 0; return 0;
} }
#if FAKE_RECURSIVE_MUTEX #ifdef FAKE_RECURSIVE_MUTEX
/* We can only unlock the mutex if we own it */ /* We can only unlock the mutex if we own it */
if (pthread_self() == mutex->owner) { if (pthread_self() == mutex->owner) {
if (mutex->recursive) { if (mutex->recursive) {