From 74b8fca9e4c609b4e9890b2daf6e2ff052d9dbd9 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 21 Jul 2021 09:10:00 +0200 Subject: [PATCH] sanitizer_common: revert StaticSpinMutex ctor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch "sanitizer_common: modernize SpinMutex" added default ctor to StaticSpinMutex. But it broke some gcc bots with: scudo_tsd_exclusive.cpp:25:22: error: non-local variable ‘__scudo::TSD’ declared ‘__thread’ needs dynamic initialization https://lab.llvm.org/buildbot/#/builders/105/builds/12649 Unfortunatly none of empty ctor {}, no ctor, default constexpr ctor work for different reasons. So remove StaticSpinMutex ctor entirely and move deleted copy ctor back to SpinMutex. Differential Revision: https://reviews.llvm.org/D106424 --- compiler-rt/lib/sanitizer_common/sanitizer_mutex.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mutex.h b/compiler-rt/lib/sanitizer_common/sanitizer_mutex.h index f146d4e17fe0..c01e3adbf2fb 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_mutex.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mutex.h @@ -22,8 +22,6 @@ namespace __sanitizer { class MUTEX StaticSpinMutex { public: - StaticSpinMutex() = default; - void Init() { atomic_store(&state_, 0, memory_order_relaxed); } @@ -48,9 +46,6 @@ class MUTEX StaticSpinMutex { atomic_uint8_t state_; void LockSlow(); - - StaticSpinMutex(const StaticSpinMutex &) = delete; - void operator=(const StaticSpinMutex &) = delete; }; class MUTEX SpinMutex : public StaticSpinMutex { @@ -58,6 +53,9 @@ class MUTEX SpinMutex : public StaticSpinMutex { SpinMutex() { Init(); } + + SpinMutex(const SpinMutex &) = delete; + void operator=(const SpinMutex &) = delete; }; // Semaphore provides an OS-dependent way to park/unpark threads.