]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix a missing 'noexcept' on a move ctor 53712/head
authorRonen Friedman <rfriedma@redhat.com>
Thu, 28 Sep 2023 12:04:06 +0000 (07:04 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 2 Dec 2023 14:36:30 +0000 (16:36 +0200)
as a non-default, non-noexcept move ctor is ignored by
stl containers.

See clang-tidy's performance-noexcept-move-constructor

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/PG.h

index 2e82e74ab0127a466bc3f83c64e11063ada7cfec..5f071817d3d60263498c13f67a4ed8698619ac44 100644 (file)
@@ -1446,10 +1446,13 @@ public:
  */
 class PGLockWrapper {
  public:
-  explicit PGLockWrapper(PGRef locked_pg) : m_pg{locked_pg} {}
+  template <typename A_PG_REF>
+  explicit PGLockWrapper(A_PG_REF&& locked_pg)
+      : m_pg{std::forward<A_PG_REF>(locked_pg)}
+  {}
   PGRef pg() { return m_pg; }
   ~PGLockWrapper();
-  PGLockWrapper(PGLockWrapper&& rhs) : m_pg(std::move(rhs.m_pg)) {
+  PGLockWrapper(PGLockWrapper&& rhs) noexcept : m_pg(std::move(rhs.m_pg)) {
     rhs.m_pg = nullptr;
   }
   PGLockWrapper(const PGLockWrapper& rhs) = delete;