Skip to content

Commit eeac956

Browse files
committed
Fix macOS 10.12 build warning
OSMemoryBarrier() has been deprecated as of macOS 10.12. Compile it only if on a version where it’s not deprecated.
1 parent a2fb086 commit eeac956

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

port/atomic_pointer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
#include <windows.h>
2727
#endif
2828
#ifdef OS_MACOSX
29+
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200
2930
#include <libkern/OSAtomic.h>
3031
#endif
32+
#endif
3133

3234
#if defined(_M_X64) || defined(__x86_64__)
3335
#define ARCH_CPU_X86_FAMILY 1
@@ -55,10 +57,12 @@ namespace port {
5557

5658
// Mac OS
5759
#elif defined(OS_MACOSX)
60+
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200
5861
inline void MemoryBarrier() {
5962
OSMemoryBarrier();
6063
}
6164
#define LEVELDB_HAVE_MEMORY_BARRIER
65+
#endif
6266

6367
// Gcc on x86
6468
#elif defined(ARCH_CPU_X86_FAMILY) && defined(__GNUC__)

0 commit comments

Comments
 (0)