1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
From: Alessio Treglia <alessio@debian.org>
Date: Fri, 7 Oct 2022 10:27:57 +0200
Subject: Definte generic atomic function to prevent FTBFS on most
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=725611
Forwarded: rncbc@rncbc.org
architectures.
Forwarded: rncbc@rncbc.org
---
src/qtractorAtomic.h | 40 ++++++++++++----------------------------
1 file changed, 12 insertions(+), 28 deletions(-)
diff --git a/src/qtractorAtomic.h b/src/qtractorAtomic.h
index de51f13..71b8733 100644
--- a/src/qtractorAtomic.h
+++ b/src/qtractorAtomic.h
@@ -63,33 +63,7 @@ static inline int ATOMIC_CAS ( qtractorAtomic *pVal,
#if defined(__GNUC__)
-#if defined(__powerpc__) || defined(__powerpc64__)
-
-static inline int ATOMIC_CAS1 (
- volatile int *pValue, int iOldValue, int iNewValue )
-{
- register int result;
- asm volatile (
- "# ATOMIC_CAS1 \n"
- " lwarx r0, 0, %1 \n"
- " cmpw r0, %2 \n"
- " bne- 1f \n"
- " sync \n"
- " stwcx. %3, 0, %1 \n"
- " bne- 1f \n"
- " li %0, 1 \n"
- " b 2f \n"
- "1: \n"
- " li %0, 0 \n"
- "2: \n"
- : "=r" (result)
- : "r" (pValue), "r" (iOldValue), "r" (iNewValue)
- : "r0"
- );
- return result;
-}
-
-#elif defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__)
static inline int ATOMIC_CAS1 (
volatile int *pValue, int iOldValue, int iNewValue )
@@ -107,7 +81,17 @@ static inline int ATOMIC_CAS1 (
}
#else
-# error "qtractorAtomic.h: unsupported target compiler processor (GNUC)."
+
+#if QT_VERSION < 0x040400
+
+static inline int ATOMIC_CAS1 (
+ volatile int *pAddr, int iOldValue, int iNewValue )
+{
+ return q_atomic_test_and_set_int(pAddr, iOldValue, iNewValue);
+}
+
+#endif
+
#endif
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
|