From 450903a60de4e11d0054d66dfcf5fa4845d439b1 Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Mon, 6 Nov 2017 22:44:14 +0100 Subject: [PATCH] Disable CRYPTOPP_CXX11_SYNCHRONIZATION for original MinGW std::mutex is only available in libstdc++ if _GLIBCXX_HAS_GTHREADS is defined, which is not the case for original MinGW. Make the existing fix for AIX more general to fix this. Unfortunately, any C++ header has to be included to detect the standard library and the otherwise empty is going to be removed from C++20, so use instead. --- config.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/config.h b/config.h index cd4da084..585fe14e 100644 --- a/config.h +++ b/config.h @@ -942,7 +942,15 @@ NAMESPACE_END #if (CRYPTOPP_MSC_VERSION >= 1700) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || \ (CRYPTOPP_APPLE_CLANG_VERSION >= 50000) || (__INTEL_COMPILER >= 1200) || \ (CRYPTOPP_GCC_VERSION >= 40400) || (__SUNPRO_CC >= 0x5130) -# define CRYPTOPP_CXX11_SYNCHRONIZATION 1 +// Hack ahead. New GCC compilers like GCC 6 on AIX 7.0 or earlier as well as original MinGW +// don't have the synchronization gear. However, Wakely's test used for Apple does not work +// on the GCC/AIX combination. Another twist is we need other stuff from C++11, +// like no-except destructors. Dumping preprocessors shows the following may +// apply: http://stackoverflow.com/q/14191566/608639. +# include +# if !defined(__GLIBCXX__) || defined(_GLIBCXX_HAS_GTHREADS) +# define CRYPTOPP_CXX11_SYNCHRONIZATION 1 +# endif #endif // synchronization // Dynamic Initialization and Destruction with Concurrency ("Magic Statics") @@ -1003,17 +1011,6 @@ NAMESPACE_END #endif // CRYPTOPP_CXX11 -// Hack ahead. New GCC compilers like GCC 6 on AIX 7.0 or earlier don't have the -// synchronization gear. However, Wakely's test used for Apple does not work -// on the GCC/AIX combination. Another twist is we need other stuff from C++11, -// like no-except destructors. Dumping preprocessors shows the following may -// apply: http://stackoverflow.com/q/14191566/608639. -#if defined(_AIX) && defined(__GNUC__) -# if !defined(_GLIBCXX_HAS_GTHREADS) -# undef CRYPTOPP_CXX11_SYNCHRONIZATION -# endif -#endif - #if defined(CRYPTOPP_CXX11_NOEXCEPT) # define CRYPTOPP_THROW noexcept(false) # define CRYPTOPP_NO_THROW noexcept(true)