From 62fbd276e04811b3b3e80de914269c42aa54c668 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Sat, 20 Sep 2025 13:22:12 +0200 Subject: [PATCH] Provide hints for deprecated functionality --- Eigen/src/Core/CwiseNullaryOp.h | 6 ++---- Eigen/src/Core/DenseBase.h | 12 ++++++------ Eigen/src/Core/MatrixBase.h | 9 ++++++--- Eigen/src/Core/products/Parallelizer.h | 2 +- Eigen/src/Core/util/Macros.h | 12 ++++++++++++ Eigen/src/Geometry/EulerAngles.h | 4 ++-- Eigen/src/SVD/BDCSVD.h | 10 ++++++---- Eigen/src/SVD/JacobiSVD.h | 6 ++++-- Eigen/src/SparseCore/SparseVector.h | 16 ++++++++-------- 9 files changed, 47 insertions(+), 30 deletions(-) diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 13a542a02..e4c5fedc3 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -235,8 +235,7 @@ DenseBase::Constant(const Scalar& value) { * \sa LinSpaced(Index,const Scalar&, const Scalar&), setLinSpaced(Index,const Scalar&,const Scalar&) */ template -EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase< - Derived>::RandomAccessLinSpacedReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return DenseBase::NullaryExpr(size, internal::linspaced_op(low, high, size)); @@ -247,8 +246,7 @@ DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const * \sa LinSpaced(const Scalar&, const Scalar&) */ template -EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase< - Derived>::RandomAccessLinSpacedReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 0333ad167..c81e1d109 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -306,12 +306,12 @@ class DenseBase EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index size, const Scalar& value); EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(const Scalar& value); - EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, - const Scalar& low, - const Scalar& high); - EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, - const Scalar& low, - const Scalar& high); + EIGEN_DEPRECATED_WITH_REASON("The method may result in accuracy loss. Use .EqualSpaced() instead.") + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar& low, + const Scalar& high); + EIGEN_DEPRECATED_WITH_REASON("The method may result in accuracy loss. Use .EqualSpaced() instead.") + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, const Scalar& low, + const Scalar& high); EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Index size, const Scalar& low, const Scalar& high); diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 8d5c47e47..045993d46 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -373,12 +373,14 @@ class MatrixBase : public DenseBase { template inline JacobiSVD jacobiSvd() const; template - EIGEN_DEPRECATED inline JacobiSVD jacobiSvd(unsigned int computationOptions) const; + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using method's template parameter.") + inline JacobiSVD jacobiSvd(unsigned int computationOptions) const; template inline BDCSVD bdcSvd() const; template - EIGEN_DEPRECATED inline BDCSVD bdcSvd(unsigned int computationOptions) const; + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using method's template parameter.") + inline BDCSVD bdcSvd(unsigned int computationOptions) const; /////////// Geometry module /////////// @@ -391,7 +393,8 @@ class MatrixBase : public DenseBase { EIGEN_DEVICE_FUNC inline PlainObject unitOrthogonal(void) const; - EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline Matrix eulerAngles(Index a0, Index a1, Index a2) const; + EIGEN_DEPRECATED_WITH_REASON("Use .canonicalEulerAngles() instead.") + EIGEN_DEVICE_FUNC inline Matrix eulerAngles(Index a0, Index a1, Index a2) const; EIGEN_DEVICE_FUNC inline Matrix canonicalEulerAngles(Index a0, Index a1, Index a2) const; diff --git a/Eigen/src/Core/products/Parallelizer.h b/Eigen/src/Core/products/Parallelizer.h index 4f3668944..b1b89ef97 100644 --- a/Eigen/src/Core/products/Parallelizer.h +++ b/Eigen/src/Core/products/Parallelizer.h @@ -47,7 +47,7 @@ inline void manage_multi_threading(Action action, int* v); // Public APIs. /** Must be call first when calling Eigen from multiple threads */ -EIGEN_DEPRECATED inline void initParallel() {} +EIGEN_DEPRECATED_WITH_REASON("Initialization is no longer needed.") inline void initParallel() {} /** \returns the max number of threads reserved for Eigen * \sa setNbThreads */ diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 35eb16136..db4a63089 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -940,6 +940,18 @@ #define EIGEN_DEPRECATED #endif +#ifndef EIGEN_NO_DEPRECATED_WARNING +#if EIGEN_COMP_GNUC +#define EIGEN_DEPRECATED_WITH_REASON(message) __attribute__((deprecated(message))) +#elif EIGEN_COMP_MSVC +#define EIGEN_DEPRECATED_WITH_REASON(message) __declspec(deprecated(message)) +#else +#define EIGEN_DEPRECATED_WITH_REASON(message) +#endif +#else +#define EIGEN_DEPRECATED_WITH_REASON(message) +#endif + #if EIGEN_COMP_GNUC #define EIGEN_UNUSED __attribute__((unused)) #else diff --git a/Eigen/src/Geometry/EulerAngles.h b/Eigen/src/Geometry/EulerAngles.h index ad6b821be..366a32ce4 100644 --- a/Eigen/src/Geometry/EulerAngles.h +++ b/Eigen/src/Geometry/EulerAngles.h @@ -133,8 +133,8 @@ EIGEN_DEVICE_FUNC inline Matrix::Scalar, 3, 1> Matr * \sa class AngleAxis */ template -EIGEN_DEPRECATED EIGEN_DEVICE_FUNC inline Matrix::Scalar, 3, 1> -MatrixBase::eulerAngles(Index a0, Index a1, Index a2) const { +EIGEN_DEVICE_FUNC inline Matrix::Scalar, 3, 1> MatrixBase::eulerAngles( + Index a0, Index a1, Index a2) const { /* Implemented from Graphics Gems IV */ EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived, 3, 3) diff --git a/Eigen/src/SVD/BDCSVD.h b/Eigen/src/SVD/BDCSVD.h index 6fab905e5..db1e4a264 100644 --- a/Eigen/src/SVD/BDCSVD.h +++ b/Eigen/src/SVD/BDCSVD.h @@ -155,7 +155,8 @@ class BDCSVD : public SVDBase > { * \deprecated Will be removed in the next major Eigen version. Options should * be specified in the \a Options template parameter. */ - EIGEN_DEPRECATED BDCSVD(Index rows, Index cols, unsigned int computationOptions) : m_algoswap(16), m_numIters(0) { + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using the class template parameter.") + BDCSVD(Index rows, Index cols, unsigned int computationOptions) : m_algoswap(16), m_numIters(0) { internal::check_svd_options_assertions(computationOptions, rows, cols); allocate(rows, cols, computationOptions); } @@ -183,8 +184,8 @@ class BDCSVD : public SVDBase > { * be specified in the \a Options template parameter. */ template - EIGEN_DEPRECATED BDCSVD(const MatrixBase& matrix, unsigned int computationOptions) - : m_algoswap(16), m_numIters(0) { + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using the class template parameter.") + BDCSVD(const MatrixBase& matrix, unsigned int computationOptions) : m_algoswap(16), m_numIters(0) { internal::check_svd_options_assertions(computationOptions, matrix.rows(), matrix.cols()); compute_impl(matrix, computationOptions); } @@ -211,7 +212,8 @@ class BDCSVD : public SVDBase > { * be specified in the \a Options template parameter. */ template - EIGEN_DEPRECATED BDCSVD& compute(const MatrixBase& matrix, unsigned int computationOptions) { + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using the class template parameter.") + BDCSVD& compute(const MatrixBase& matrix, unsigned int computationOptions) { internal::check_svd_options_assertions(computationOptions, matrix.rows(), matrix.cols()); return compute_impl(matrix, computationOptions); } diff --git a/Eigen/src/SVD/JacobiSVD.h b/Eigen/src/SVD/JacobiSVD.h index 1abde17fd..da2f29593 100644 --- a/Eigen/src/SVD/JacobiSVD.h +++ b/Eigen/src/SVD/JacobiSVD.h @@ -555,7 +555,8 @@ class JacobiSVD : public SVDBase > { * \deprecated Will be removed in the next major Eigen version. Options should * be specified in the \a Options template parameter. */ - EIGEN_DEPRECATED JacobiSVD(Index rows, Index cols, unsigned int computationOptions) { + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using the class template parameter.") + JacobiSVD(Index rows, Index cols, unsigned int computationOptions) { internal::check_svd_options_assertions(computationOptions, rows, cols); allocate(rows, cols, computationOptions); } @@ -610,7 +611,8 @@ class JacobiSVD : public SVDBase > { * be specified in the \a Options template parameter. */ template - EIGEN_DEPRECATED JacobiSVD& compute(const MatrixBase& matrix, unsigned int computationOptions) { + EIGEN_DEPRECATED_WITH_REASON("Options should be specified using the class template parameter.") + JacobiSVD& compute(const MatrixBase& matrix, unsigned int computationOptions) { internal::check_svd_options_assertions, Options>(m_computationOptions, matrix.rows(), matrix.cols()); return compute_impl(matrix, computationOptions); diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index 3f72a34da..d19a00dd9 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -354,40 +354,40 @@ class SparseVector : public SparseCompressedBase