From 9b817248c52a1e5c79e318dde210c52760fc6b61 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 8 Feb 2022 18:50:02 +0300
Subject: [PATCH] SDL_spinlock.c: define HAVE_GCC_ATOMICS for windows/clang
builds,
... if not already defined.
Fixes https://github.com/libsdl-org/SDL/issues/5333
diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index bdd347e..4f10741 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -28,6 +28,12 @@
#include "SDL_mutex.h"
#include "SDL_timer.h"
+#if defined(__WIN32__) && defined(__clang__)
+# ifndef HAVE_GCC_ATOMICS
+# define HAVE_GCC_ATOMICS 1
+# endif
+#endif
+
#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
#include <atomic.h>
#endif
---
src/atomic/SDL_spinlock.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index bdd347e413e..4f10741c7c2 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -28,6 +28,12 @@
#include "SDL_mutex.h"
#include "SDL_timer.h"
+#if defined(__WIN32__) && defined(__clang__)
+# ifndef HAVE_GCC_ATOMICS
+# define HAVE_GCC_ATOMICS 1
+# endif
+#endif
+
#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
#include <atomic.h>
#endif