cmake: fix uses of undefined macro identifiers (-Wundef)

This commit is contained in:
Anonymous Maarten authored and GitHub committed 2023-11-17 03:06:26 +00:00
1 parent cc7c0a2dab
commit d81d986858
430 files changed
+1289 -1260

No files matched your search

+4 -4
View File
@@ -119,7 +119,7 @@ SDL_TLSData *SDL_Generic_GetTLSData(void)
SDL_TLSEntry *entry;
SDL_TLSData *storage = NULL;
#if !SDL_THREADS_DISABLED
#ifndef SDL_THREADS_DISABLED
if (!SDL_generic_TLS_mutex) {
static SDL_SpinLock tls_lock;
SDL_AtomicLock(&tls_lock);
@@ -144,7 +144,7 @@ SDL_TLSData *SDL_Generic_GetTLSData(void)
break;
}
}
#if !SDL_THREADS_DISABLED
#ifndef SDL_THREADS_DISABLED
SDL_UnlockMutex(SDL_generic_TLS_mutex);
#endif
@@ -202,7 +202,7 @@ static SDL_error *SDL_GetStaticErrBuf()
return &SDL_global_error;
}
#if !SDL_THREADS_DISABLED
#ifndef SDL_THREADS_DISABLED
static void SDLCALL SDL_FreeErrBuf(void *data)
{
SDL_error *errbuf = (SDL_error *)data;
@@ -217,7 +217,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data)
/* Routine to get the thread-specific error variable */
SDL_error *SDL_GetErrBuf(void)
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return SDL_GetStaticErrBuf();
#else
static SDL_SpinLock tls_lock;
+10 -10
View File
@@ -26,25 +26,25 @@
#include "SDL_thread.h"
/* Need the definitions of SYS_ThreadHandle */
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
#include "generic/SDL_systhread_c.h"
#elif SDL_THREAD_PTHREAD
#elif defined(SDL_THREAD_PTHREAD)
#include "pthread/SDL_systhread_c.h"
#elif SDL_THREAD_WINDOWS
#elif defined(SDL_THREAD_WINDOWS)
#include "windows/SDL_systhread_c.h"
#elif SDL_THREAD_PS2
#elif defined(SDL_THREAD_PS2)
#include "ps2/SDL_systhread_c.h"
#elif SDL_THREAD_PSP
#elif defined(SDL_THREAD_PSP)
#include "psp/SDL_systhread_c.h"
#elif SDL_THREAD_VITA
#elif defined(SDL_THREAD_VITA)
#include "vita/SDL_systhread_c.h"
#elif SDL_THREAD_N3DS
#elif defined(SDL_THREAD_N3DS)
#include "n3ds/SDL_systhread_c.h"
#elif SDL_THREAD_STDCPP
#elif defined(SDL_THREAD_STDCPP)
#include "stdcpp/SDL_systhread_c.h"
#elif SDL_THREAD_OS2
#elif defined(SDL_THREAD_OS2)
#include "os2/SDL_systhread_c.h"
#elif SDL_THREAD_NGAGE
#elif defined(SDL_THREAD_NGAGE)
#include "ngage/SDL_systhread_c.h"
#else
#error Need thread implementation for this platform
+1 -1
View File
@@ -34,7 +34,7 @@
* will be chosen at runtime), the function names need to be
* suffixed
*/
#if !SDL_THREAD_GENERIC_COND_SUFFIX
#ifndef SDL_THREAD_GENERIC_COND_SUFFIX
#define SDL_CreateCond_generic SDL_CreateCond
#define SDL_DestroyCond_generic SDL_DestroyCond
#define SDL_CondSignal_generic SDL_CondSignal
+1 -1
View File
@@ -25,7 +25,7 @@
#ifndef SDL_syscond_generic_h_
#define SDL_syscond_generic_h_
#if SDL_THREAD_GENERIC_COND_SUFFIX
#ifdef SDL_THREAD_GENERIC_COND_SUFFIX
SDL_cond *SDL_CreateCond_generic(void);
void SDL_DestroyCond_generic(SDL_cond *cond);
+4 -4
View File
@@ -40,7 +40,7 @@ SDL_mutex *SDL_CreateMutex(void)
/* Allocate mutex memory */
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
#if !SDL_THREADS_DISABLED
#ifndef SDL_THREADS_DISABLED
if (mutex) {
/* Create the mutex semaphore, with initial value 1 */
mutex->sem = SDL_CreateSemaphore(1);
@@ -72,7 +72,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 SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SDL_threadID this_thread;
@@ -101,7 +101,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
/* try Lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
int retval = 0;
@@ -133,7 +133,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
if (mutex == NULL) {
+1 -1
View File
@@ -26,7 +26,7 @@
#include "SDL_thread.h"
#include "SDL_systhread_c.h"
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
{
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_NGAGE
#ifdef SDL_THREAD_NGAGE
/* N-Gage thread management routines for SDL */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#ifdef SDL_THREAD_OS2
/* An implementation of mutexes for OS/2 */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#ifdef SDL_THREAD_OS2
/* An implementation of semaphores for OS/2 */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#ifdef SDL_THREAD_OS2
/* Thread management routines for SDL */
+1 -1
View File
@@ -21,7 +21,7 @@
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#ifdef SDL_THREAD_OS2
#include "../../core/os2/SDL_os2.h"
+1 -1
View File
@@ -21,7 +21,7 @@
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#ifdef SDL_THREAD_OS2
#include "../SDL_thread_c.h"
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_PS2
#ifdef SDL_THREAD_PS2
/* Semaphore functions for the PS2. */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_PS2
#ifdef SDL_THREAD_PS2
/* PS2 thread management routines for SDL */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_PSP
#ifdef SDL_THREAD_PSP
/* An implementation of condition variables using semaphores and mutexes */
/*
+4 -4
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_PSP
#ifdef SDL_THREAD_PSP
/* An implementation of mutexes using semaphores */
@@ -75,7 +75,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 SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SceInt32 res = 0;
@@ -96,7 +96,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
/* Try to lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SceInt32 res = 0;
@@ -125,7 +125,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SceInt32 res = 0;
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_PSP
#ifdef SDL_THREAD_PSP
/* Semaphore functions for the PSP. */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_PSP
#ifdef SDL_THREAD_PSP
/* PSP thread management routines for SDL */
+11 -11
View File
@@ -25,15 +25,15 @@
#include "SDL_thread.h"
#if !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX && \
!SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
#define FAKE_RECURSIVE_MUTEX 1
#if !(defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX) || \
defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP))
#define FAKE_RECURSIVE_MUTEX
#endif
struct SDL_mutex
{
pthread_mutex_t id;
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
int recursive;
pthread_t owner;
#endif
@@ -48,9 +48,9 @@ SDL_mutex *SDL_CreateMutex(void)
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
if (mutex) {
pthread_mutexattr_init(&attr);
#if SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
#ifdef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#elif SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
#elif defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#else
/* No extra attributes necessary */
@@ -77,7 +77,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
@@ -85,7 +85,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;
@@ -113,7 +113,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
{
int retval;
int result;
#if FAKE_RECURSIVE_MUTEX
#ifdef FAKE_RECURSIVE_MUTEX
pthread_t this_thread;
#endif
@@ -122,7 +122,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;
@@ -160,7 +160,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) {
+5 -5
View File
@@ -25,7 +25,7 @@
#include <pthread.h>
#if HAVE_PTHREAD_NP_H
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
@@ -141,7 +141,7 @@ void SDL_SYS_SetupThread(const char *name)
}
#endif
}
#elif HAVE_PTHREAD_SETNAME_NP
#elif defined(HAVE_PTHREAD_SETNAME_NP)
#if defined(__NETBSD__)
pthread_setname_np(pthread_self(), "%s", name);
#else
@@ -151,7 +151,7 @@ void SDL_SYS_SetupThread(const char *name)
pthread_setname_np(pthread_self(), namebuf);
}
#endif
#elif HAVE_PTHREAD_SET_NAME_NP
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
pthread_set_name_np(pthread_self(), name);
#elif defined(__HAIKU__)
/* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
@@ -188,7 +188,7 @@ SDL_threadID SDL_ThreadID(void)
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
#if __NACL__ || __RISCOS__ || __OS2__
#if defined(__NACL__) || defined(__RISCOS__) || defined(__OS2__)
/* FIXME: Setting thread priority does not seem to be supported in NACL */
return 0;
#else
@@ -246,7 +246,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
policy = pri_policy;
}
#if __LINUX__
#ifdef __LINUX__
{
pid_t linuxTid = syscall(SYS_gettid);
return SDL_LinuxSetThreadPriorityAndPolicy(linuxTid, priority, policy);
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_VITA
#ifdef SDL_THREAD_VITA
/* An implementation of condition variables using semaphores and mutexes */
/*
+4 -4
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_VITA
#ifdef SDL_THREAD_VITA
#include "SDL_thread.h"
#include "SDL_systhread_c.h"
@@ -71,7 +71,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 SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SceInt32 res = 0;
@@ -92,7 +92,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
/* Try to lock the mutex */
int SDL_TryLockMutex(SDL_mutex *mutex)
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SceInt32 res = 0;
@@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
/* Unlock the mutex */
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
{
#if SDL_THREADS_DISABLED
#ifdef SDL_THREADS_DISABLED
return 0;
#else
SceInt32 res = 0;
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_VITA
#ifdef SDL_THREAD_VITA
/* Semaphore functions for the VITA. */
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_VITA
#ifdef SDL_THREAD_VITA
/* VITA thread management routines for SDL */
+2 -2
View File
@@ -61,7 +61,7 @@ typedef struct CONDITION_VARIABLE
} CONDITION_VARIABLE, *PCONDITION_VARIABLE;
#endif
#if __WINRT__
#ifdef __WINRT__
#define pWakeConditionVariable WakeConditionVariable
#define pWakeAllConditionVariable WakeAllConditionVariable
#define pSleepConditionVariableSRW SleepConditionVariableSRW
@@ -235,7 +235,7 @@ SDL_cond *SDL_CreateCond(void)
SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID);
}
#if __WINRT__
#ifdef __WINRT__
/* Link statically on this platform */
impl = &SDL_cond_impl_cv;
#else
+4 -4
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_WINDOWS
#ifdef SDL_THREAD_WINDOWS
/**
* Mutex functions using the Win32 API
@@ -42,7 +42,7 @@ SDL_mutex_impl_t SDL_mutex_impl_active = { 0 };
* Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer.
*/
#if __WINRT__
#ifdef __WINRT__
/* Functions are guaranteed to be available */
#define pReleaseSRWLockExclusive ReleaseSRWLockExclusive
#define pAcquireSRWLockExclusive AcquireSRWLockExclusive
@@ -156,7 +156,7 @@ static SDL_mutex *SDL_CreateMutex_cs(void)
if (mutex) {
/* Initialize */
/* On SMP systems, a non-zero spin count generally helps performance */
#if __WINRT__
#ifdef __WINRT__
InitializeCriticalSectionEx(&mutex->cs, 2000, 0);
#else
InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
@@ -226,7 +226,7 @@ SDL_mutex *SDL_CreateMutex(void)
const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs;
if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, SDL_FALSE)) {
#if __WINRT__
#ifdef __WINRT__
/* Link statically on this platform */
impl = &SDL_mutex_impl_srw;
#else
+4 -10
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_WINDOWS
#ifdef SDL_THREAD_WINDOWS
/**
* Semaphore functions using the Win32 API
@@ -68,14 +68,8 @@ static SDL_sem_impl_t SDL_sem_impl_active = { 0 };
/* APIs not available on WinPhone 8.1 */
/* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */
#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0
#endif
#if !SDL_WINAPI_FAMILY_PHONE
#if __WINRT__
#ifdef __WINRT__
/* Functions are guaranteed to be available */
#define pWaitOnAddress WaitOnAddress
#define pWakeByAddressSingle WakeByAddressSingle
@@ -263,7 +257,7 @@ static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value)
sem = (SDL_sem_kern *)SDL_malloc(sizeof(*sem));
if (sem) {
/* Create the semaphore, with max value 32K */
#if __WINRT__
#ifdef __WINRT__
sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
#else
sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
@@ -385,7 +379,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
#if !SDL_WINAPI_FAMILY_PHONE
if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) {
#if __WINRT__
#ifdef __WINRT__
/* Link statically on this platform */
impl = &SDL_sem_impl_atom;
#else
+1 -1
View File
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_WINDOWS
#ifdef SDL_THREAD_WINDOWS
/* Win32 thread management routines for SDL */
+1 -1
View File
@@ -21,7 +21,7 @@
#include "../../SDL_internal.h"
#if SDL_THREAD_WINDOWS
#ifdef SDL_THREAD_WINDOWS
#include "../../core/windows/SDL_windows.h"