diff --git a/TestScripts/configure.sh b/TestScripts/configure.sh index 7abe553b..c977ccea 100755 --- a/TestScripts/configure.sh +++ b/TestScripts/configure.sh @@ -722,9 +722,9 @@ rm -f config_cxx.h.new CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_staticinit.cxx -o ${TOUT} 2>&1 | wc -w) if [[ "${CXX_RESULT}" -eq 0 ]]; then - echo '#define CRYPTOPP_CXX11_DYNAMIC_INIT 1' + echo '#define CRYPTOPP_CXX11_STATIC_INIT 1' else - echo '// #define CRYPTOPP_CXX11_DYNAMIC_INIT 1' + echo '// #define CRYPTOPP_CXX11_STATIC_INIT 1' fi CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_deletefn.cxx -o ${TOUT} 2>&1 | wc -w) diff --git a/config_cxx.h b/config_cxx.h index 1eca7f0f..300454da 100644 --- a/config_cxx.h +++ b/config_cxx.h @@ -124,7 +124,7 @@ (CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600) || (_WIN32_WINNT >= 0x0600)) || \ (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000) || \ (__INTEL_COMPILER >= 1110) || (CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130) -# define CRYPTOPP_CXX11_DYNAMIC_INIT 1 +# define CRYPTOPP_CXX11_STATIC_INIT 1 #endif // Dynamic Initialization compilers // deleted functions: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 5.13. diff --git a/cpu.cpp b/cpu.cpp index 477b8f9a..287d3a9a 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -234,7 +234,7 @@ private: void GetAppleMachineInfo(unsigned int& device, unsigned int& version, unsigned int& arch) { -#if CRYPTOPP_CXX11_DYNAMIC_INIT +#if CRYPTOPP_CXX11_STATIC_INIT static const AppleMachineInfo info; #else using CryptoPP::Singleton; diff --git a/ec2n.cpp b/ec2n.cpp index e58869ba..87aed853 100644 --- a/ec2n.cpp +++ b/ec2n.cpp @@ -198,7 +198,7 @@ const EC2N::Point& EC2N::Identity() const { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_identity; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const EC2N::Point g_identity; return g_identity; #else diff --git a/ecp.cpp b/ecp.cpp index c649aba6..f349a86d 100644 --- a/ecp.cpp +++ b/ecp.cpp @@ -719,7 +719,7 @@ const ECP::Point& ECP::Identity() const { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_identity; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const ECP::Point g_identity; return g_identity; #else diff --git a/gf2n.cpp b/gf2n.cpp index a01646b8..452e6982 100644 --- a/gf2n.cpp +++ b/gf2n.cpp @@ -166,7 +166,7 @@ const PolynomialMod2 &PolynomialMod2::Zero() { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_zero; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const PolynomialMod2 g_zero; return g_zero; #else @@ -178,7 +178,7 @@ const PolynomialMod2 &PolynomialMod2::One() { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_one; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const PolynomialMod2 g_one(1); return g_one; #else diff --git a/integer.cpp b/integer.cpp index 9021defe..d9cba3b0 100644 --- a/integer.cpp +++ b/integer.cpp @@ -4857,7 +4857,7 @@ const Integer &Integer::Zero() { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_zero; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const Integer s_zero(0L); return s_zero; #else // Potential memory leak. Avoid if possible. @@ -4869,7 +4869,7 @@ const Integer &Integer::One() { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_one; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const Integer s_one(1L); return s_one; #else // Potential memory leak. Avoid if possible. @@ -4881,7 +4881,7 @@ const Integer &Integer::Two() { #if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY) || defined(HAVE_XLC_INIT_PRIORITY) return g_two; -#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#elif defined(CRYPTOPP_CXX11_STATIC_INIT) static const Integer s_two(2L); return s_two; #else // Potential memory leak. Avoid if possible. diff --git a/misc.h b/misc.h index 12dad4c6..de668e9d 100644 --- a/misc.h +++ b/misc.h @@ -324,7 +324,7 @@ private: template const T & Singleton::Ref(CRYPTOPP_NOINLINE_DOTDOTDOT) const { -#if defined(CRYPTOPP_CXX11_ATOMIC) && defined(CRYPTOPP_CXX11_SYNCHRONIZATION) && defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#if defined(CRYPTOPP_CXX11_ATOMIC) && defined(CRYPTOPP_CXX11_SYNCHRONIZATION) && defined(CRYPTOPP_CXX11_STATIC_INIT) static std::mutex s_mutex; static std::atomic s_pObject; diff --git a/osrng.cpp b/osrng.cpp index a8b13329..5121ac1e 100644 --- a/osrng.cpp +++ b/osrng.cpp @@ -154,7 +154,7 @@ void NonblockingRng::GenerateBlock(byte *output, size_t size) { #ifdef CRYPTOPP_WIN32_AVAILABLE // Acquiring a provider is expensive. Do it once and retain the reference. -# if defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +# if defined(CRYPTOPP_CXX11_STATIC_INIT) static const MicrosoftCryptoProvider hProvider = MicrosoftCryptoProvider(); # else const MicrosoftCryptoProvider &hProvider = Singleton().Ref(); diff --git a/validate.h b/validate.h index 7af6c378..f2ec5a67 100644 --- a/validate.h +++ b/validate.h @@ -322,7 +322,7 @@ inline std::string DataDir(const std::string& filename) std::string name; std::ifstream file; -#if CRYPTOPP_CXX11_DYNAMIC_INIT +#if CRYPTOPP_CXX11_STATIC_INIT static std::string path = AddSeparator(GetDataDir()); name = path + filename; file.open(name.c_str()); diff --git a/xtr.cpp b/xtr.cpp index 6862c3d2..fe49b1ea 100644 --- a/xtr.cpp +++ b/xtr.cpp @@ -13,7 +13,7 @@ NAMESPACE_BEGIN(CryptoPP) const GFP2Element & GFP2Element::Zero() { -#if defined(CRYPTOPP_CXX11_DYNAMIC_INIT) +#if defined(CRYPTOPP_CXX11_STATIC_INIT) static const GFP2Element s_zero; return s_zero; #else