diff --git a/Eigen/Core b/Eigen/Core index b8d8bc659..1074332bb 100644 --- a/Eigen/Core +++ b/Eigen/Core @@ -98,9 +98,7 @@ #include // for std::is_nothrow_move_assignable -#ifdef EIGEN_INCLUDE_TYPE_TRAITS #include -#endif // for outputting debug info #ifdef EIGEN_DEBUG_ASSIGN diff --git a/Eigen/src/Core/ArithmeticSequence.h b/Eigen/src/Core/ArithmeticSequence.h index 1c8b67038..112ca98e0 100644 --- a/Eigen/src/Core/ArithmeticSequence.h +++ b/Eigen/src/Core/ArithmeticSequence.h @@ -16,59 +16,6 @@ namespace Eigen { namespace internal { -#if !((!EIGEN_COMP_GNUC) || EIGEN_COMP_GNUC>=48) -template struct aseq_negate {}; - -template<> struct aseq_negate { - typedef Index type; -}; - -template struct aseq_negate > { - typedef FixedInt<-N> type; -}; - -// Compilation error in the following case: -template<> struct aseq_negate > {}; - -template::value, - bool SizeIsSymbolic =symbolic::is_symbolic::value> -struct aseq_reverse_first_type { - typedef Index type; -}; - -template -struct aseq_reverse_first_type { - typedef symbolic::AddExpr > >, - symbolic::ValueExpr > - > type; -}; - -template -struct aseq_reverse_first_type_aux { - typedef Index type; -}; - -template -struct aseq_reverse_first_type_aux::type> { - typedef FixedInt<(SizeType::value-1)*IncrType::value> type; -}; - -template -struct aseq_reverse_first_type { - typedef typename aseq_reverse_first_type_aux::type Aux; - typedef symbolic::AddExpr > type; -}; - -template -struct aseq_reverse_first_type { - typedef symbolic::AddExpr > >, - symbolic::ValueExpr >, - symbolic::ValueExpr<> > type; -}; -#endif - // Helper to cleanup the type of the increment: template struct cleanup_seq_incr { typedef typename cleanup_index_type::type type; @@ -139,21 +86,9 @@ protected: IncrType m_incr; public: - -#if (!EIGEN_COMP_GNUC) || EIGEN_COMP_GNUC>=48 auto reverse() const -> decltype(Eigen::seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr)) { return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); } -#else -protected: - typedef typename internal::aseq_negate::type ReverseIncrType; - typedef typename internal::aseq_reverse_first_type::type ReverseFirstType; -public: - ArithmeticSequence - reverse() const { - return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); - } -#endif }; /** \returns an ArithmeticSequence starting at \a first, of length \a size, and increment \a incr diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h index 63ba4168c..e484bb6b5 100644 --- a/Eigen/src/Core/NumTraits.h +++ b/Eigen/src/Core/NumTraits.h @@ -85,12 +85,10 @@ namespace numext { // TODO: Replace by std::bit_cast (available in C++20) template EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Tgt bit_cast(const Src& src) { -#if EIGEN_HAS_TYPE_TRAITS // The behaviour of memcpy is not specified for non-trivially copyable types EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value, THIS_TYPE_IS_NOT_SUPPORTED); EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value && std::is_default_constructible::value, THIS_TYPE_IS_NOT_SUPPORTED); -#endif EIGEN_STATIC_ASSERT(sizeof(Src) == sizeof(Tgt), THIS_TYPE_IS_NOT_SUPPORTED); Tgt tgt; diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 89960b9b5..caa00e7ee 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -983,11 +983,7 @@ namespace internal { template struct conservative_resize_like_impl { - #if EIGEN_HAS_TYPE_TRAITS static const bool IsRelocatable = std::is_trivially_copyable::value; - #else - static const bool IsRelocatable = !NumTraits::RequireInitialization; - #endif static void run(DenseBase& _this, Index rows, Index cols) { if (_this.rows() == rows && _this.cols() == cols) return; diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h index e908bf54f..707f7d7bd 100644 --- a/Eigen/src/Core/arch/NEON/PacketMath.h +++ b/Eigen/src/Core/arch/NEON/PacketMath.h @@ -450,15 +450,6 @@ struct packet_traits : default_packet_traits }; }; -#if EIGEN_GNUC_AT_MOST(4, 4) && !EIGEN_COMP_LLVM -// workaround gcc 4.2, 4.3 and 4.4 compilation issue -EIGEN_STRONG_INLINE float32x4_t vld1q_f32(const float* x) { return ::vld1q_f32((const float32_t*)x); } -EIGEN_STRONG_INLINE float32x2_t vld1_f32(const float* x) { return ::vld1_f32 ((const float32_t*)x); } -EIGEN_STRONG_INLINE float32x2_t vld1_dup_f32(const float* x) { return ::vld1_dup_f32 ((const float32_t*)x); } -EIGEN_STRONG_INLINE void vst1q_f32(float* to, float32x4_t from) { ::vst1q_f32((float32_t*)to,from); } -EIGEN_STRONG_INLINE void vst1_f32 (float* to, float32x2_t from) { ::vst1_f32 ((float32_t*)to,from); } -#endif - template<> struct unpacket_traits { typedef float type; diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h index ccee04b8b..61e94069c 100644 --- a/Eigen/src/Core/arch/SSE/Complex.h +++ b/Eigen/src/Core/arch/SSE/Complex.h @@ -137,17 +137,9 @@ template<> EIGEN_STRONG_INLINE void prefetch >(const std::co template<> EIGEN_STRONG_INLINE std::complex pfirst(const Packet2cf& a) { - #if EIGEN_GNUC_AT_MOST(4,3) - // Workaround gcc 4.2 ICE - this is not performance wise ideal, but who cares... - // This workaround also fix invalid code generation with gcc 4.3 - EIGEN_ALIGN16 std::complex res[2]; - _mm_store_ps((float*)res, a.v); - return res[0]; - #else std::complex res; _mm_storel_pi((__m64*)&res, a.v); return res; - #endif } template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a) { return Packet2cf(_mm_castpd_ps(preverse(Packet2d(_mm_castps_pd(a.v))))); } diff --git a/Eigen/src/Core/util/ConfigureVectorization.h b/Eigen/src/Core/util/ConfigureVectorization.h index 98a51cc9b..ba2049ba4 100644 --- a/Eigen/src/Core/util/ConfigureVectorization.h +++ b/Eigen/src/Core/util/ConfigureVectorization.h @@ -91,11 +91,6 @@ // try to keep heap alignment even when we have to disable static alignment. #if EIGEN_COMP_GNUC && !(EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64 || EIGEN_ARCH_PPC || EIGEN_ARCH_IA64 || EIGEN_ARCH_MIPS) #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1 - #elif EIGEN_ARCH_ARM_OR_ARM64 && EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_MOST(4, 6) - // Old versions of GCC on ARM, at least 4.4, were once seen to have buggy static alignment support. - // Not sure which version fixed it, hopefully it doesn't affect 4.7, which is still somewhat in use. - // 4.8 and newer seem definitely unaffected. - #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1 #else #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0 #endif diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index 6b0ac502b..2f335999a 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -53,20 +53,9 @@ template class DenseCoeffsBase; template class Matrix; @@ -246,20 +235,9 @@ struct IOFormat; // Array module template class Array; template class Select; template class PartialReduxExpr; diff --git a/Eigen/src/Core/util/IntegralConstant.h b/Eigen/src/Core/util/IntegralConstant.h index 0a9990c0a..6a60e117b 100644 --- a/Eigen/src/Core/util/IntegralConstant.h +++ b/Eigen/src/Core/util/IntegralConstant.h @@ -79,14 +79,10 @@ public: template FixedInt operator&( FixedInt) const { return FixedInt(); } -#if EIGEN_HAS_CXX14_VARIABLE_TEMPLATES // Needed in C++14 to allow fix(): FixedInt operator() () const { return *this; } VariableAndFixedInt operator() (int val) const { return VariableAndFixedInt(val); } -#else - FixedInt ( FixedInt (*)() ) {} -#endif FixedInt(std::integral_constant) {} }; @@ -138,12 +134,6 @@ template struct get_fixed_value,Default> { static const int value = N; }; -#if !EIGEN_HAS_CXX14_VARIABLE_TEMPLATES -template struct get_fixed_value (*)(),Default> { - static const int value = N; -}; -#endif - template struct get_fixed_value,Default> { static const int value = N ; }; @@ -154,9 +144,6 @@ struct get_fixed_value,Default> { }; template EIGEN_DEVICE_FUNC Index get_runtime_value(const T &x) { return x; } -#if !EIGEN_HAS_CXX14_VARIABLE_TEMPLATES -template EIGEN_DEVICE_FUNC Index get_runtime_value(FixedInt (*)()) { return N; } -#endif // Cleanup integer/FixedInt/VariableAndFixedInt/etc types: @@ -166,11 +153,6 @@ template struct clea // Convert any integral type (e.g., short, int, unsigned int, etc.) to Eigen::Index template struct cleanup_index_type::value>::type> { typedef Index type; }; -#if !EIGEN_HAS_CXX14_VARIABLE_TEMPLATES -// In c++98/c++11, fix is a pointer to function that we better cleanup to a true FixedInt: -template struct cleanup_index_type (*)(), DynamicKey> { typedef FixedInt type; }; -#endif - // If VariableAndFixedInt does not match DynamicKey, then we turn it to a pure compile-time value: template struct cleanup_index_type, DynamicKey> { typedef FixedInt type; }; // If VariableAndFixedInt matches DynamicKey, then we turn it to a pure runtime-value (aka Index): @@ -182,18 +164,8 @@ template struct cleanup_index_type static const internal::FixedInt fix{}; -#else -template -inline internal::FixedInt fix() { return internal::FixedInt(); } - -// The generic typename T is mandatory. Otherwise, a code like fix could refer to either the function above or this next overload. -// This way a code like fix can only refer to the previous function. -template -inline internal::VariableAndFixedInt fix(T val) { return internal::VariableAndFixedInt(internal::convert_index(val)); } -#endif #else // EIGEN_PARSED_BY_DOXYGEN diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index b0a0451e0..db613cbe6 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -612,14 +612,6 @@ #define EIGEN_COMP_CXXVER 03 #endif -#ifndef EIGEN_HAS_CXX14_VARIABLE_TEMPLATES - #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 - #define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 1 - #else - #define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 0 - #endif -#endif - // The macros EIGEN_HAS_CXX?? defines a rough estimate of available c++ features // but in practice we should not rely on them but rather on the availability of @@ -675,18 +667,6 @@ #endif #endif -// Does the compiler support type_traits? -// - full support of type traits was added only to GCC 5.1.0. -// - 20150626 corresponds to the last release of 4.x libstdc++ -#ifndef EIGEN_HAS_TYPE_TRAITS -#if (!defined(__GLIBCXX__)) || __GLIBCXX__ > 20150626 -#define EIGEN_HAS_TYPE_TRAITS 1 -#define EIGEN_INCLUDE_TYPE_TRAITS -#else -#define EIGEN_HAS_TYPE_TRAITS 0 -#endif -#endif - // Does the compiler fully support const expressions? (as in c++14) #ifndef EIGEN_HAS_CONSTEXPR #if defined(EIGEN_CUDACC) @@ -982,14 +962,8 @@ namespace Eigen { // General, NEON. // Clang doesn't like "r", // error: non-trivial scalar-to-vector conversion, possible invalid - // constraint for vector type - // GCC < 5 doesn't like "g", - // error: 'asm' operand requires impossible reload - #if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_MOST(5, 0) - #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+r,w" (X)); - #else - #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,w" (X)); - #endif + // constraint for vector typ + #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,w" (X)); #elif EIGEN_ARCH_i386_OR_x86_64 // General, SSE. #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,x" (X)); @@ -1249,7 +1223,6 @@ namespace Eigen { #endif -#define EIGEN_INCLUDE_TYPE_TRAITS #define EIGEN_NOEXCEPT noexcept #define EIGEN_NOEXCEPT_IF(x) noexcept(x) #define EIGEN_NO_THROW noexcept(true) diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 5740510c0..933c7371a 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -14,7 +14,7 @@ // just a workaround because GCC seems to not really like empty structs // FIXME: gcc 4.3 generates bad code when strict-aliasing is enabled // so currently we simply disable this optimization for gcc 4.3 -#if EIGEN_COMP_GNUC && !EIGEN_GNUC_AT(4,3) +#if EIGEN_COMP_GNUC #define EIGEN_EMPTY_STRUCT_CTOR(X) \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X() {} \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X(const X& ) {} @@ -39,15 +39,7 @@ inline IndexDest convert_index(const IndexSrc& idx) { // true if T can be considered as an integral index (i.e., and integral type or enum) template struct is_valid_index_type { - enum { value = -#if EIGEN_HAS_TYPE_TRAITS - internal::is_integral::value || std::is_enum::value -#elif EIGEN_COMP_MSVC - internal::is_integral::value || __is_enum(T) -#else - // without C++11, we use is_convertible to Index instead of is_integral in order to treat enums as Index. - internal::is_convertible::value && !internal::is_same::value && !is_same::value -#endif + enum { value = internal::is_integral::value || std::is_enum::value }; }; diff --git a/test/dense_storage.cpp b/test/dense_storage.cpp index 98bfe0370..398cb3266 100644 --- a/test/dense_storage.cpp +++ b/test/dense_storage.cpp @@ -13,7 +13,6 @@ #include -#if EIGEN_HAS_TYPE_TRAITS using DenseStorageD3x3 = Eigen::DenseStorage; static_assert(std::is_trivially_move_constructible::value, "DenseStorage not trivially_move_constructible"); static_assert(std::is_trivially_move_assignable::value, "DenseStorage not trivially_move_assignable"); @@ -22,7 +21,6 @@ static_assert(std::is_trivially_copy_constructible::value, "De static_assert(std::is_trivially_copy_assignable::value, "DenseStorage not trivially_copy_assignable"); static_assert(std::is_trivially_copyable::value, "DenseStorage not trivially_copyable"); #endif -#endif template void dense_storage_copy(int rows, int cols) diff --git a/test/symbolic_index.cpp b/test/symbolic_index.cpp index 22ed00c71..53eb55d78 100644 --- a/test/symbolic_index.cpp +++ b/test/symbolic_index.cpp @@ -60,7 +60,6 @@ void check_symbolic_index() VERIFY_IS_EQUAL( ( lastp1-3*last ).eval(last=size-1), size- 3*(size-1) ); VERIFY_IS_EQUAL( ( (lastp1-3*last)/lastp1 ).eval(last=size-1), (size- 3*(size-1))/size ); -#if EIGEN_HAS_CXX14_VARIABLE_TEMPLATES { struct x_tag {}; static const symbolic::SymbolExpr x; struct y_tag {}; static const symbolic::SymbolExpr y; @@ -68,7 +67,6 @@ void check_symbolic_index() VERIFY_IS_APPROX( int(((x+3)/y+z).eval(x=6,y=3,z=-13)), (6+3)/3+(-13) ); } -#endif } EIGEN_DECLARE_TEST(symbolic_index) diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index 0fb32715b..a3c8c4861 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -89,14 +89,12 @@ class Tensor : public TensorBase m_storage; -#ifdef EIGEN_HAS_SFINAE template struct isOfNormalIndex{ static const bool is_array = internal::is_base_of, CustomIndices>::value; static const bool is_int = NumTraits::IsInteger; static const bool value = is_array | is_int; }; -#endif public: // Metadata @@ -129,7 +127,6 @@ class Tensor : public TensorBase::value) ) > @@ -137,7 +134,6 @@ class Tensor : public TensorBase(indices)); } -#endif EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeff() const { @@ -167,7 +163,6 @@ class Tensor : public TensorBase::value) ) > @@ -175,7 +170,6 @@ class Tensor : public TensorBase(indices)); } -#endif EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef() { @@ -198,7 +192,6 @@ class Tensor : public TensorBase::value) ) > @@ -206,7 +199,6 @@ class Tensor : public TensorBase(indices)); } -#endif // normal indices EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& operator()(const array& indices) const @@ -248,7 +240,6 @@ class Tensor : public TensorBase::value) ) > @@ -256,7 +247,6 @@ class Tensor : public TensorBase(indices)); } -#endif EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& operator()(Index index) { @@ -411,7 +401,6 @@ class Tensor : public TensorBase::value) ) > @@ -419,7 +408,6 @@ class Tensor : public TensorBase(dimensions)); } -#endif #ifndef EIGEN_EMULATE_CXX11_META_H template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h index 206f9414f..f7cd82763 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h @@ -26,15 +26,6 @@ * void foo(){} */ -// SFINAE requires variadic templates -#if !defined(EIGEN_GPUCC) -#ifdef EIGEN_COMP_GNUC - #define EIGEN_HAS_SFINAE -#else - #define EIGEN_HAS_SFINAE -#endif -#endif - #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \ typename internal::enable_if< ( __condition__ ) , int >::type = 0 diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h index cf891ebd3..8f850a946 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h @@ -264,7 +264,6 @@ template struct IndexPair { }; -#ifdef EIGEN_HAS_SFINAE namespace internal { template @@ -308,9 +307,6 @@ namespace internal { }; } -#endif - - } // namespace Eigen diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h b/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h index a859c7ba3..f556ff632 100644 --- a/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h +++ b/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h @@ -11,10 +11,6 @@ #define EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H // Try to come up with a portable way to yield -#if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) -#define EIGEN_THREAD_YIELD() sched_yield() -#else #define EIGEN_THREAD_YIELD() std::this_thread::yield() -#endif #endif // EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H diff --git a/unsupported/test/cxx11_tensor_custom_index.cpp b/unsupported/test/cxx11_tensor_custom_index.cpp index b5dbc97bd..38ce05bd8 100644 --- a/unsupported/test/cxx11_tensor_custom_index.cpp +++ b/unsupported/test/cxx11_tensor_custom_index.cpp @@ -20,7 +20,6 @@ using Eigen::Tensor; template static void test_map_as_index() { -#ifdef EIGEN_HAS_SFINAE Tensor tensor(2, 3, 5, 7); tensor.setRandom(); @@ -35,14 +34,12 @@ static void test_map_as_index() VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff)); VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff)); -#endif } template static void test_matrix_as_index() { -#ifdef EIGEN_HAS_SFINAE Tensor tensor(2, 3, 5, 7); tensor.setRandom(); @@ -53,14 +50,12 @@ static void test_matrix_as_index() VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff)); VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff)); -#endif } template static void test_varlist_as_index() { -#ifdef EIGEN_HAS_SFINAE Tensor tensor(2, 3, 5, 7); tensor.setRandom(); @@ -68,14 +63,12 @@ static void test_varlist_as_index() VERIFY_IS_EQUAL(tensor.coeff({1,2,4,1}), tensor.coeff(coeff)); VERIFY_IS_EQUAL(tensor.coeffRef({1,2,4,1}), tensor.coeffRef(coeff)); -#endif } template static void test_sizes_as_index() { -#ifdef EIGEN_HAS_SFINAE Tensor tensor(2, 3, 5, 7); tensor.setRandom(); @@ -84,7 +77,6 @@ static void test_sizes_as_index() VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff)); VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff)); -#endif }