Use the same test as in <CGAL/config.h>

This commit is contained in:
Laurent Rineau 2016-10-05 10:11:30 +02:00
parent 360697e23c
commit 95f3b09de3
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,10 @@
#include <iostream>
// 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 `<CGAL/config.h>`.
#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
return 1;
#endif
#endif
}

View File

@ -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