SDL: atomic: Switch to _SDL_HAS_BUILTIN to detect __atomic_load_n

From cf5f7965df3a40aa673451d149c24b462852d1d3 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Tue, 14 Apr 2026 17:42:24 -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 bde7939ea8e37..dd90a6b2196fe 100644
--- a/src/atomic/SDL_atomic.c
+++ b/src/atomic/SDL_atomic.c
@@ -36,19 +36,15 @@
 #endif
 
 /* The __atomic_load_n() intrinsic showed up in different times for different compilers. */
-#if defined(__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. */
 #if !defined(__ANDROID__)
 #define HAVE_ATOMIC_LOAD_N 1
 #endif
 #endif
-#elif defined(__GNUC__)
-#if (__GNUC__ >= 5)
-#define HAVE_ATOMIC_LOAD_N 1
-#endif
-#endif
 
 /* *INDENT-OFF* */ /* clang-format off */
 #if defined(__WATCOMC__) && defined(__386__)