From https://github.com/Ardour/ardour/pull/822/commits/c2ac82bfbacc583c49b306826dedec754633bbe7 Mon Sep 17 00:00:00 2001 From: Violet Purcell Date: Thu, 21 Sep 2023 21:09:30 -0400 Subject: [PATCH] Backport VST3 libc++ fix on linux LLVM libc++ does not have the ext/atomicity.h header. This fix is copied from the upstream vst3_pluginterfaces repo. Signed-off-by: Violet Purcell --- a/libs/vst3/pluginterfaces/base/funknown.cpp +++ b/libs/vst3/pluginterfaces/base/funknown.cpp @@ -44,13 +44,23 @@ #endif #if SMTG_OS_LINUX +#if !defined (SMTG_USE_ATOMIC) +#if defined (_LIBCPP_VERSION) +#define SMTG_USE_ATOMIC 1 +#else #include +#endif +#endif /* UUID */ #include #include #include #endif +#if defined (SMTG_USE_ATOMIC) && SMTG_USE_ATOMIC +#include +#endif + namespace Steinberg { //------------------------------------------------------------------------ @@ -79,7 +89,9 @@ namespace FUnknownPrivate { //------------------------------------------------------------------------ int32 PLUGIN_API atomicAdd (int32& var, int32 d) { -#if SMTG_OS_WINDOWS +#if SMTG_USE_ATOMIC + return atomic_fetch_add (reinterpret_cast (&var), d) +d; +#elif SMTG_OS_WINDOWS return InterlockedExchangeAdd ((volatile long int*)&var, d) + d; #elif SMTG_OS_MACOS return OSAtomicAdd32Barrier (d, (int32_t*)&var); -- 2.42.0