diff options
author | Jeffrey Walton <noloader@gmail.com> | 2020-08-06 07:20:27 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2020-08-06 07:20:27 -0400 |
commit | a046d249c11b05a82c0d50c6f2c694f59ce73662 (patch) | |
tree | 171c0cf963818d81097515e16b1b6cf62b297c21 | |
parent | fdb977a2c691f87903f4db4c25882b4c95bea406 (diff) | |
download | cryptopp-git-a046d249c11b05a82c0d50c6f2c694f59ce73662.tar.gz |
Add CRYPTOPP_CXX11_INITIALIZER_LIST
-rw-r--r-- | TestPrograms/test_cxx11_initializer.cxx | 6 | ||||
-rwxr-xr-x | TestScripts/configure.sh | 7 | ||||
-rw-r--r-- | config_cxx.h | 7 |
3 files changed, 20 insertions, 0 deletions
diff --git a/TestPrograms/test_cxx11_initializer.cxx b/TestPrograms/test_cxx11_initializer.cxx new file mode 100644 index 00000000..050dc939 --- /dev/null +++ b/TestPrograms/test_cxx11_initializer.cxx @@ -0,0 +1,6 @@ +#include <vector>
+int main(int argc, char* argv[])
+{
+ std::vector<int> v{0,1,2,3,4};
+ return 0;
+}
diff --git a/TestScripts/configure.sh b/TestScripts/configure.sh index 686d025a..d3014b32 100755 --- a/TestScripts/configure.sh +++ b/TestScripts/configure.sh @@ -709,6 +709,13 @@ rm -f config_cxx.h.new echo '// #define CRYPTOPP_CXX11_ALIGNOF 1' fi + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_initializer.cxx -o ${TOUT} 2>&1 | tr ' ' '\n' | wc -l) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_INITIALIZER_LIST 1' + else + echo '// #define CRYPTOPP_CXX11_INITIALIZER_LIST 1' + fi + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_lambda.cxx -o ${TOUT} 2>&1 | tr ' ' '\n' | wc -l) if [[ "${CXX_RESULT}" -eq 0 ]]; then echo '#define CRYPTOPP_CXX11_LAMBDA 1' diff --git a/config_cxx.h b/config_cxx.h index ff921e46..0bdf2114 100644 --- a/config_cxx.h +++ b/config_cxx.h @@ -149,6 +149,13 @@ # define CRYPTOPP_CXX11_ALIGNOF 1
#endif // alignof
+// initializer lists: MS at VS2013 (18.00); GCC at 4.4; Clang at 3.1; Intel 14.0; SunCC 5.13.
+#if (CRYPTOPP_MSC_VERSION >= 1800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || \
+ (CRYPTOPP_APPLE_CLANG_VERSION >= 40000) || (__INTEL_COMPILER >= 1400) || \
+ (CRYPTOPP_GCC_VERSION >= 40400) || (__SUNPRO_CC >= 0x5130)
+# define CRYPTOPP_CXX11_INITIALIZER_LIST 1
+#endif // alignas
+
// lambdas: MS at VS2012 (17.00); GCC at 4.9; Clang at 3.3; Intel 12.0; SunCC 5.14.
#if (CRYPTOPP_MSC_VERSION >= 1700) || __has_feature(cxx_lambdas) || \
(__INTEL_COMPILER >= 1200) || (CRYPTOPP_GCC_VERSION >= 40900) || (__SUNPRO_CC >= 0x5140)
|