From e480d9de96113e84355e93279d21c24248c3377f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 3 Apr 2025 21:44:23 -0600 Subject: [PATCH 1/3] Do our C++11 atomics build anywhere?? --- src/hb-atomic.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index e92ccbca1..8b4ecb8fc 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -50,7 +50,7 @@ /* Defined externally, i.e. in config.h. */ -#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) +#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) && 0 /* C++11-style GCC primitives. We prefer these as they don't require linking to libstdc++ / libc++. */ From e404cf086041c3feeccdfd400201d76840b8e1c6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 3 Apr 2025 21:57:15 -0600 Subject: [PATCH 2/3] [atomic] Fix C++11 implementation Surprised no one has been using it. --- src/hb-atomic.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 8b4ecb8fc..403c8569a 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -84,11 +84,11 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) #define _hb_memory_r_barrier() std::atomic_thread_fence(std::memory_order_acquire) #define _hb_memory_w_barrier() std::atomic_thread_fence(std::memory_order_release) -#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast::type> *> (AI)->fetch_add ((V), std::memory_order_acq_rel)) -#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast::type> *> (AI)->store ((V), std::memory_order_relaxed)) -#define hb_atomic_int_impl_set(AI, V) (reinterpret_cast::type> *> (AI)->store ((V), std::memory_order_release)) -#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast::type> const *> (AI)->load (std::memory_order_relaxed)) -#define hb_atomic_int_impl_get(AI) (reinterpret_cast::type> const *> (AI)->load (std::memory_order_acquire)) +#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast::type> *> (AI)->fetch_add ((V), std::memory_order_acq_rel)) +#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast::type> *> (AI)->store ((V), std::memory_order_relaxed)) +#define hb_atomic_int_impl_set(AI, V) (reinterpret_cast::type> *> (AI)->store ((V), std::memory_order_release)) +#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast::type> const *> (AI)->load (std::memory_order_relaxed)) +#define hb_atomic_int_impl_get(AI) (reinterpret_cast::type> const *> (AI)->load (std::memory_order_acquire)) #define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast *> (P)->store ((V), std::memory_order_relaxed)) #define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast const *> (P)->load (std::memory_order_relaxed)) From e10d647a732d065a3722bb8d8cd0be8e8791ca0e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 3 Apr 2025 22:01:37 -0600 Subject: [PATCH 3/3] [atomic] Re-enable intrinsics implementation --- src/hb-atomic.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 403c8569a..de57cb475 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -50,7 +50,7 @@ /* Defined externally, i.e. in config.h. */ -#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) && 0 +#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) /* C++11-style GCC primitives. We prefer these as they don't require linking to libstdc++ / libc++. */