Skip to content

Commit

Permalink
Attempt to fix error when targeting older macOS versions using C++17 …
Browse files Browse the repository at this point in the history
…(issue cameron314#99)
  • Loading branch information
cameron314 committed Aug 13, 2020
1 parent 435e365 commit 2877099
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion readerwriterqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
#endif
#endif

#ifndef MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE
#if TARGET_OS_MAC && __cplusplus >= 201703L
// 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
#define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE
#else
#define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE AE_ALIGN(MOODYCAMEL_CACHE_LINE_SIZE)
#endif
#endif

#ifdef AE_VCPP
#pragma warning(push)
#pragma warning(disable: 4324) // structure was padded due to __declspec(align())
Expand All @@ -58,7 +67,7 @@
namespace moodycamel {

template<typename T, size_t MAX_BLOCK_SIZE = 512>
class AE_ALIGN(MOODYCAMEL_CACHE_LINE_SIZE) ReaderWriterQueue
class MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE ReaderWriterQueue
{
// Design: Based on a queue-of-queues. The low-level queues are just
// circular buffers with front and tail indices indicating where the
Expand Down

0 comments on commit 2877099

Please sign in to comment.