summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2018-04-25 09:30:56 +0200
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2018-05-02 17:01:58 +0200
commit39ffec281af577c766c619d568f7a7051d108b00 (patch)
tree79c527cc3871b9b113f1aabffb3cef9647ebb7be /src/test
parentMerge PR #21762 into master (diff)
downloadceph-39ffec281af577c766c619d568f7a7051d108b00.tar.xz
ceph-39ffec281af577c766c619d568f7a7051d108b00.zip
misc: mark constructors as explicit
Set 218 constructors as explicit to avoid implicit usage. Fix for cppcheck warning: Class has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided. For more information check: https://www.codeproject.com/Articles/28663/Explicit-Constructor-in-C Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/cls_rbd/test_cls_rbd.cc2
-rw-r--r--src/test/common/test_lru.cc2
-rw-r--r--src/test/common/test_mclock_priority_queue.cc2
-rw-r--r--src/test/common/test_static_ptr.cc2
-rw-r--r--src/test/encoding/test_ceph_time.h2
-rw-r--r--src/test/fio/fio_ceph_objectstore.cc4
-rw-r--r--src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc2
-rw-r--r--src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc2
-rw-r--r--src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc2
-rw-r--r--src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc2
-rw-r--r--src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc2
-rw-r--r--src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc2
-rw-r--r--src/test/librbd/exclusive_lock/test_mock_PreAcquireRequest.cc2
-rw-r--r--src/test/librbd/journal/test_mock_OpenRequest.cc2
-rw-r--r--src/test/librbd/journal/test_mock_PromoteRequest.cc2
-rw-r--r--src/test/librbd/journal/test_mock_Replay.cc2
-rw-r--r--src/test/librbd/mirror/test_mock_DisableRequest.cc2
-rw-r--r--src/test/librbd/test_librbd.cc4
-rw-r--r--src/test/librbd/test_mirroring.cc2
-rw-r--r--src/test/librbd/test_mock_DeepCopyRequest.cc2
-rw-r--r--src/test/librbd/test_mock_ManagedLock.cc2
-rw-r--r--src/test/librgw_file_aw.cc2
-rw-r--r--src/test/librgw_file_gp.cc2
-rw-r--r--src/test/mon/PGMap.cc2
-rw-r--r--src/test/msgr/test_async_networkstack.cc14
-rw-r--r--src/test/objectstore/BitAllocator_test.cc2
-rw-r--r--src/test/objectstore/store_test_fixture.h2
-rw-r--r--src/test/osd/types.cc4
-rw-r--r--src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc2
-rw-r--r--src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc2
-rw-r--r--src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc2
-rw-r--r--src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc2
-rw-r--r--src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc2
-rw-r--r--src/test/rbd_mirror/test_PoolWatcher.cc2
-rw-r--r--src/test/rbd_mirror/test_mock_ImageSync.cc2
-rw-r--r--src/test/rgw/test_rgw_common.h2
-rw-r--r--src/test/rgw/test_rgw_iam_policy.cc2
-rw-r--r--src/test/rgw/test_rgw_period_history.cc2
-rw-r--r--src/test/test_any.cc6
-rw-r--r--src/test/test_denc.cc2
-rw-r--r--src/test/test_mempool.cc2
41 files changed, 52 insertions, 52 deletions
diff --git a/src/test/cls_rbd/test_cls_rbd.cc b/src/test/cls_rbd/test_cls_rbd.cc
index 8558c97f88c..201053b8133 100644
--- a/src/test/cls_rbd/test_cls_rbd.cc
+++ b/src/test/cls_rbd/test_cls_rbd.cc
@@ -1616,7 +1616,7 @@ TEST_F(TestClsRbd, mirror_image_status) {
struct WatchCtx : public librados::WatchCtx2 {
librados::IoCtx *m_ioctx;
- WatchCtx(librados::IoCtx *ioctx) : m_ioctx(ioctx) {}
+ explicit WatchCtx(librados::IoCtx *ioctx) : m_ioctx(ioctx) {}
void handle_notify(uint64_t notify_id, uint64_t cookie,
uint64_t notifier_id, bufferlist& bl_) override {
bufferlist bl;
diff --git a/src/test/common/test_lru.cc b/src/test/common/test_lru.cc
index 5db18314c4b..29f32aac373 100644
--- a/src/test/common/test_lru.cc
+++ b/src/test/common/test_lru.cc
@@ -24,7 +24,7 @@ class Item : public LRUObject {
public:
int id;
Item() : id(0) {}
- Item(int i) : id(i) {}
+ explicit Item(int i) : id(i) {}
void set(int i) {id = i;}
};
diff --git a/src/test/common/test_mclock_priority_queue.cc b/src/test/common/test_mclock_priority_queue.cc
index 3db94d8a56f..56d264090d0 100644
--- a/src/test/common/test_mclock_priority_queue.cc
+++ b/src/test/common/test_mclock_priority_queue.cc
@@ -25,7 +25,7 @@ struct Request {
value(0)
{}
Request(const Request& o) = default;
- Request(int value) :
+ explicit Request(int value) :
value(value)
{}
};
diff --git a/src/test/common/test_static_ptr.cc b/src/test/common/test_static_ptr.cc
index bfa5733d817..29b45badaea 100644
--- a/src/test/common/test_static_ptr.cc
+++ b/src/test/common/test_static_ptr.cc
@@ -45,7 +45,7 @@ public:
class great_grandchild : public grandchild {
public:
- great_grandchild(int val) : grandchild(val) {}
+ explicit great_grandchild(int val) : grandchild(val) {}
int call(int n) override { return n + val; }
};
diff --git a/src/test/encoding/test_ceph_time.h b/src/test/encoding/test_ceph_time.h
index 18f89314b7a..138c9131064 100644
--- a/src/test/encoding/test_ceph_time.h
+++ b/src/test/encoding/test_ceph_time.h
@@ -12,7 +12,7 @@ class real_time_wrapper {
ceph::real_time t;
public:
real_time_wrapper() = default;
- real_time_wrapper(const ceph::real_time& t) : t(t) {}
+ explicit real_time_wrapper(const ceph::real_time& t) : t(t) {}
void encode(bufferlist& bl) const {
using ceph::encode;
diff --git a/src/test/fio/fio_ceph_objectstore.cc b/src/test/fio/fio_ceph_objectstore.cc
index 197ac267516..c020487c6b9 100644
--- a/src/test/fio/fio_ceph_objectstore.cc
+++ b/src/test/fio/fio_ceph_objectstore.cc
@@ -254,7 +254,7 @@ struct Engine {
int ref_count;
const bool unlink; //< unlink objects on destruction
- Engine(thread_data* td);
+ explicit Engine(thread_data* td);
~Engine();
static Engine* get_instance(thread_data* td) {
@@ -531,7 +531,7 @@ int fio_ceph_os_getevents(thread_data* td, unsigned int min,
class UnitComplete : public Context {
io_u* u;
public:
- UnitComplete(io_u* u) : u(u) {}
+ explicit UnitComplete(io_u* u) : u(u) {}
void finish(int r) {
// mark the pointer to indicate completion for fio_ceph_os_getevents()
u->engine_data = reinterpret_cast<void*>(1ull);
diff --git a/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
index bd8932e788b..e2a189a76d8 100644
--- a/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
@@ -19,7 +19,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
index 448e5dda89c..d568a1f4d93 100644
--- a/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
@@ -21,7 +21,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc b/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
index b29b875e27d..bebcddcd737 100644
--- a/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
@@ -15,7 +15,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
index 805003e7f51..8dcaf266d6f 100644
--- a/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
@@ -18,7 +18,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
index b43a338baee..e60a4a3be48 100644
--- a/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
@@ -17,7 +17,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc b/src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc
index 0f47a75043d..dd2e2c66906 100644
--- a/src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc
+++ b/src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc
@@ -21,7 +21,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/exclusive_lock/test_mock_PreAcquireRequest.cc b/src/test/librbd/exclusive_lock/test_mock_PreAcquireRequest.cc
index 467dd392494..5b4bce6dd58 100644
--- a/src/test/librbd/exclusive_lock/test_mock_PreAcquireRequest.cc
+++ b/src/test/librbd/exclusive_lock/test_mock_PreAcquireRequest.cc
@@ -16,7 +16,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/journal/test_mock_OpenRequest.cc b/src/test/librbd/journal/test_mock_OpenRequest.cc
index 155c5fd5d80..866ab5bea83 100644
--- a/src/test/librbd/journal/test_mock_OpenRequest.cc
+++ b/src/test/librbd/journal/test_mock_OpenRequest.cc
@@ -15,7 +15,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/journal/test_mock_PromoteRequest.cc b/src/test/librbd/journal/test_mock_PromoteRequest.cc
index 775a1463655..17120dc72c3 100644
--- a/src/test/librbd/journal/test_mock_PromoteRequest.cc
+++ b/src/test/librbd/journal/test_mock_PromoteRequest.cc
@@ -13,7 +13,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/journal/test_mock_Replay.cc b/src/test/librbd/journal/test_mock_Replay.cc
index d5b5da852e4..1c9a9c0875e 100644
--- a/src/test/librbd/journal/test_mock_Replay.cc
+++ b/src/test/librbd/journal/test_mock_Replay.cc
@@ -16,7 +16,7 @@ namespace librbd {
namespace {
struct MockReplayImageCtx : public MockImageCtx {
- MockReplayImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockReplayImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/mirror/test_mock_DisableRequest.cc b/src/test/librbd/mirror/test_mock_DisableRequest.cc
index df5a9c3e76c..6ab1be748e6 100644
--- a/src/test/librbd/mirror/test_mock_DisableRequest.cc
+++ b/src/test/librbd/mirror/test_mock_DisableRequest.cc
@@ -17,7 +17,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc
index 4841ec143b4..a18f67e5a9d 100644
--- a/src/test/librbd/test_librbd.cc
+++ b/src/test/librbd/test_librbd.cc
@@ -712,7 +712,7 @@ TEST_F(TestLibRBD, UpdateWatchAndResize)
Watcher *watcher = static_cast<Watcher *>(arg);
watcher->handle_notify();
}
- Watcher(rbd_image_t &image) : m_image(image) {}
+ explicit Watcher(rbd_image_t &image) : m_image(image) {}
void handle_notify() {
rbd_image_info_t info;
ASSERT_EQ(0, rbd_stat(m_image, &info, sizeof(info)));
@@ -758,7 +758,7 @@ TEST_F(TestLibRBD, UpdateWatchAndResizePP)
std::string name = get_temp_image_name();
uint64_t size = 2 << 20;
struct Watcher : public librbd::UpdateWatchCtx {
- Watcher(librbd::Image &image) : m_image(image) {
+ explicit Watcher(librbd::Image &image) : m_image(image) {
}
void handle_notify() override {
librbd::image_info_t info;
diff --git a/src/test/librbd/test_mirroring.cc b/src/test/librbd/test_mirroring.cc
index ce21e3f8756..b4fdeae3f33 100644
--- a/src/test/librbd/test_mirroring.cc
+++ b/src/test/librbd/test_mirroring.cc
@@ -660,7 +660,7 @@ TEST_F(TestMirroring, RemoveBootstrapped)
// simulate the image is open by rbd-mirror bootstrap
uint64_t handle;
struct MirrorWatcher : public librados::WatchCtx2 {
- MirrorWatcher(librados::IoCtx &ioctx) : m_ioctx(ioctx) {
+ explicit MirrorWatcher(librados::IoCtx &ioctx) : m_ioctx(ioctx) {
}
void handle_notify(uint64_t notify_id, uint64_t cookie,
uint64_t notifier_id, bufferlist& bl) override {
diff --git a/src/test/librbd/test_mock_DeepCopyRequest.cc b/src/test/librbd/test_mock_DeepCopyRequest.cc
index 1148d458400..64ea61d9245 100644
--- a/src/test/librbd/test_mock_DeepCopyRequest.cc
+++ b/src/test/librbd/test_mock_DeepCopyRequest.cc
@@ -23,7 +23,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/librbd/test_mock_ManagedLock.cc b/src/test/librbd/test_mock_ManagedLock.cc
index e4b8c4c0b0c..1a841b4c690 100644
--- a/src/test/librbd/test_mock_ManagedLock.cc
+++ b/src/test/librbd/test_mock_ManagedLock.cc
@@ -16,7 +16,7 @@
namespace librbd {
struct MockManagedLockImageCtx : public MockImageCtx {
- MockManagedLockImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {}
+ explicit MockManagedLockImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {}
};
namespace watcher {
diff --git a/src/test/librgw_file_aw.cc b/src/test/librgw_file_aw.cc
index 3e38728b7c4..859cd14074d 100644
--- a/src/test/librgw_file_aw.cc
+++ b/src/test/librgw_file_aw.cc
@@ -75,7 +75,7 @@ namespace {
std::vector<ZPage*> pages;
struct iovec* iovs;
- ZPageSet(int n) {
+ explicit ZPageSet(int n) {
pages.reserve(n);
iovs = (struct iovec*) calloc(n, sizeof(struct iovec));
for (int page_ix = 0; page_ix < n; ++page_ix) {
diff --git a/src/test/librgw_file_gp.cc b/src/test/librgw_file_gp.cc
index e48952a85d8..80a165418a4 100644
--- a/src/test/librgw_file_gp.cc
+++ b/src/test/librgw_file_gp.cc
@@ -78,7 +78,7 @@ namespace {
std::vector<ZPage*> pages;
struct iovec* iovs;
- ZPageSet(int n) {
+ explicit ZPageSet(int n) {
pages.reserve(n);
iovs = (struct iovec*) calloc(n, sizeof(struct iovec));
for (int page_ix = 0; page_ix < n; ++page_ix) {
diff --git a/src/test/mon/PGMap.cc b/src/test/mon/PGMap.cc
index 79fe772945f..d4fd66e8978 100644
--- a/src/test/mon/PGMap.cc
+++ b/src/test/mon/PGMap.cc
@@ -20,7 +20,7 @@
namespace {
class CheckTextTable : public TextTable {
public:
- CheckTextTable(bool verbose) {
+ explicit CheckTextTable(bool verbose) {
for (int i = 0; i < 4; i++) {
define_column("", TextTable::LEFT, TextTable::LEFT);
}
diff --git a/src/test/msgr/test_async_networkstack.cc b/src/test/msgr/test_async_networkstack.cc
index 81a24c31833..b3d36cae8e0 100644
--- a/src/test/msgr/test_async_networkstack.cc
+++ b/src/test/msgr/test_async_networkstack.cc
@@ -125,7 +125,7 @@ class C_poll : public EventCallback {
static const int sleepus = 500;
public:
- C_poll(EventCenter *c): center(c), woken(false) {}
+ explicit C_poll(EventCenter *c): center(c), woken(false) {}
void do_request(uint64_t r) override {
woken = true;
}
@@ -573,7 +573,7 @@ class StressFactory {
std::random_device rd;
std::default_random_engine rng;
- RandomString(size_t s): slen(s), rng(rd()) {}
+ explicit RandomString(size_t s): slen(s), rng(rd()) {}
void prepare(size_t n) {
static const char alphabet[] =
"abcdefghijklmnopqrstuvwxyz"
@@ -631,7 +631,7 @@ class StressFactory {
class C_delete : public EventCallback {
T *ctxt;
public:
- C_delete(T *c): ctxt(c) {}
+ explicit C_delete(T *c): ctxt(c) {}
void do_request(uint64_t id) override {
delete ctxt;
delete this;
@@ -656,7 +656,7 @@ class StressFactory {
class Client_read_handle : public EventCallback {
Client *c;
public:
- Client_read_handle(Client *_c): c(_c) {}
+ explicit Client_read_handle(Client *_c): c(_c) {}
void do_request(uint64_t id) override {
c->do_read_request();
}
@@ -665,7 +665,7 @@ class StressFactory {
class Client_write_handle : public EventCallback {
Client *c;
public:
- Client_write_handle(Client *_c): c(_c) {}
+ explicit Client_write_handle(Client *_c): c(_c) {}
void do_request(uint64_t id) override {
c->do_write_request();
}
@@ -795,7 +795,7 @@ class StressFactory {
class Server_read_handle : public EventCallback {
Server *s;
public:
- Server_read_handle(Server *_s): s(_s) {}
+ explicit Server_read_handle(Server *_s): s(_s) {}
void do_request(uint64_t id) override {
s->do_read_request();
}
@@ -804,7 +804,7 @@ class StressFactory {
class Server_write_handle : public EventCallback {
Server *s;
public:
- Server_write_handle(Server *_s): s(_s) {}
+ explicit Server_write_handle(Server *_s): s(_s) {}
void do_request(uint64_t id) override {
s->do_write_request();
}
diff --git a/src/test/objectstore/BitAllocator_test.cc b/src/test/objectstore/BitAllocator_test.cc
index caaa2e9a8b8..865309cfc6a 100644
--- a/src/test/objectstore/BitAllocator_test.cc
+++ b/src/test/objectstore/BitAllocator_test.cc
@@ -34,7 +34,7 @@ TEST(BitAllocator, test_bmap_iter)
BmapEntityTmp() {
}
- BmapEntityTmp(int num) {
+ explicit BmapEntityTmp(int num) {
m_num = num;
m_len = num;
}
diff --git a/src/test/objectstore/store_test_fixture.h b/src/test/objectstore/store_test_fixture.h
index 5788651f399..02b1235cbc3 100644
--- a/src/test/objectstore/store_test_fixture.h
+++ b/src/test/objectstore/store_test_fixture.h
@@ -17,7 +17,7 @@ public:
boost::scoped_ptr<ObjectStore> store;
ObjectStore::CollectionHandle ch;
- StoreTestFixture(const std::string& type)
+ explicit StoreTestFixture(const std::string& type)
: type(type), data_dir(type + ".test_temp_dir")
{}
diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc
index 2c8a9b476db..777cbe73de6 100644
--- a/src/test/osd/types.cc
+++ b/src/test/osd/types.cc
@@ -1308,7 +1308,7 @@ TEST(pool_opts_t, deep_scrub_interval) {
struct RequiredPredicate : IsPGRecoverablePredicate {
unsigned required_size;
- RequiredPredicate(unsigned required_size) : required_size(required_size) {}
+ explicit RequiredPredicate(unsigned required_size) : required_size(required_size) {}
bool operator()(const set<pg_shard_t> &have) const override {
return have.size() >= required_size;
}
@@ -1317,7 +1317,7 @@ struct RequiredPredicate : IsPGRecoverablePredicate {
using namespace std;
struct MapPredicate {
map<int, pair<PastIntervals::osd_state_t, epoch_t>> states;
- MapPredicate(
+ explicit MapPredicate(
const vector<pair<int, pair<PastIntervals::osd_state_t, epoch_t>>> &_states)
: states(_states.begin(), _states.end()) {}
PastIntervals::osd_state_t operator()(epoch_t start, int osd, epoch_t *lost_at) {
diff --git a/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
index 62c0e43e385..0c3bf6613ff 100644
--- a/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
@@ -21,7 +21,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc b/src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc
index 84511411f74..9e02a82f38d 100644
--- a/src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc
+++ b/src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc
@@ -14,7 +14,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc b/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
index 1414d333597..37556257a3f 100644
--- a/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
+++ b/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
@@ -15,7 +15,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc b/src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc
index f02645b045b..d230944e1b2 100644
--- a/src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc
+++ b/src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc
@@ -15,7 +15,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc b/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
index bcaeaab1229..afabcdfc27a 100644
--- a/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
+++ b/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
@@ -12,7 +12,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/rbd_mirror/test_PoolWatcher.cc b/src/test/rbd_mirror/test_PoolWatcher.cc
index 74383d96b43..02e96422d8c 100644
--- a/src/test/rbd_mirror/test_PoolWatcher.cc
+++ b/src/test/rbd_mirror/test_PoolWatcher.cc
@@ -73,7 +73,7 @@ public:
Cond cond;
ImageIds image_ids;
- PoolWatcherListener(TestPoolWatcher *test) : test(test) {
+ explicit PoolWatcherListener(TestPoolWatcher *test) : test(test) {
}
void handle_update(const std::string &mirror_uuid,
diff --git a/src/test/rbd_mirror/test_mock_ImageSync.cc b/src/test/rbd_mirror/test_mock_ImageSync.cc
index 8414f8ce604..c858f412315 100644
--- a/src/test/rbd_mirror/test_mock_ImageSync.cc
+++ b/src/test/rbd_mirror/test_mock_ImageSync.cc
@@ -19,7 +19,7 @@ namespace librbd {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
diff --git a/src/test/rgw/test_rgw_common.h b/src/test/rgw/test_rgw_common.h
index e434ceb2273..6684dff516e 100644
--- a/src/test/rgw/test_rgw_common.h
+++ b/src/test/rgw/test_rgw_common.h
@@ -39,7 +39,7 @@ struct old_rgw_bucket {
data_pool = index_pool = s;
marker = "";
}
- old_rgw_bucket(const char *n) : name(n) {
+ explicit old_rgw_bucket(const char *n) : name(n) {
data_pool = index_pool = n;
marker = "";
}
diff --git a/src/test/rgw/test_rgw_iam_policy.cc b/src/test/rgw/test_rgw_iam_policy.cc
index ecad57adb72..3bc3a45869c 100644
--- a/src/test/rgw/test_rgw_iam_policy.cc
+++ b/src/test/rgw/test_rgw_iam_policy.cc
@@ -84,7 +84,7 @@ class FakeIdentity : public Identity {
const Principal id;
public:
- FakeIdentity(Principal&& id) : id(std::move(id)) {}
+ explicit FakeIdentity(Principal&& id) : id(std::move(id)) {}
uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override {
abort();
return 0;
diff --git a/src/test/rgw/test_rgw_period_history.cc b/src/test/rgw/test_rgw_period_history.cc
index 8c4eba70026..46519d84385 100644
--- a/src/test/rgw/test_rgw_period_history.cc
+++ b/src/test/rgw/test_rgw_period_history.cc
@@ -45,7 +45,7 @@ using Ids = std::vector<std::string>;
class RecordingPuller : public RGWPeriodHistory::Puller {
const int error;
public:
- RecordingPuller(int error) : error(error) {}
+ explicit RecordingPuller(int error) : error(error) {}
Ids ids;
int pull(const std::string& id, RGWPeriod& period) override {
ids.push_back(id);
diff --git a/src/test/test_any.cc b/src/test/test_any.cc
index 03807da05f7..82d4a43f1dc 100644
--- a/src/test/test_any.cc
+++ b/src/test/test_any.cc
@@ -126,7 +126,7 @@ struct not_noexcept {
}
template<typename ...Args>
- not_noexcept(Args&& ...) noexcept(false) {
+ explicit not_noexcept(Args&& ...) noexcept(false) {
}
template<typename U, typename ...Args>
@@ -395,11 +395,11 @@ struct unmoving {
unmoving() noexcept {}
template<typename... Args>
- unmoving(Args&& ...args) noexcept
+ explicit unmoving(Args&& ...args) noexcept
: a(sizeof...(Args)) {}
template<typename U, typename... Args>
- unmoving(std::initializer_list<U> l) noexcept
+ explicit unmoving(std::initializer_list<U> l) noexcept
: a(-l.size()) {}
template<typename U, typename... Args>
diff --git a/src/test/test_denc.cc b/src/test/test_denc.cc
index a147a626e99..674d7f6bbff 100644
--- a/src/test/test_denc.cc
+++ b/src/test/test_denc.cc
@@ -191,7 +191,7 @@ struct legacy_t {
decode(a, p);
}
legacy_t() {}
- legacy_t(int32_t i) : a(i) {}
+ explicit legacy_t(int32_t i) : a(i) {}
friend bool operator<(const legacy_t& l, const legacy_t& r) {
return l.a < r.a;
}
diff --git a/src/test/test_mempool.cc b/src/test/test_mempool.cc
index 44fcbcbeaca..51e8352099b 100644
--- a/src/test/test_mempool.cc
+++ b/src/test/test_mempool.cc
@@ -176,7 +176,7 @@ struct obj {
int a;
int b;
obj() : a(1), b(1) {}
- obj(int _a) : a(_a), b(2) {}
+ explicit obj(int _a) : a(_a), b(2) {}
obj(int _a,int _b) : a(_a), b(_b) {}
friend inline bool operator<(const obj& l, const obj& r) {
return l.a < r.a;