From 98fca16f86b4bad06cf573790004ee78a7cb296b Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 7 Nov 2023 18:00:35 -0500 Subject: [PATCH] Fix clang-tidy-17 complains --- .clang-tidy | 1 + examples/step-87/step-87.cc | 4 +-- include/deal.II/base/data_out_base.h | 4 +-- include/deal.II/base/linear_index_iterator.h | 6 ++-- include/deal.II/base/quadrature.h | 12 ++++---- .../differentiation/ad/ad_number_traits.h | 8 +++--- .../differentiation/sd/symengine_optimizer.h | 28 +++++++++---------- include/deal.II/lac/block_vector_base.h | 18 ++++++------ include/deal.II/lac/linear_operator.h | 8 +++--- include/deal.II/lac/petsc_vector_base.h | 4 +-- source/base/data_out_base.cc | 4 +-- source/base/quadrature.cc | 6 ++-- source/lac/petsc_vector_base.cc | 2 +- 13 files changed, 53 insertions(+), 52 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 46c3e9a24a..242e9f284f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -35,6 +35,7 @@ Checks: > performance-*, -performance-inefficient-string-concatenation, -performance-no-automatic-move, + -performance-avoid-endl, readability-qualified-auto WarningsAsErrors: '*' diff --git a/examples/step-87/step-87.cc b/examples/step-87/step-87.cc index d47034a54d..95e38f55ae 100644 --- a/examples/step-87/step-87.cc +++ b/examples/step-87/step-87.cc @@ -80,10 +80,10 @@ namespace Step87 // triangulation is 1D, e.g., in the case of codim-1 meshes. #ifdef DEAL_II_WITH_P4EST template - using DistributedTriangulation = typename std::conditional< + using DistributedTriangulation = typename std::conditional_t< dim == 1, parallel::shared::Triangulation, - parallel::distributed::Triangulation>::type; + parallel::distributed::Triangulation>; #else template using DistributedTriangulation = diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index 2ca24be391..f678c78c4c 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -372,7 +372,7 @@ namespace DataOutBase * Swap the current object's contents with those of the given argument. */ void - swap(Patch &other_patch); + swap(Patch &other_patch) noexcept; /** * Value to be used if this patch has no neighbor on one side. @@ -524,7 +524,7 @@ namespace DataOutBase * Swap the current object's contents with those of the given argument. */ void - swap(Patch<0, spacedim> &other_patch); + swap(Patch<0, spacedim> &other_patch) noexcept; /** * Value to be used if this patch has no neighbor on one side. diff --git a/include/deal.II/base/linear_index_iterator.h b/include/deal.II/base/linear_index_iterator.h index be605a4e44..2db55b771a 100644 --- a/include/deal.II/base/linear_index_iterator.h +++ b/include/deal.II/base/linear_index_iterator.h @@ -57,9 +57,9 @@ DEAL_II_NAMESPACE_OPEN * public: * // const iterators store a const pointer * using container_pointer_type - * = typename std::conditional*, - * Container*>::type; + * = std::conditional_t*, + * Container*>; * * // This alias is assumed to exist. * using size_type = std::size_t; diff --git a/include/deal.II/base/quadrature.h b/include/deal.II/base/quadrature.h index 16bd884e36..7b2e9739cd 100644 --- a/include/deal.II/base/quadrature.h +++ b/include/deal.II/base/quadrature.h @@ -315,17 +315,17 @@ public: * * @note The actual return type of this function is * @code - * std::conditional, dim>, - * const std::array, dim> &>::type + * std::conditional_t, dim>, + * const std::array, dim> &> * @endcode * The type is abbreviated in the online documentation to improve * readability of this page. */ #ifndef DOXYGEN - typename std::conditional, dim>, - const std::array, dim> &>::type + std::conditional_t, dim>, + const std::array, dim> &> #else const std::array, dim> & #endif diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index 270eaeff1c..769c3167a9 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -309,10 +309,10 @@ namespace Differentiation (void)std::declval(), (void)std::declval(), void())> - : std::conditional< + : std::conditional_t< std::is_floating_point_v, std::false_type, - std::true_type>::type + std::true_type> {}; @@ -869,14 +869,14 @@ namespace Differentiation /** * The actual auto-differentiable number directional derivative type */ - using derivative_type = typename std::conditional< + using derivative_type = std::conditional_t< is_real_valued, typename internal::ADNumberInfoFromEnum< typename internal::RemoveComplexWrapper::type, ADNumberTypeCode>::derivative_type, std::complex::type, - ADNumberTypeCode>::derivative_type>>::type; + ADNumberTypeCode>::derivative_type>>; /** diff --git a/include/deal.II/differentiation/sd/symengine_optimizer.h b/include/deal.II/differentiation/sd/symengine_optimizer.h index 4fac65cad3..1dc9fdecd1 100644 --- a/include/deal.II/differentiation/sd/symengine_optimizer.h +++ b/include/deal.II/differentiation/sd/symengine_optimizer.h @@ -388,10 +388,10 @@ namespace Differentiation { static const bool is_supported = true; - using ReturnType = typename std::conditional< - std::is_same_v>, - std::complex, - std::complex>::type; + using ReturnType = + std::conditional_t>, + std::complex, + std::complex>; }; @@ -500,13 +500,13 @@ namespace Differentiation ReturnType_>::is_supported>> { using ReturnType = - typename std::conditional::value, - double, - std::complex>::type; - using OptimizerType = typename std::conditional< - !boost::is_complex::value, - SymEngine::LambdaRealDoubleVisitor, - SymEngine::LambdaComplexDoubleVisitor>::type; + std::conditional_t::value, + double, + std::complex>; + using OptimizerType = + std::conditional_t::value, + SymEngine::LambdaRealDoubleVisitor, + SymEngine::LambdaComplexDoubleVisitor>; /** @@ -601,9 +601,9 @@ namespace Differentiation using ReturnType = typename std:: conditional, float, double>::type; using OptimizerType = - typename std::conditional, - SymEngine::LLVMFloatVisitor, - SymEngine::LLVMDoubleVisitor>::type; + std::conditional_t, + SymEngine::LLVMFloatVisitor, + SymEngine::LLVMDoubleVisitor>; /** * A flag to indicate if the ReturnType is supported by a diff --git a/include/deal.II/lac/block_vector_base.h b/include/deal.II/lac/block_vector_base.h index 90d50a087b..d719085526 100644 --- a/include/deal.II/lac/block_vector_base.h +++ b/include/deal.II/lac/block_vector_base.h @@ -133,9 +133,9 @@ namespace internal * number. */ using value_type = - typename std::conditional::type; + std::conditional_t; /** * Declare some aliases that are standard for iterators and are used @@ -155,17 +155,17 @@ namespace internal using reference = typename BlockVectorType::reference; using pointer = value_type *; - using dereference_type = typename std::conditional< - Constness, - value_type, - typename BlockVectorType::BlockType::reference>::type; + using dereference_type = + std::conditional_t; /** * Typedef the type of the block vector (which differs in constness, * depending on the second template parameter). */ - using BlockVector = typename std:: - conditional::type; + using BlockVector = + std::conditional_t; /** * Construct an iterator from a vector to which we point and the global diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index ac9171334c..0693e98fb9 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -1427,10 +1427,10 @@ linear_operator(const OperatorExemplar &operator_exemplar, const Matrix &matrix) Domain>::reinit_domain_vector(operator_exemplar, v, omit_zeroing_entries); }; - typename std::conditional< + std::conditional_t< has_vmult_add_and_Tvmult_add::type::value, MatrixInterfaceWithVmultAdd, - MatrixInterfaceWithoutVmultAdd>::type() + MatrixInterfaceWithoutVmultAdd>() . operator()(return_op, matrix); @@ -1464,10 +1464,10 @@ linear_operator(const LinearOperator &operator_exemplar, // Initialize the payload based on the LinearOperator exemplar auto return_op = operator_exemplar; - typename std::conditional< + std::conditional_t< has_vmult_add_and_Tvmult_add::type::value, MatrixInterfaceWithVmultAdd, - MatrixInterfaceWithoutVmultAdd>::type() + MatrixInterfaceWithoutVmultAdd>() . operator()(return_op, matrix); diff --git a/include/deal.II/lac/petsc_vector_base.h b/include/deal.II/lac/petsc_vector_base.h index d60193581c..1a25e0260f 100644 --- a/include/deal.II/lac/petsc_vector_base.h +++ b/include/deal.II/lac/petsc_vector_base.h @@ -774,7 +774,7 @@ namespace PETScWrappers * analogy to standard functions. */ void - swap(VectorBase &v); + swap(VectorBase &v) noexcept; /** * Conversion operator to gain access to the underlying PETSc type. If you @@ -866,7 +866,7 @@ namespace PETScWrappers * @relatesalso PETScWrappers::VectorBase */ inline void - swap(VectorBase &u, VectorBase &v) + swap(VectorBase &u, VectorBase &v) noexcept { u.swap(v); } diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 185d45a622..b0f60a5e82 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -1845,7 +1845,7 @@ namespace DataOutBase template void - Patch::swap(Patch &other_patch) + Patch::swap(Patch &other_patch) noexcept { std::swap(vertices, other_patch.vertices); std::swap(neighbors, other_patch.neighbors); @@ -1935,7 +1935,7 @@ namespace DataOutBase template void - Patch<0, spacedim>::swap(Patch<0, spacedim> &other_patch) + Patch<0, spacedim>::swap(Patch<0, spacedim> &other_patch) noexcept { std::swap(vertices, other_patch.vertices); std::swap(patch_index, other_patch.patch_index); diff --git a/source/base/quadrature.cc b/source/base/quadrature.cc index b060625d09..a3daba9958 100644 --- a/source/base/quadrature.cc +++ b/source/base/quadrature.cc @@ -332,9 +332,9 @@ Quadrature::memory_consumption() const template -typename std::conditional, dim>, - const std::array, dim> &>::type +typename std::conditional_t, dim>, + const std::array, dim> &> Quadrature::get_tensor_basis() const { Assert(this->is_tensor_product_flag == true, diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 8967c581e3..d3db0022dd 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -1008,7 +1008,7 @@ namespace PETScWrappers void - VectorBase::swap(VectorBase &v) + VectorBase::swap(VectorBase &v) noexcept { std::swap(this->vector, v.vector); std::swap(this->ghosted, v.ghosted); -- 2.39.5