From c3cacaa598b896df8b2f6d164d40231b58c945cf Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 12 Nov 2021 18:04:17 +0100 Subject: [PATCH] Base some more rules --- .clang-tidy | 18 +++++++++--------- Base/Axis/IAxis.h | 2 +- Base/Axis/VariableBinAxis.h | 2 +- Base/Element/IElement.h | 2 +- Base/Types/SafePointerVector.h | 8 ++++---- Base/Vector/Transform3D.h | 2 +- auto/Wrap/doxygenBase.i | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index ea79ea69b48..62ac712d0f0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -110,15 +110,15 @@ Checks: ' -cppcoreguidelines-explicit-virtual-functions, -cppcoreguidelines-pro-type-const-cast, -cppcoreguidelines-pro-type-static-cast-downcast, --google-explicit-constructor, --google-readability-avoid-underscore-in-googletest-name, --google-runtime-references, --hicpp-explicit-conversions, --hicpp-member-init, --hicpp-noexcept-move, --llvm-qualified-auto, --misc-non-private-member-variables-in-classes, --misc-uniqueptr-reset-release, +google-explicit-constructor, +google-readability-avoid-underscore-in-googletest-name, +google-runtime-references, +hicpp-explicit-conversions, +hicpp-member-init, +hicpp-noexcept-move, +llvm-qualified-auto, +misc-non-private-member-variables-in-classes, +misc-uniqueptr-reset-release, modernize-avoid-bind, modernize-make-unique, modernize-pass-by-value, diff --git a/Base/Axis/IAxis.h b/Base/Axis/IAxis.h index 4ff1de216e1..4aa0982e2c0 100644 --- a/Base/Axis/IAxis.h +++ b/Base/Axis/IAxis.h @@ -24,7 +24,7 @@ class IAxis { public: - IAxis(std::string name) : m_name(std::move(name)) {} + explicit IAxis(std::string name) : m_name(std::move(name)) {} IAxis(const IAxis&) = delete; virtual ~IAxis() {} diff --git a/Base/Axis/VariableBinAxis.h b/Base/Axis/VariableBinAxis.h index f8e1bddf2cb..7b018038b46 100644 --- a/Base/Axis/VariableBinAxis.h +++ b/Base/Axis/VariableBinAxis.h @@ -52,7 +52,7 @@ public: virtual void clip(double lower, double upper) override; protected: - VariableBinAxis(const std::string& name, size_t nbins = 0); + explicit VariableBinAxis(const std::string& name, size_t nbins = 0); void setBinBoundaries(const std::vector<double>& bin_boundaries); virtual void print(std::ostream& ostr) const override; diff --git a/Base/Element/IElement.h b/Base/Element/IElement.h index b8a02317b41..527e97ea18a 100644 --- a/Base/Element/IElement.h +++ b/Base/Element/IElement.h @@ -29,7 +29,7 @@ class IElement { public: - IElement(PolMatrices polpair) : m_polpair(std::move(polpair)) {} + explicit IElement(PolMatrices polpair) : m_polpair(std::move(polpair)) {} protected: const PolMatrices m_polpair; diff --git a/Base/Types/SafePointerVector.h b/Base/Types/SafePointerVector.h index 880564f7566..728a880ce60 100644 --- a/Base/Types/SafePointerVector.h +++ b/Base/Types/SafePointerVector.h @@ -33,11 +33,11 @@ public: using const_iterator = typename std::vector<T *>::const_iterator; SafePointerVector() {} SafePointerVector(const SafePointerVector& other); - SafePointerVector(SafePointerVector&& other); + SafePointerVector(SafePointerVector&& other) noexcept ; ~SafePointerVector() { clear(); } SafePointerVector& operator=(const SafePointerVector& right); - SafePointerVector& operator=(SafePointerVector&& right); + SafePointerVector& operator=(SafePointerVector&& right) noexcept ; size_t size() const { return m_pointers.size(); } bool empty() const { return m_pointers.empty(); } void push_back(T* pointer) { m_pointers.push_back(pointer); } @@ -64,7 +64,7 @@ template <class T> SafePointerVector<T>::SafePointerVector(const SafePointerVect template <class T> SafePointerVector<T>::SafePointerVector(SafePointerVector<T>&& other) - : m_pointers(std::move(other.m_pointers)) + noexcept : m_pointers(std::move(other.m_pointers)) { } @@ -81,7 +81,7 @@ SafePointerVector<T>& SafePointerVector<T>::operator=(const SafePointerVector<T> template <class T> SafePointerVector<T>& SafePointerVector<T>::operator=(SafePointerVector<T>&& right) -{ + noexcept { clear(); m_pointers = std::move(right.m_pointers); right.m_pointers.clear(); diff --git a/Base/Vector/Transform3D.h b/Base/Vector/Transform3D.h index 022296750fe..234f4c4f15a 100644 --- a/Base/Vector/Transform3D.h +++ b/Base/Vector/Transform3D.h @@ -31,7 +31,7 @@ public: #ifndef SWIG //! Constructor from matrix (no checks if this is an element of SO(3)!) - Transform3D(Eigen::Matrix3d matrix); + explicit Transform3D(Eigen::Matrix3d matrix); #endif //! Destructor diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index 324f4f76ba5..8eb952e28b2 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -988,7 +988,7 @@ C++ includes: SafePointerVector.h %feature("docstring") SafePointerVector::SafePointerVector "SafePointerVector< T >::SafePointerVector(const SafePointerVector &other) "; -%feature("docstring") SafePointerVector::SafePointerVector "SafePointerVector< T >::SafePointerVector(SafePointerVector &&other) +%feature("docstring") SafePointerVector::SafePointerVector "SafePointerVector< T >::SafePointerVector(SafePointerVector &&other) noexcept "; %feature("docstring") SafePointerVector::~SafePointerVector "SafePointerVector< T >::~SafePointerVector() -- GitLab