diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -360,11 +360,13 @@ append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS) if(CMAKE_CXX_COMPILER_ID MATCHES Clang) - list(APPEND SANITIZER_COMMON_CFLAGS + list(APPEND THREAD_SAFETY_FLAGS "-Werror=thread-safety" "-Werror=thread-safety-reference" "-Werror=thread-safety-beta" -) + ) + list(APPEND SANITIZER_COMMON_CFLAGS ${THREAD_SAFETY_FLAGS}) + list(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS ${THREAD_SAFETY_FLAGS}) endif() # If we're using MSVC, diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h @@ -237,13 +237,13 @@ // ForceLock() and ForceUnlock() are needed to implement Darwin malloc zone // introspection API. - void ForceLock() { + void ForceLock() NO_THREAD_SAFETY_ANALYSIS { for (uptr i = 0; i < kNumClasses; i++) { GetSizeClassInfo(i)->mutex.Lock(); } } - void ForceUnlock() { + void ForceUnlock() NO_THREAD_SAFETY_ANALYSIS { for (int i = kNumClasses - 1; i >= 0; i--) { GetSizeClassInfo(i)->mutex.Unlock(); }