Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED
This commit is contained in:
1 parent
93b357a0d2
commit
0c161c1435
10 files changed
+23
-23
No files matched your search
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
|
|
||||||
#if !SDL_THREADS_DISABLED
|
#ifndef SDL_THREADS_DISABLED
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -251,7 +251,7 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority)
|
|||||||
/* this is a public symbol, so it has to exist even if threads are disabled. */
|
/* this is a public symbol, so it has to exist even if threads are disabled. */
|
||||||
int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#ifdef SDL_THREADS_DISABLED
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
#else
|
#else
|
||||||
if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) {
|
if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) {
|
||||||
@@ -283,7 +283,7 @@ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
|
|||||||
/* this is a public symbol, so it has to exist even if threads are disabled. */
|
/* this is a public symbol, so it has to exist even if threads are disabled. */
|
||||||
int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy)
|
int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy)
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#ifdef SDL_THREADS_DISABLED
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
#else
|
#else
|
||||||
int osPriority;
|
int osPriority;
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ int SDL_StartEventLoop(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Create the lock and set ourselves active */
|
/* Create the lock and set ourselves active */
|
||||||
#if !SDL_THREADS_DISABLED
|
#ifndef SDL_THREADS_DISABLED
|
||||||
if (!SDL_EventQ.lock) {
|
if (!SDL_EventQ.lock) {
|
||||||
SDL_EventQ.lock = SDL_CreateMutex();
|
SDL_EventQ.lock = SDL_CreateMutex();
|
||||||
if (SDL_EventQ.lock == NULL) {
|
if (SDL_EventQ.lock == NULL) {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ SDL_Generic_GetTLSData(void)
|
|||||||
SDL_TLSEntry *entry;
|
SDL_TLSEntry *entry;
|
||||||
SDL_TLSData *storage = NULL;
|
SDL_TLSData *storage = NULL;
|
||||||
|
|
||||||
#if !SDL_THREADS_DISABLED
|
#ifndef SDL_THREADS_DISABLED
|
||||||
if (SDL_generic_TLS_mutex == NULL) {
|
if (SDL_generic_TLS_mutex == NULL) {
|
||||||
static SDL_SpinLock tls_lock;
|
static SDL_SpinLock tls_lock;
|
||||||
SDL_AtomicLock(&tls_lock);
|
SDL_AtomicLock(&tls_lock);
|
||||||
@@ -145,7 +145,7 @@ SDL_Generic_GetTLSData(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !SDL_THREADS_DISABLED
|
#ifndef SDL_THREADS_DISABLED
|
||||||
SDL_UnlockMutex(SDL_generic_TLS_mutex);
|
SDL_UnlockMutex(SDL_generic_TLS_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ static SDL_error *SDL_GetStaticErrBuf(void)
|
|||||||
return &SDL_global_error;
|
return &SDL_global_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !SDL_THREADS_DISABLED
|
#ifndef SDL_THREADS_DISABLED
|
||||||
static void SDLCALL SDL_FreeErrBuf(void *data)
|
static void SDLCALL SDL_FreeErrBuf(void *data)
|
||||||
{
|
{
|
||||||
SDL_error *errbuf = (SDL_error *)data;
|
SDL_error *errbuf = (SDL_error *)data;
|
||||||
@@ -219,7 +219,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data)
|
|||||||
SDL_error *
|
SDL_error *
|
||||||
SDL_GetErrBuf(void)
|
SDL_GetErrBuf(void)
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return SDL_GetStaticErrBuf();
|
return SDL_GetStaticErrBuf();
|
||||||
#else
|
#else
|
||||||
static SDL_SpinLock tls_lock;
|
static SDL_SpinLock tls_lock;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#define SDL_thread_c_h_
|
#define SDL_thread_c_h_
|
||||||
|
|
||||||
/* Need the definitions of SYS_ThreadHandle */
|
/* Need the definitions of SYS_ThreadHandle */
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
#include "generic/SDL_systhread_c.h"
|
#include "generic/SDL_systhread_c.h"
|
||||||
#elif SDL_THREAD_PTHREAD
|
#elif SDL_THREAD_PTHREAD
|
||||||
#include "pthread/SDL_systhread_c.h"
|
#include "pthread/SDL_systhread_c.h"
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ SDL_CreateMutex(void)
|
|||||||
/* Allocate mutex memory */
|
/* Allocate mutex memory */
|
||||||
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
|
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
|
||||||
|
|
||||||
#if !SDL_THREADS_DISABLED
|
#ifndef SDL_THREADS_DISABLED
|
||||||
if (mutex) {
|
if (mutex) {
|
||||||
/* Create the mutex semaphore, with initial value 1 */
|
/* Create the mutex semaphore, with initial value 1 */
|
||||||
mutex->sem = SDL_CreateSemaphore(1);
|
mutex->sem = SDL_CreateSemaphore(1);
|
||||||
@@ -72,7 +72,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 SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SDL_threadID this_thread;
|
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 */
|
/* try Lock the mutex */
|
||||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
@@ -133,7 +133,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
|||||||
/* Unlock the mutex */
|
/* Unlock the mutex */
|
||||||
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
if (mutex == NULL) {
|
if (mutex == NULL) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "SDL_systhread_c.h"
|
#include "SDL_systhread_c.h"
|
||||||
|
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
|
|
||||||
SDL_sem *
|
SDL_sem *
|
||||||
SDL_CreateSemaphore(Uint32 initial_value)
|
SDL_CreateSemaphore(Uint32 initial_value)
|
||||||
|
|||||||
@@ -75,7 +75,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 SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SceInt32 res = 0;
|
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 */
|
/* Try to lock the mutex */
|
||||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SceInt32 res = 0;
|
SceInt32 res = 0;
|
||||||
@@ -125,7 +125,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
|||||||
/* Unlock the mutex */
|
/* Unlock the mutex */
|
||||||
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SceInt32 res = 0;
|
SceInt32 res = 0;
|
||||||
|
|||||||
@@ -71,7 +71,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 SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SceInt32 res = 0;
|
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 */
|
/* Try to lock the mutex */
|
||||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SceInt32 res = 0;
|
SceInt32 res = 0;
|
||||||
@@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
|||||||
/* Unlock the mutex */
|
/* Unlock the mutex */
|
||||||
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||||
{
|
{
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
SceInt32 res = 0;
|
SceInt32 res = 0;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
/* #define DEBUG_TIMERS */
|
/* #define DEBUG_TIMERS */
|
||||||
|
|
||||||
#if !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED
|
#if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED)
|
||||||
|
|
||||||
typedef struct SDL_Timer
|
typedef struct SDL_Timer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
|
|||||||
sigemptyset(&sig_set);
|
sigemptyset(&sig_set);
|
||||||
sigaddset(&sig_set, SIGPIPE);
|
sigaddset(&sig_set, SIGPIPE);
|
||||||
|
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set);
|
sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set);
|
||||||
#else
|
#else
|
||||||
pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set);
|
pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set);
|
||||||
@@ -76,7 +76,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
|
|||||||
|
|
||||||
sigtimedwait(&sig_set, 0, &zerotime);
|
sigtimedwait(&sig_set, 0, &zerotime);
|
||||||
|
|
||||||
#if SDL_THREADS_DISABLED
|
#if defined(SDL_THREADS_DISABLED)
|
||||||
sigprocmask(SIG_SETMASK, &old_sig_set, NULL);
|
sigprocmask(SIG_SETMASK, &old_sig_set, NULL);
|
||||||
#else
|
#else
|
||||||
pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL);
|
pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL);
|
||||||
|
|||||||
Reference in new issue
Block a user