From 0774d640c0b64b267bdafd4b7cb6c7d0eac555e6 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 27 Sep 2021 11:42:10 -0700 Subject: [PATCH] Fix some lint warnings reported on 6.25 (#8945) Summary: Fix some lint warnings Pull Request resolved: https://github.com/facebook/rocksdb/pull/8945 Test Plan: existing tests, linters Reviewed By: zhichao-cao Differential Revision: D31103824 Pulled By: pdillinger fbshipit-source-id: 4dd9b0c30fa50e588107ac6ed392b2dfb507a5d4 --- db/arena_wrapped_db_iter.h | 2 +- db/kv_checksum.h | 6 +++--- db/listener_test.cc | 12 +++--------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/db/arena_wrapped_db_iter.h b/db/arena_wrapped_db_iter.h index cdf9046a9..3442440c1 100644 --- a/db/arena_wrapped_db_iter.h +++ b/db/arena_wrapped_db_iter.h @@ -34,7 +34,7 @@ class Version; // the same as the inner DBIter. class ArenaWrappedDBIter : public Iterator { public: - virtual ~ArenaWrappedDBIter() { + ~ArenaWrappedDBIter() override { if (db_iter_ != nullptr) { db_iter_->~DBIter(); } else { diff --git a/db/kv_checksum.h b/db/kv_checksum.h index 196c6f7c9..bfec80b51 100644 --- a/db/kv_checksum.h +++ b/db/kv_checksum.h @@ -117,7 +117,7 @@ class ProtectionInfoKVO { friend class ProtectionInfoKVOS; friend class ProtectionInfoKVOC; - ProtectionInfoKVO(T val) : info_(val) { + explicit ProtectionInfoKVO(T val) : info_(val) { static_assert(sizeof(ProtectionInfoKVO) == sizeof(T), ""); } @@ -155,7 +155,7 @@ class ProtectionInfoKVOC { private: friend class ProtectionInfoKVO; - ProtectionInfoKVOC(T val) : kvo_(val) { + explicit ProtectionInfoKVOC(T val) : kvo_(val) { static_assert(sizeof(ProtectionInfoKVOC) == sizeof(T), ""); } @@ -193,7 +193,7 @@ class ProtectionInfoKVOS { private: friend class ProtectionInfoKVO; - ProtectionInfoKVOS(T val) : kvo_(val) { + explicit ProtectionInfoKVOS(T val) : kvo_(val) { static_assert(sizeof(ProtectionInfoKVOS) == sizeof(T), ""); } diff --git a/db/listener_test.cc b/db/listener_test.cc index ce53d297b..e3839fe77 100644 --- a/db/listener_test.cc +++ b/db/listener_test.cc @@ -1427,12 +1427,6 @@ TEST_F(EventListenerTest, BlobDBCompactFiles) { class BlobDBFileLevelEventListener : public EventListener { public: - BlobDBFileLevelEventListener() { - files_started_.store(0); - files_created_.store(0); - files_deleted_.store(0); - } - void OnBlobFileCreationStarted( const BlobFileCreationBriefInfo& info) override { files_started_++; @@ -1471,9 +1465,9 @@ class BlobDBFileLevelEventListener : public EventListener { } private: - std::atomic files_started_; - std::atomic files_created_; - std::atomic files_deleted_; + std::atomic files_started_{}; + std::atomic files_created_{}; + std::atomic files_deleted_{}; }; TEST_F(EventListenerTest, BlobDBFileTest) {