From a1907d612d23db034b3e611293cf31a991be2502 Mon Sep 17 00:00:00 2001 From: Diana Perez Afanador Date: Wed, 6 Jul 2022 06:34:17 +0200 Subject: [PATCH] Fix WatchOS simulator not supporting thread_local (#5341) * Add conditional for architecture ARM64 and i386 on WatchOS for `thread_local` * Use the correct check for if thread-local storage is supported Co-authored-by: Thomas Goyne --- CHANGELOG.md | 1 + src/realm/impl/simulated_failure.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e049aab8db..3ff6af702ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Fix exception when decoding interned strings in realm-apply-to-state tool. ([#5628](https://github.com/realm/realm-core/pull/5628)) * Fix some warnings when building with Xcode 14 ([PR #5577](https://github.com/realm/realm-core/pull/5577)). * Throw `runtime_error` if subscription set is requested and flexible sync is not enabled. ([#5637](https://github.com/realm/realm-core/pull/5637)) +* Fix compilation failures on watchOS platforms which do not support thread-local storage. ([#7694](https://github.com/realm/realm-swift/issues/7694), [#7695](https://github.com/realm/realm-swift/issues/7695) since v11.7.0) ### Breaking changes * None. diff --git a/src/realm/impl/simulated_failure.cpp b/src/realm/impl/simulated_failure.cpp index 8e5bc1f548a..ce3b0576d6e 100644 --- a/src/realm/impl/simulated_failure.cpp +++ b/src/realm/impl/simulated_failure.cpp @@ -175,11 +175,10 @@ bool SimulatedFailure::do_check_trigger(FailureType failure_type) noexcept return false; } -#if (REALM_ARCHITECTURE_X86_32 && REALM_IOS) || (REALM_ARCHITECTURE_X86_64 && REALM_WATCHOS) -bool (*s_mmap_predicate)(size_t); -#else -thread_local bool (*s_mmap_predicate)(size_t); -#endif // REALM_ARCHITECTURE_X86_32 && REALM_IOS +#if !defined(__clang__) || REALM_HAVE_CLANG_FEATURE(cxx_thread_local) +thread_local +#endif + bool (*s_mmap_predicate)(size_t); void SimulatedFailure::do_prime_mmap(bool (*predicate)(size_t)) {