mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
82d61af3a4
commit
2468253c9a
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -114,7 +114,7 @@ template<typename Scalar,typename Packet> void packetmath_real()
|
||||
Scalar(std::pow(Scalar(10), internal::random<Scalar>(Scalar(-1),Scalar(2))));
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_C99_MATH && (__cplusplus > 199711L)
|
||||
#if EIGEN_HAS_C99_MATH && (EIGEN_COMP_CXXVER >= 11)
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasLGamma, std::lgamma, internal::plgamma);
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErf, std::erf, internal::perf);
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErfc, std::erfc, internal::perfc);
|
||||
|
||||
Reference in New Issue
Block a user