Use CRYPTOPP_CXX11_ATOMIC define

This commit is contained in:
Jeffrey Walton 2020-08-06 03:08:37 -04:00
parent 37368ddb94
commit 3f73f709b8
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 6 additions and 6 deletions

@ -654,9 +654,9 @@ rm -f config_cxx.h.new
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_atomic.cxx -o ${TOUT} 2>&1 | tr ' ' '\n' | wc -l)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_ATOMICS 1'
echo '#define CRYPTOPP_CXX11_ATOMIC 1'
else
echo '// #define CRYPTOPP_CXX11_ATOMICS 1'
echo '// #define CRYPTOPP_CXX11_ATOMIC 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_sync.cxx -o ${TOUT} 2>&1 | tr ' ' '\n' | wc -l)

@ -99,7 +99,7 @@
// atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 5.14.
#if (CRYPTOPP_MSC_VERSION >= 1700) || __has_feature(cxx_atomic) || \
(__INTEL_COMPILER >= 1300) || (CRYPTOPP_GCC_VERSION >= 40400) || (__SUNPRO_CC >= 0x5140)
# define CRYPTOPP_CXX11_ATOMICS 1
# define CRYPTOPP_CXX11_ATOMIC 1
#endif // atomics
// synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 5.13.

4
misc.h

@ -267,7 +267,7 @@ struct NewObject
/// <tt>_ReadWriteBarrier()</tt> or <tt>__asm__("" ::: "memory")</tt> is used.
#define MEMORY_BARRIER ...
#else
#if defined(CRYPTOPP_CXX11_ATOMICS)
#if defined(CRYPTOPP_CXX11_ATOMIC)
# define MEMORY_BARRIER() std::atomic_thread_fence(std::memory_order_acq_rel)
#elif (_MSC_VER >= 1400)
# pragma intrinsic(_ReadWriteBarrier)
@ -324,7 +324,7 @@ private:
template <class T, class F, int instance>
const T & Singleton<T, F, instance>::Ref(CRYPTOPP_NOINLINE_DOTDOTDOT) const
{
#if defined(CRYPTOPP_CXX11_ATOMICS) && defined(CRYPTOPP_CXX11_SYNCHRONIZATION) && defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
#if defined(CRYPTOPP_CXX11_ATOMIC) && defined(CRYPTOPP_CXX11_SYNCHRONIZATION) && defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
static std::mutex s_mutex;
static std::atomic<T*> s_pObject;

@ -47,7 +47,7 @@ namespace std {
#include <iterator>
#endif
#if defined(CRYPTOPP_CXX11_ATOMICS)
#if defined(CRYPTOPP_CXX11_ATOMIC)
#include <atomic>
#endif