Skip to content

Commit a500a29

Browse files
committed
Refined OS X compatibility check with overalignment on C++17 (thanks to szarvas) (issue #99)
1 parent 9ede8af commit a500a29

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

readerwriterqueue.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,19 @@
4949
#endif
5050

5151
#ifndef MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE
52-
#if TARGET_OS_MAC && __cplusplus >= 201703L
52+
#if defined (__APPLE__) && defined (__MACH__) && __cplusplus >= 201703L
53+
// This is required to find out what deployment target we are using
54+
#include <CoreFoundation/CoreFoundation.h>
55+
#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
5356
// C++17 new(size_t, align_val_t) is not backwards-compatible with older versions of macOS, so we can't support over-alignment in this case
5457
#define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE
55-
#else
56-
#define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE AE_ALIGN(MOODYCAMEL_CACHE_LINE_SIZE)
5758
#endif
5859
#endif
60+
#endif
61+
62+
#ifndef MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE
63+
#define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE AE_ALIGN(MOODYCAMEL_CACHE_LINE_SIZE)
64+
#endif
5965

6066
#ifdef AE_VCPP
6167
#pragma warning(push)

0 commit comments

Comments
 (0)