Skip to content

Commit 37de652

Browse files
committed
Use C++ feature test macros when available
There are not too many of them. __cpp_threadsafe_static_init may be useful for less frequently used compilers and platforms.
1 parent 76fa704 commit 37de652

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

config_cxx.h

+8-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
// MS at VS2015 with Vista (19.00); GCC at 4.3; LLVM Clang at 2.9; Apple Clang at 4.0; Intel 11.1; SunCC 5.13.
9292
// Microsoft's implementation only works for Vista and above, so its further
9393
// limited. http://connect.microsoft.com/VisualStudio/feedback/details/1789709
94-
#if (CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600) || (_WIN32_WINNT >= 0x0600)) || \
94+
#if (__cpp_threadsafe_static_init >= 200806) || \
95+
(CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600) || (_WIN32_WINNT >= 0x0600)) || \
9596
(CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000) || \
9697
(__INTEL_COMPILER >= 1110) || (CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130)
9798
# define CRYPTOPP_CXX11_DYNAMIC_INIT 1
@@ -129,15 +130,17 @@
129130
#endif // noexcept compilers
130131

131132
// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 5.13.
132-
#if (CRYPTOPP_MSC_VERSION >= 1800) || __has_feature(cxx_variadic_templates) || \
133-
(__INTEL_COMPILER >= 1210) || (CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130)
133+
#if (__cpp_variadic_templates >= 200704) || __has_feature(cxx_variadic_templates) \
134+
(CRYPTOPP_MSC_VERSION >= 1800) || (__INTEL_COMPILER >= 1210) || \
135+
(CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130)
134136
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
135137
#endif // variadic templates
136138

137139
// constexpr: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.1; Intel 16.0; SunCC 5.13.
138140
// Intel has mis-supported the feature since at least ICPC 13.00
139-
#if (CRYPTOPP_MSC_VERSION >= 1900) || __has_feature(cxx_constexpr) || \
140-
(__INTEL_COMPILER >= 1600) || (CRYPTOPP_GCC_VERSION >= 40600) || (__SUNPRO_CC >= 0x5130)
141+
#if (__cpp_constexpr >= 200704) || __has_feature(cxx_constexpr) || \
142+
(CRYPTOPP_MSC_VERSION >= 1900) || (__INTEL_COMPILER >= 1600) || \
143+
(CRYPTOPP_GCC_VERSION >= 40600) || (__SUNPRO_CC >= 0x5130)
141144
# define CRYPTOPP_CXX11_CONSTEXPR 1
142145
#endif // constexpr compilers
143146

0 commit comments

Comments
 (0)