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 <vimproved@inventati.org>
This commit is contained in:
parent
22e15b135e
commit
8aa716d437
|
@ -44,13 +44,23 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SMTG_OS_LINUX
|
#if SMTG_OS_LINUX
|
||||||
|
#if !defined (SMTG_USE_STDATOMIC_H)
|
||||||
|
#if defined (_LIBCPP_VERSION)
|
||||||
|
#define SMTG_USE_STDATOMIC_H 1
|
||||||
|
#else
|
||||||
#include <ext/atomicity.h>
|
#include <ext/atomicity.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
/* UUID */
|
/* UUID */
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/uuid/uuid.hpp>
|
#include <boost/uuid/uuid.hpp>
|
||||||
#include <boost/uuid/uuid_generators.hpp>
|
#include <boost/uuid/uuid_generators.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (SMTG_USE_STDATOMIC_H) && SMTG_USE_STDATOMIC_H
|
||||||
|
#include <stdatomic.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Steinberg {
|
namespace Steinberg {
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
@ -79,7 +89,9 @@ namespace FUnknownPrivate {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
int32 PLUGIN_API atomicAdd (int32& var, int32 d)
|
int32 PLUGIN_API atomicAdd (int32& var, int32 d)
|
||||||
{
|
{
|
||||||
#if SMTG_OS_WINDOWS
|
#if SMTG_USE_STDATOMIC_H
|
||||||
|
return atomic_fetch_add (reinterpret_cast<atomic_int_least32_t*> (&var), d) +d;
|
||||||
|
#elif SMTG_OS_WINDOWS
|
||||||
return InterlockedExchangeAdd ((volatile long int*)&var, d) + d;
|
return InterlockedExchangeAdd ((volatile long int*)&var, d) + d;
|
||||||
#elif SMTG_OS_MACOS
|
#elif SMTG_OS_MACOS
|
||||||
return OSAtomicAdd32Barrier (d, (int32_t*)&var);
|
return OSAtomicAdd32Barrier (d, (int32_t*)&var);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user