From 95f3b09de3183d9de61dd8cbd39fd7015a3a36a1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 5 Oct 2016 10:11:30 +0200 Subject: [PATCH] Use the same test as in --- .../config/support/CGAL_test_cpp_version.cpp | 13 ++++++++++--- Installation/include/CGAL/config.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Installation/config/support/CGAL_test_cpp_version.cpp b/Installation/config/support/CGAL_test_cpp_version.cpp index a6c812a7f9e..08c507a9883 100644 --- a/Installation/config/support/CGAL_test_cpp_version.cpp +++ b/Installation/config/support/CGAL_test_cpp_version.cpp @@ -1,5 +1,10 @@ #include +// This file displays the value of `__cplusplus` on `stderr`, and then +// return 0 if and only if C++ `thread_local` feature can be used. +// The tests are the same as for the definition of +// `CGAL_CAN_USE_CXX11_THREAD_LOCAL` in ``. + #ifndef __has_feature #define __has_feature(x) 0 // Compatibility with non-clang compilers. #endif @@ -10,10 +15,12 @@ int main() { return 1; #else std::cout << __cplusplus; -# if __has_feature(cxx_thread_local) || __cplusplus >= 201103L +#endif + +#if __has_feature(cxx_thread_local) || \ + ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) return 0; -# else +#else return 1; -# endif #endif } diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 0e960f5ad7b..862c92372b6 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -473,6 +473,7 @@ using std::max; #if __has_feature(cxx_thread_local) || \ ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \ ( _MSC_VER >= 1900 ) +// see also Installation/config/support/CGAL_test_cpp_version.cpp #define CGAL_CAN_USE_CXX11_THREAD_LOCAL #endif