From dba9aa147cb7b3d619581726bd1937a42faf342b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 12 Apr 2026 14:43:52 -0500 Subject: [PATCH] atomic: Switch to SDL_HAS_BUILTIN to detect __atomic_load_n --- src/atomic/SDL_atomic.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 40d57929ae..0cd67ef936 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -34,19 +34,15 @@ #endif // The __atomic_load_n() intrinsic showed up in different times for different compilers. -#ifdef __clang__ -#if __has_builtin(__atomic_load_n) || defined(HAVE_GCC_ATOMICS) +#if defined(__GNUC__) && (__GNUC__ >= 5) +#define HAVE_ATOMIC_LOAD_N 1 +#elif SDL_HAS_BUILTIN(__atomic_load_n) || (defined(__clang__) && defined(HAVE_GCC_ATOMICS)) /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have. It might be in a later NDK or we might need an extra library? --ryan. */ #ifndef SDL_PLATFORM_ANDROID #define HAVE_ATOMIC_LOAD_N 1 #endif #endif -#elif defined(__GNUC__) -#if (__GNUC__ >= 5) -#define HAVE_ATOMIC_LOAD_N 1 -#endif -#endif /* If any of the operations are not provided then we must emulate some