From 4f0c62c4488a087b7d52ba619587e059010f56af Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 16 Aug 2019 21:25:40 +0000 Subject: [PATCH] [RWMutex] Simplify availability check Check for the actual version number for the scenarios where the macOS version isn't available (__MAC_10_12). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369154 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/RWMutex.h | 16 ++++++++-------- lib/Support/RWMutex.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/llvm/Support/RWMutex.h b/include/llvm/Support/RWMutex.h index b8e13fca976..150bc7dbbce 100644 --- a/include/llvm/Support/RWMutex.h +++ b/include/llvm/Support/RWMutex.h @@ -20,16 +20,16 @@ #include // std::shared_timed_mutex is only availble on macOS 10.12 and later. -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ - defined(__MAC_10_12) && \ - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < __MAC_10_12 -#define USE_RW_MUTEX_IMPL +#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 +#define LLVM_USE_RW_MUTEX_IMPL +#endif #endif namespace llvm { namespace sys { -#if defined(USE_RW_MUTEX_IMPL) +#if defined(LLVM_USE_RW_MUTEX_IMPL) /// Platform agnostic RWMutex class. class RWMutexImpl { /// @name Constructors @@ -97,7 +97,7 @@ template class SmartRWMutex { #if defined(_MSC_VER) || __cplusplus > 201402L std::shared_mutex impl; #else -#if !defined(USE_RW_MUTEX_IMPL) +#if !defined(LLVM_USE_RW_MUTEX_IMPL) std::shared_timed_mutex impl; #else RWMutexImpl impl; @@ -162,7 +162,7 @@ public: typedef SmartRWMutex RWMutex; /// ScopedReader - RAII acquisition of a reader lock -#if !defined(USE_RW_MUTEX_IMPL) +#if !defined(LLVM_USE_RW_MUTEX_IMPL) template using SmartScopedReader = const std::shared_lock>; #else @@ -179,7 +179,7 @@ template struct SmartScopedReader { typedef SmartScopedReader ScopedReader; /// ScopedWriter - RAII acquisition of a writer lock -#if !defined(USE_RW_MUTEX_IMPL) +#if !defined(LLVM_USE_RW_MUTEX_IMPL) template using SmartScopedWriter = std::lock_guard>; #else diff --git a/lib/Support/RWMutex.cpp b/lib/Support/RWMutex.cpp index f89e0ed6d1b..5accf73e5f9 100644 --- a/lib/Support/RWMutex.cpp +++ b/lib/Support/RWMutex.cpp @@ -14,7 +14,7 @@ #include "llvm/Support/RWMutex.h" #include "llvm/Config/config.h" -#if defined(USE_RW_MUTEX_IMPL) +#if defined(LLVM_USE_RW_MUTEX_IMPL) using namespace llvm; using namespace sys; -- 2.50.1