diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-03-01 15:57:22 -0800 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-03-05 18:33:18 +0000 |
commit | 2468253c9adbb1e42be9227848c2d9a7b578dbaf (patch) | |
tree | b35b5e33db3cc2010c77999c2252261a119ed16b /unsupported/Eigen/CXX11 | |
parent | 82d61af3a490154ad1c0ae2fe00c561095854897 (diff) |
Define EIGEN_CPLUSPLUS and replace most __cplusplus checks.
The macro `__cplusplus` is not defined correctly in MSVC unless building
with the the `/Zc:__cplusplus` flag. Instead, it defines `_MSVC_LANG` to the
specified c++ standard version number.
Here we introduce `EIGEN_CPLUSPLUS` which will contain the c++ version
number both for MSVC and otherwise. This simplifies checks for supported
features.
Also replaced most instances of standard version checking via `__cplusplus`
with the existing `EIGEN_COMP_CXXVER` macro for better clarity.
Fixes: #2170
Diffstat (limited to 'unsupported/Eigen/CXX11')
-rw-r--r-- | unsupported/Eigen/CXX11/ThreadPool | 2 | ||||
-rw-r--r-- | unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/unsupported/Eigen/CXX11/ThreadPool b/unsupported/Eigen/CXX11/ThreadPool index 5f59e9714..c5cafb2a1 100644 --- a/unsupported/Eigen/CXX11/ThreadPool +++ b/unsupported/Eigen/CXX11/ThreadPool @@ -30,7 +30,7 @@ // The code depends on CXX11, so only include the module if the // compiler supports it. -#if __cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900 +#if (EIGEN_COMP_CXXVER >= 11) #include <cstddef> #include <cstring> #include <time.h> diff --git a/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h b/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h index f1c0284ea..056736c39 100644 --- a/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h +++ b/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h @@ -32,7 +32,7 @@ * On the other hand, visual studio still doesn't claim to support C++11 although it's * compliant enugh for our purpose. */ -#if (__cplusplus <= 199711L) && (EIGEN_COMP_MSVC < 1900) +#if (EIGEN_COMP_CXXVER < 11) #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) #pragma GCC diagnostic error "-Wfatal-errors" #endif |