[Fontconfig] fontconfig: Branch 'main'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 19 12:36:21 UTC 2021


 src/fcatomic.h |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 3a7ad1b49f727eef20b3e3918794d984e367b619
Author: Ryan Schmidt <git at ryandesign.com>
Date:   Thu Jul 8 16:17:44 2021 -0500

    Restore fcatomic compatibility with Mac OS X 10.4.
    
    Reverts the part of 6def66164a36eed968aae872d76acfac3173d44a that
    removed the fc_atomic_ptr_cmpexch compatibility code for systems earlier
    than Mac OS X 10.5.
    
    Reverts the part of 447b9ccc7d03bf953d1f1c4708ca16c56c1511ec that moved
    the definition of fc_atomic_ptr_get into the Mac OS X > 10.4 block. That
    code is still needed on 10.4 and is implemented using functions that are
    available on 10.4.
    
    Compare against MAC_OS_X_VERSION_MIN_REQUIRED using a number not a
    constant because the constant is not available on earlier SDKs.

diff --git a/src/fcatomic.h b/src/fcatomic.h
index 27bf6ca..9f56b3d 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -72,8 +72,6 @@ typedef int fc_atomic_int_t;
 #define FC_ATOMIC_INT_FORMAT		"d"
 #define fc_atomic_int_add(AI, V)	(OSAtomicAdd32Barrier ((V), &(AI)) - (V))
 
-#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 20100)
-
 #if SIZEOF_VOID_P == 8
 #define fc_atomic_ptr_get(P)		OSAtomicAdd64Barrier (0, (int64_t*)(P))
 #elif SIZEOF_VOID_P == 4
@@ -81,10 +79,15 @@ typedef int fc_atomic_int_t;
 #else
 #error "SIZEOF_VOID_P not 4 or 8 (assumes CHAR_BIT is 8)"
 #endif
-#define fc_atomic_ptr_cmpexch(P,O,N)	OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
 
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 20100)
+#define fc_atomic_ptr_cmpexch(P,O,N)	OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
 #else
-#error "Your macOS / iOS targets are too old"
+#if __LP64__
+#define fc_atomic_ptr_cmpexch(P,O,N)	OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t *) (P))
+#else
+#define fc_atomic_ptr_cmpexch(P,O,N)	OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t *) (P))
+#endif
 #endif
 
 


More information about the Fontconfig mailing list