From a1b1a58e9afb6a1ac82d38001886f16f9923213d Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Sat, 5 Oct 2024 21:07:58 +0000 Subject: [PATCH] Merge branch 'issue/remove-warnings-master' into 'master' Get rid off unused-variable-warnings. See merge request core/dune-istl!579 (cherry picked from commit 9aa357d8f1b912de5dd81a95b22af4cd67a54ae6) 9d399d54 Get rid off unused-variable-warnings. 7dc9ac75 aplied suggestion to comment parameter name instead 0d4edec9 aplied suggestion to comment parameter name instead a574dd7b aplied suggestion to comment parameter name instead 4fca9eb4 Appiied suggestion to refactor to template sfinae ec80ed6b Appiied suggestion to refactor to template sfinae 8b5158e4 Appiied suggestion to refactor to template sfinae 0b46567a Appiied suggestion to refactor to template sfinae Co-authored-by: Simon Praetorius <simon.praetorius@tu-dresden.de> --- dune/istl/io.hh | 24 ++++++++++++------------ dune/python/istl/bvector.hh | 2 +- dune/python/istl/preconditioners.hh | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dune/istl/io.hh b/dune/istl/io.hh index b01c049e9..d7bd69c22 100644 --- a/dune/istl/io.hh +++ b/dune/istl/io.hh @@ -147,14 +147,14 @@ namespace Dune { * #include <dune/istl/io.hh> * \endcode */ - template<class K> + template<class K, + std::enable_if_t<Dune::IsNumber<K>::value, int> = 0> void print_row (std::ostream& s, const K& value, [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type I, [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type J, [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type therow, int width, - [[maybe_unused]] int precision, - typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr) + [[maybe_unused]] int precision) { s << " "; // space in front of each entry s.width(width); // set width for each entry anew @@ -168,11 +168,11 @@ namespace Dune { * #include <dune/istl/io.hh> * \endcode */ - template<class M> + template<class M, + std::enable_if_t<not Dune::IsNumber<M>::value, int> = 0> void print_row (std::ostream& s, const M& A, typename M::size_type I, typename M::size_type J, typename M::size_type therow, - int width, int precision, - typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr) + int width, int precision) { typename M::size_type i0=I; for (typename M::size_type i=0; i<A.N(); i++) @@ -407,11 +407,11 @@ namespace Dune { * * This specialization for numbers ends the recursion */ - template <class FieldType> + template <class FieldType, + std::enable_if_t<Dune::IsNumber<FieldType>::value, int> = 0> void writeMatrixToMatlabHelper(const FieldType& value, int rowOffset, int colOffset, - std::ostream& s, - typename std::enable_if_t<Dune::IsNumber<FieldType>::value>* sfinae = nullptr) + std::ostream& s) { //+1 for Matlab numbering s << rowOffset + 1 << " " << colOffset + 1 << " "; @@ -425,11 +425,11 @@ namespace Dune { * #include <dune/istl/io.hh> * \endcode */ - template <class MatrixType> + template <class MatrixType, + std::enable_if_t<not Dune::IsNumber<MatrixType>::value, int> = 0> void writeMatrixToMatlabHelper(const MatrixType& matrix, int externalRowOffset, int externalColOffset, - std::ostream& s, - typename std::enable_if_t<!Dune::IsNumber<MatrixType>::value>* sfinae = nullptr) + std::ostream& s) { // Precompute the accumulated sizes of the columns std::vector<typename MatrixType::size_type> colOffset(matrix.M()); diff --git a/dune/python/istl/bvector.hh b/dune/python/istl/bvector.hh index 26bc499af..0411b9519 100644 --- a/dune/python/istl/bvector.hh +++ b/dune/python/istl/bvector.hh @@ -183,7 +183,7 @@ namespace Dune //the generator actually takes the scope into account which is why we do nothing with it here //so when doing a dune.istl blockvector it doesn't actually define any of the rest of the bindings template< class BlockVector, class ... options > - void registerBlockVector ( pybind11::handle scope, pybind11::class_<BlockVector, options ... > cls ) + void registerBlockVector ( pybind11::handle /*scope*/, pybind11::class_<BlockVector, options ... > cls ) { typedef typename BlockVector::size_type size_type; using pybind11::operator""_a; diff --git a/dune/python/istl/preconditioners.hh b/dune/python/istl/preconditioners.hh index f11f45cac..547d73082 100644 --- a/dune/python/istl/preconditioners.hh +++ b/dune/python/istl/preconditioners.hh @@ -51,7 +51,7 @@ namespace Dune // ----------------------- template< class X, class Y, class... options > - inline void registerPreconditioners ( pybind11::module module, pybind11::class_< LinearOperator< X, Y >, options... > cls ) + inline void registerPreconditioners ( pybind11::module module, pybind11::class_< LinearOperator< X, Y >, options... > /*cls*/ ) { typedef Dune::Preconditioner< X, Y > Preconditioner; @@ -81,7 +81,7 @@ namespace Dune } template< class M, class X, class Y, class... options > - inline void registerMatrixPreconditioners ( pybind11::module module, pybind11::class_< LinearOperator< X, Y >, options... > cls ) + inline void registerMatrixPreconditioners ( pybind11::module module, pybind11::class_< LinearOperator< X, Y >, options... > /*cls*/ ) { typedef Dune::Preconditioner< X, Y > Preconditioner; -- GitLab