]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
misc: mark constructors as explicit 21637/head
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 25 Apr 2018 07:30:56 +0000 (09:30 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 2 May 2018 15:01:58 +0000 (17:01 +0200)
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>
138 files changed:
src/client/Client.h
src/common/Cond.h
src/common/ceph_json.cc
src/common/config.h
src/common/escape.cc
src/common/scrub_types.h
src/crush/CrushLocation.h
src/kv/MemDB.h
src/kv/RocksDBStore.cc
src/librbd/ImageState.cc
src/librbd/Journal.cc
src/librbd/cache/ImageWriteback.h
src/librbd/cache/PassthroughImageCache.h
src/librbd/io/ReadResult.cc
src/mds/CInode.h
src/mds/DamageTable.h
src/mds/OpenFileTable.h
src/mgr/DaemonServer.cc
src/mgr/DaemonState.h
src/mgr/Gil.h
src/mgr/MgrClient.h
src/mgr/MgrSession.h
src/mgr/PyModule.h
src/mgr/PyModuleRegistry.h
src/mgr/PyModuleRunner.h
src/mon/FSCommands.cc
src/msg/async/AsyncMessenger.cc
src/msg/async/dpdk/EventDPDK.h
src/msg/async/dpdk/Packet.h
src/msg/async/dpdk/UserspaceEvent.h
src/msg/async/dpdk/ethernet.h
src/msg/async/dpdk/net.h
src/msg/async/rdma/Infiniband.h
src/msg/async/rdma/RDMAStack.h
src/msg/xio/XioMessenger.h
src/osd/ExtentCache.h
src/osd/OSD.cc
src/osd/OSDCap.h
src/osd/OpQueueItem.h
src/osd/PG.cc
src/osd/PGLog.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/osd/Watch.h
src/osd/osd_types.h
src/osdc/Journaler.cc
src/osdc/Objecter.h
src/rgw/rgw_acl_swift.h
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_auth.h
src/rgw/rgw_auth_filters.h
src/rgw/rgw_auth_keystone.cc
src/rgw/rgw_auth_s3.h
src/rgw/rgw_basic_types.h
src/rgw/rgw_civetweb.h
src/rgw/rgw_client_io.h
src/rgw/rgw_client_io_filters.h
src/rgw/rgw_coroutine.h
src/rgw/rgw_cr_rest.h
src/rgw/rgw_crypt.cc
src/rgw/rgw_crypt_sanitize.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_es_query.cc
src/rgw/rgw_es_query.h
src/rgw/rgw_file.cc
src/rgw/rgw_file.h
src/rgw/rgw_frontend.h
src/rgw/rgw_http_client.cc
src/rgw/rgw_http_client.h
src/rgw/rgw_http_client_curl.cc
src/rgw/rgw_iam_policy.h
src/rgw/rgw_keystone.h
src/rgw/rgw_lc.h
src/rgw/rgw_lc_s3.h
src/rgw/rgw_lib.h
src/rgw/rgw_metadata.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_period_puller.h
src/rgw/rgw_period_pusher.h
src/rgw/rgw_process.h
src/rgw/rgw_rados.h
src/rgw/rgw_realm_reloader.cc
src/rgw/rgw_reshard.h
src/rgw/rgw_rest_client.cc
src/rgw/rgw_rest_config.h
src/rgw/rgw_rest_conn.h
src/rgw/rgw_rest_s3.h
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h
src/rgw/rgw_sync.cc
src/rgw/rgw_sync.h
src/rgw/rgw_sync_log_trim.cc
src/rgw/rgw_sync_module_aws.cc
src/rgw/rgw_sync_module_es_rest.cc
src/rgw/rgw_sync_module_log.cc
src/rgw/rgw_tar.h
src/test/cls_rbd/test_cls_rbd.cc
src/test/common/test_lru.cc
src/test/common/test_mclock_priority_queue.cc
src/test/common/test_static_ptr.cc
src/test/encoding/test_ceph_time.h
src/test/fio/fio_ceph_objectstore.cc
src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
src/test/librbd/exclusive_lock/test_mock_PostAcquireRequest.cc
src/test/librbd/exclusive_lock/test_mock_PreAcquireRequest.cc
src/test/librbd/journal/test_mock_OpenRequest.cc
src/test/librbd/journal/test_mock_PromoteRequest.cc
src/test/librbd/journal/test_mock_Replay.cc
src/test/librbd/mirror/test_mock_DisableRequest.cc
src/test/librbd/test_librbd.cc
src/test/librbd/test_mirroring.cc
src/test/librbd/test_mock_DeepCopyRequest.cc
src/test/librbd/test_mock_ManagedLock.cc
src/test/librgw_file_aw.cc
src/test/librgw_file_gp.cc
src/test/mon/PGMap.cc
src/test/msgr/test_async_networkstack.cc
src/test/objectstore/BitAllocator_test.cc
src/test/objectstore/store_test_fixture.h
src/test/osd/types.cc
src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
src/test/rbd_mirror/image_replayer/test_mock_EventPreprocessor.cc
src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc
src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
src/test/rbd_mirror/test_PoolWatcher.cc
src/test/rbd_mirror/test_mock_ImageSync.cc
src/test/rgw/test_rgw_common.h
src/test/rgw/test_rgw_iam_policy.cc
src/test/rgw/test_rgw_period_history.cc
src/test/test_any.cc
src/test/test_denc.cc
src/test/test_mempool.cc

index e6fde183d288ac16daee4e5d6c874e4d644122f3..c1b9c3b12464fa262c740fc7fc0b0c7284c56e67 100644 (file)
@@ -87,7 +87,7 @@ class MDSCommandOp : public CommandOp
   public:
   mds_gid_t     mds_gid;
 
-  MDSCommandOp(ceph_tid_t t) : CommandOp(t) {}
+  explicit MDSCommandOp(ceph_tid_t t) : CommandOp(t) {}
 };
 
 /* error code for ceph_fuse */
@@ -204,7 +204,7 @@ struct dir_result_t {
     int64_t offset;
     string name;
     InodeRef inode;
-    dentry(int64_t o) : offset(o) {}
+    explicit dentry(int64_t o) : offset(o) {}
     dentry(int64_t o, const string& n, const InodeRef& in) :
       offset(o), name(n), inode(in) {}
   };
index 520a1efeb5799c3fd018c85503307b6239f42798..a7df2b5d74b824011c61ba4c8197fae5eadce289 100644 (file)
@@ -177,7 +177,7 @@ class C_SaferCond : public Context {
   int rval;      ///< return value
 public:
   C_SaferCond() : lock("C_SaferCond"), done(false), rval(0) {}
-  C_SaferCond(const std::string &name) : lock(name), done(false), rval(0) {}
+  explicit C_SaferCond(const std::string &name) : lock(name), done(false), rval(0) {}
   void finish(int r) override { complete(r); }
 
   /// We overload complete in order to not delete the context
index f748bd290c4c7469164dd4cc2d2fcbccaed0bb42..612ecccbfba151bb30b342afbc7c99bc371d1690 100644 (file)
@@ -643,8 +643,8 @@ struct field_entity {
   bool append{false};
 
   field_entity() {}
-  field_entity(const string& n) : is_obj(true), name(n) {}
-  field_entity(int i) : is_obj(false), index(i) {}
+  explicit field_entity(const string& n) : is_obj(true), name(n) {}
+  explicit field_entity(int i) : is_obj(false), index(i) {}
 };
 
 static int parse_entity(const string& s, vector<field_entity> *result)
index a3adf29c7ce14512357a159cd771eab16277789d..61debf3a0842eda0348e1770572cd66aed6194fa 100644 (file)
@@ -127,7 +127,7 @@ public:
   } opt_type_t;
 
   // Create a new md_config_t structure.
-  md_config_t(bool is_daemon=false);
+  explicit md_config_t(bool is_daemon=false);
   ~md_config_t();
 
   // Adds a new observer to this configuration. You can do this at any time,
index 4e6b7f7f66a8ad91a5f4f69f32ee17cdf3806a75..67d68326c2c295ee33383934eaef9438dab592cc 100644 (file)
@@ -120,7 +120,7 @@ struct hex_formatter {
   const char old_fill;
   const std::ostream::fmtflags old_flags;
 
-  hex_formatter(std::ostream& out)
+  explicit hex_formatter(std::ostream& out)
     : out(out),
       old_fill(out.fill('0')),
       old_flags(out.setf(out.hex, out.basefield))
index 88c9a4340c8099044c553ae4686870be83871bee..494bba324a96a306e9fe257ad49d227077fe4371 100644 (file)
@@ -9,7 +9,7 @@
 // wrappers around scrub types to offer the necessary bits other than
 // the minimal set that the lirados requires
 struct object_id_wrapper : public librados::object_id_t {
-  object_id_wrapper(const hobject_t& hoid)
+  explicit object_id_wrapper(const hobject_t& hoid)
     : object_id_t{hoid.oid.name, hoid.nspace, hoid.get_key(), hoid.snap}
   {}
   void encode(bufferlist& bl) const;
@@ -40,7 +40,7 @@ namespace librados {
 struct shard_info_wrapper : public librados::shard_info_t {
 public:
   shard_info_wrapper() = default;
-  shard_info_wrapper(const ScrubMap::object& object) {
+  explicit shard_info_wrapper(const ScrubMap::object& object) {
     set_object(object);
   }
   void set_object(const ScrubMap::object& object);
@@ -103,7 +103,7 @@ namespace librados {
 }
 
 struct inconsistent_obj_wrapper : librados::inconsistent_obj_t {
-  inconsistent_obj_wrapper(const hobject_t& hoid);
+  explicit inconsistent_obj_wrapper(const hobject_t& hoid);
 
   void set_object_info_inconsistency() {
     errors |= obj_err_t::OBJECT_INFO_INCONSISTENCY;
@@ -149,7 +149,7 @@ inline void decode(librados::inconsistent_obj_t& obj,
 
 struct inconsistent_snapset_wrapper : public librados::inconsistent_snapset_t {
   inconsistent_snapset_wrapper() = default;
-  inconsistent_snapset_wrapper(const hobject_t& head);
+  explicit inconsistent_snapset_wrapper(const hobject_t& head);
   void set_headless();
   // soid claims that it is a head or a snapdir, but its SS_ATTR
   // is missing.
index bba737ecac9edbc9e899efdb5fcd06ea47fda2db..6a099689379883210beacb91cb155efa8f53cac7 100644 (file)
@@ -18,7 +18,7 @@ class CrushLocation {
   int _parse(const std::string& s);
 
 public:
-  CrushLocation(CephContext *c) : cct(c) {
+  explicit CrushLocation(CephContext *c) : cct(c) {
     init_on_startup();
   }
 
index e2fa40a2086d9befabaff5e52c82d8571316ead8..16b4aed8dd1274557bae78d5f52ff6f1e7cd6993 100644 (file)
@@ -98,7 +98,7 @@ public:
     void clear() {
       ops.clear();
     }
-    MDBTransactionImpl(MemDB* _db) :m_db(_db)
+    explicit MDBTransactionImpl(MemDB* _db) :m_db(_db)
     {
       ops.clear();
     }
index 7f72e23ed0324318b44dc40cf935b0f42949a076..ee276e2582a6eef38001ac589625cb452ac5b3ab 100644 (file)
@@ -85,7 +85,7 @@ public:
     return store.assoc_name.c_str();
   }
 
-  MergeOperatorRouter(RocksDBStore &_store) : store(_store) {}
+  explicit MergeOperatorRouter(RocksDBStore &_store) : store(_store) {}
 
   bool Merge(const rocksdb::Slice& key,
             const rocksdb::Slice* existing_value,
@@ -124,7 +124,7 @@ class RocksDBStore::MergeOperatorLinker
 private:
   std::shared_ptr<KeyValueDB::MergeOperator> mop;
 public:
-  MergeOperatorLinker(const std::shared_ptr<KeyValueDB::MergeOperator> &o) : mop(o) {}
+  explicit MergeOperatorLinker(const std::shared_ptr<KeyValueDB::MergeOperator> &o) : mop(o) {}
 
   const char *Name() const override {
     return mop->name().c_str();
index 17d364cc94a3c5bec6f209190f058cda136097f5..f487ca9ddb7ffab9bb49d72654546bb0e3657213 100644 (file)
@@ -26,7 +26,7 @@ using util::create_context_callback;
 class ImageUpdateWatchers {
 public:
 
-  ImageUpdateWatchers(CephContext *cct) : m_cct(cct),
+  explicit ImageUpdateWatchers(CephContext *cct) : m_cct(cct),
     m_lock(util::unique_lock_name("librbd::ImageUpdateWatchers::m_lock", this)) {
   }
 
index 1858bbf058bb77bf903d8cb0f78bc91b91903036..961c1943eb0f19e8f1d3a869fa52501c4df708f3 100644 (file)
@@ -1620,7 +1620,7 @@ struct C_RefreshTags : public Context {
   uint64_t tag_tid = 0;
   journal::TagData tag_data;
 
-  C_RefreshTags(util::AsyncOpTracker &async_op_tracker)
+  explicit C_RefreshTags(util::AsyncOpTracker &async_op_tracker)
     : async_op_tracker(async_op_tracker),
       lock("librbd::Journal::C_RefreshTags::lock") {
     async_op_tracker.start_op();
index 9bc9b5e6d26d9c6794c99646466c3e064d70c698..6a790768713583fd825e90c385f04a95ab2ca445 100644 (file)
@@ -24,7 +24,7 @@ class ImageWriteback {
 public:
   typedef std::vector<std::pair<uint64_t,uint64_t> > Extents;
 
-  ImageWriteback(ImageCtxT &image_ctx);
+  explicit ImageWriteback(ImageCtxT &image_ctx);
 
   void aio_read(Extents &&image_extents, ceph::bufferlist *bl,
                 int fadvise_flags, Context *on_finish);
index 2dbe94dbe79beb2cacff78b029faedd67d8ebd63..b5b0a2c3b84a7b90636735d6c3d4d8ffb675909f 100644 (file)
@@ -19,7 +19,7 @@ namespace cache {
 template <typename ImageCtxT = librbd::ImageCtx>
 class PassthroughImageCache : public ImageCache {
 public:
-  PassthroughImageCache(ImageCtx &image_ctx);
+  explicit PassthroughImageCache(ImageCtx &image_ctx);
 
   /// client AIO methods
   void aio_read(Extents&& image_extents, ceph::bufferlist *bl,
index 20ba6f045216bb6d7cff01d5549ed41a1f91ebed..58795202b2d52e3dfc22498ab6c2fcba7c9c8943 100644 (file)
@@ -19,7 +19,7 @@ namespace io {
 struct ReadResult::SetClipLengthVisitor : public boost::static_visitor<void> {
   size_t length;
 
-  SetClipLengthVisitor(size_t length) : length(length) {
+  explicit SetClipLengthVisitor(size_t length) : length(length) {
   }
 
   void operator()(Linear &linear) const {
index ddf2c4bd46dbb71c7fbee668709533ad36ffd472..4e067f01954b11aba07bb8ff688739e9e59b376e 100644 (file)
@@ -427,7 +427,7 @@ public:
     sr_t *snapnode = UNDEF_SRNODE;
 
     projected_inode() = delete;
-    projected_inode(const mempool_inode &in) : inode(in) {}
+    explicit projected_inode(const mempool_inode &in) : inode(in) {}
   };
 
 private:
index ba0f55fb8b046bc2a1a8ea67d2e7aee7d0a4bc16..be2a5331ea3fae536b358064e177a7f1c9b85e49 100644 (file)
@@ -192,7 +192,7 @@ public:
       const inodeno_t ino) const;
 
 
-  DamageTable(const mds_rank_t rank_)
+  explicit DamageTable(const mds_rank_t rank_)
     : rank(rank_)
   {
     assert(rank_ != MDS_RANK_NONE);
index db949d9f8882d59901ef435774c2f2ca1a242a35..c386f69d4ecf40551bc10258c1445c6a37b27062 100644 (file)
@@ -26,7 +26,7 @@ class MDSInternalContextBase;
 class OpenFileTable
 {
 public:
-  OpenFileTable(MDSRank *m) : mds(m) {}
+  explicit OpenFileTable(MDSRank *m) : mds(m) {}
 
   void add_inode(CInode *in);
   void remove_inode(CInode *in);
index ca09f360925186966528731ca94f697537a2597e..ba351b69fa732dd655c12b2a01e0805c21d4b496 100644 (file)
@@ -664,7 +664,7 @@ bool DaemonServer::handle_command(MCommand *m)
     bufferlist odata;
     cmdmap_t cmdmap;
 
-    CommandContext(MCommand *m_)
+    explicit CommandContext(MCommand *m_)
       : m(m_)
     {
     }
@@ -708,7 +708,7 @@ bool DaemonServer::handle_command(MCommand *m)
     bufferlist from_mon;
     string outs;
 
-    ReplyOnFinish(const std::shared_ptr<CommandContext> &cmdctx_)
+    explicit ReplyOnFinish(const std::shared_ptr<CommandContext> &cmdctx_)
       : cmdctx(cmdctx_)
     {}
     void finish(int r) override {
index 3cbf8e5259455955935e1202ba5b91e21d11dcfc..152210ba0082a331ade3a469ac5c6a0d3c1a1c91 100644 (file)
@@ -68,7 +68,7 @@ class DaemonPerfCounters
   // The record of perf stat types, shared between daemons
   PerfCounterTypes &types;
 
-  DaemonPerfCounters(PerfCounterTypes &types_)
+  explicit DaemonPerfCounters(PerfCounterTypes &types_)
     : types(types_)
   {}
 
@@ -119,7 +119,7 @@ class DaemonState
   // The perf counters received in MMgrReport messages
   DaemonPerfCounters perf_counters;
 
-  DaemonState(PerfCounterTypes &types_)
+  explicit DaemonState(PerfCounterTypes &types_)
     : perf_counters(types_)
   {
   }
index ef9e76ac108b9b7ad35ae6b6f3485238d991dfbc..bff2d23329e6d6483c0bb4cbd0580540755e6cf8 100644 (file)
@@ -28,7 +28,7 @@ typedef struct _ts PyThreadState;
 class SafeThreadState
 {
   public:
-  SafeThreadState(PyThreadState *ts_);
+  explicit SafeThreadState(PyThreadState *ts_);
 
   SafeThreadState()
     : ts(nullptr), thread(0)
index 4a044b5d5e3c98b9f5482c3a8f1b8cbbe2aa8e87..3c21ca87b422a1926da09616e914cd8c9b3c2463 100644 (file)
@@ -44,7 +44,7 @@ class MgrCommand : public CommandOp
 {
   public:
 
-  MgrCommand(ceph_tid_t t) : CommandOp(t) {}
+  explicit MgrCommand(ceph_tid_t t) : CommandOp(t) {}
   MgrCommand() : CommandOp() {}
 };
 
index c52e2e177761ac979eeea3791d9c69aa05c7f764..c921ca09ead2f298a6c5b88cddd5720a0a0f1d08 100644 (file)
@@ -25,7 +25,7 @@ struct MgrSession : public RefCountedObject {
 
   std::set<std::string> declared_types;
 
-  MgrSession(CephContext *cct) : RefCountedObject(cct, 0) {}
+  explicit MgrSession(CephContext *cct) : RefCountedObject(cct, 0) {}
   ~MgrSession() override {}
 };
 
index d9ce1695609cab73a6a7d2dfcf1eb88f1e2e47d6..fa8ab77fd46e6e2369e60523cd5362d5122943c8 100644 (file)
@@ -94,7 +94,7 @@ public:
   PyObject *pClass = nullptr;
   PyObject *pStandbyClass = nullptr;
 
-  PyModule(const std::string &module_name_)
+  explicit PyModule(const std::string &module_name_)
     : module_name(module_name_)
   {
   }
index 5fb0148e7102eb12ef15173948d04a1001c9adff..97eff9d4c00caf45f4445ba179959627f0a0e161 100644 (file)
@@ -76,7 +76,7 @@ public:
     return modules_out;
   }
 
-  PyModuleRegistry(LogChannelRef clog_)
+  explicit PyModuleRegistry(LogChannelRef clog_)
     : clog(clog_)
   {}
 
index b4362fae1628682890d41a02dd5b843c8fb19ea8..4b4a53bc97940812c5ac60bb7da68dbd85e0ffe9 100644 (file)
@@ -40,7 +40,7 @@ protected:
     PyModuleRunner *mod;
 
   public:
-    PyModuleRunnerThread(PyModuleRunner *mod_)
+    explicit PyModuleRunnerThread(PyModuleRunner *mod_)
       : mod(mod_) {}
 
     void *entry() override;
index efaff5bddb31365b79ad23ae6f1fe552e4f84ab1..75c527c9c64a7a8281c5842efc2f94f3c565561b 100644 (file)
@@ -79,7 +79,7 @@ class FlagSetHandler : public FileSystemCommandHandler
 class FsNewHandler : public FileSystemCommandHandler
 {
   public:
-  FsNewHandler(Paxos *paxos)
+  explicit FsNewHandler(Paxos *paxos)
     : FileSystemCommandHandler("fs new"), m_paxos(paxos)
   {
   }
@@ -494,7 +494,7 @@ public:
 class AddDataPoolHandler : public FileSystemCommandHandler
 {
   public:
-  AddDataPoolHandler(Paxos *paxos)
+  explicit AddDataPoolHandler(Paxos *paxos)
     : FileSystemCommandHandler("fs add_data_pool"), m_paxos(paxos)
   {}
 
@@ -790,7 +790,7 @@ class AliasHandler : public T
   std::string alias_prefix;
 
   public:
-  AliasHandler(const std::string &new_prefix)
+  explicit AliasHandler(const std::string &new_prefix)
     : T()
   {
     alias_prefix = new_prefix;
index bcb78e67056afa6556e94ab9f8301530ee29f172..032d7314c8650a375e559bb95b71c7a3cda1c6a8 100644 (file)
@@ -218,7 +218,7 @@ struct StackSingleton {
   CephContext *cct;
   std::shared_ptr<NetworkStack> stack;
 
-  StackSingleton(CephContext *c): cct(c) {}
+  explicit StackSingleton(CephContext *c): cct(c) {}
   void ready(std::string &type) {
     if (!stack)
       stack = NetworkStack::create(cct, type);
index 3e2aeb0e39e6f013ff0bb21e2f555df2f11f4324..9744b31a09fe1e436f45fca0aac494a0f31d827b 100644 (file)
@@ -26,7 +26,7 @@ class DPDKDriver : public EventDriver {
  public:
   UserspaceEventManager manager;
 
-  DPDKDriver(CephContext *c): cct(c), manager(c) {}
+  explicit DPDKDriver(CephContext *c): cct(c), manager(c) {}
   virtual ~DPDKDriver() { }
 
   int init(EventCenter *c, int nevent) override;
index 3daab3172d05aa808e3500e6b10cc9a8729d4abb..b22492db86574b36e6afbfbdc475d5384611c024 100644 (file)
@@ -104,7 +104,7 @@ class Packet {
 
     fragment frags[];
 
-    impl(size_t nr_frags = default_nr_frags);
+    explicit impl(size_t nr_frags = default_nr_frags);
     impl(const impl&) = delete;
     impl(fragment frag, size_t nr_frags = default_nr_frags);
 
@@ -180,7 +180,7 @@ class Packet {
               to->frags[0].base);
     }
   };
-  Packet(std::unique_ptr<impl>&& impl) : _impl(std::move(impl)) {}
+  explicit Packet(std::unique_ptr<impl>&& impl) : _impl(std::move(impl)) {}
   std::unique_ptr<impl> _impl;
 public:
   static Packet from_static_data(const char* data, size_t len) {
@@ -190,13 +190,13 @@ public:
   // build empty Packet
   Packet();
   // build empty Packet with nr_frags allocated
-  Packet(size_t nr_frags);
+  explicit Packet(size_t nr_frags);
   // move existing Packet
   Packet(Packet&& x) noexcept;
   // copy data into Packet
   Packet(const char* data, size_t len);
   // copy data into Packet
-  Packet(fragment frag);
+  explicit Packet(fragment frag);
   // zero-copy single fragment
   Packet(fragment frag, deleter del);
   // zero-copy multiple fragments
index 1a725a667d85b716bc717cd60c8acfbe42155424..75f3abf78abae484d3e9397603bda5489c14f9e5 100644 (file)
@@ -46,7 +46,7 @@ class UserspaceEventManager {
   std::list<uint32_t> unused_fds;
 
  public:
-  UserspaceEventManager(CephContext *c): cct(c) {
+  explicit UserspaceEventManager(CephContext *c): cct(c) {
     waiting_fds.resize(1024);
   }
 
index 17546d73a10e7c69642b813b34f4818a0b835bc1..4efd9416cf2806a3c05e5a7acf3616ac350949e0 100644 (file)
 struct ethernet_address {
   ethernet_address() {}
 
-  ethernet_address(const uint8_t *eaddr) {
+  explicit ethernet_address(const uint8_t *eaddr) {
     std::copy(eaddr, eaddr + 6, mac.begin());
   }
 
-  ethernet_address(std::initializer_list<uint8_t> eaddr) {
+  explicit ethernet_address(std::initializer_list<uint8_t> eaddr) {
     assert(eaddr.size() == mac.size());
     std::copy(eaddr.begin(), eaddr.end(), mac.begin());
   }
index c48815b8d3314623d7c8b4af6beec96c6b10b984..53ef473cf95dadb7ebb40bba0063f43209b42d97 100644 (file)
@@ -105,7 +105,7 @@ class interface {
     stream<Packet, ethernet_address> packet_stream;
     std::function<bool (forward_hash&, Packet&, size_t)> forward;
     bool ready() { return packet_stream.started(); }
-    l3_rx_stream(std::function<bool (forward_hash&, Packet&, size_t)>&& fw) : forward(fw) {}
+    explicit l3_rx_stream(std::function<bool (forward_hash&, Packet&, size_t)>&& fw) : forward(fw) {}
   };
   std::unordered_map<uint16_t, l3_rx_stream> _proto_map;
   std::shared_ptr<DPDKDevice> _dev;
index 677c0374f69e24298de721735d17f79ebea84e79..38dbafc2ef1f6ffe97a56d5cf4dba4c5cf1b46ab 100644 (file)
@@ -99,7 +99,7 @@ class DeviceList {
   int num;
   Device** devices;
  public:
-  DeviceList(CephContext *cct): device_list(ibv_get_device_list(&num)) {
+  explicit DeviceList(CephContext *cct): device_list(ibv_get_device_list(&num)) {
     if (device_list == NULL || num == 0) {
       lderr(cct) << __func__ << " failed to get rdma device list.  " << cpp_strerror(errno) << dendl;
       ceph_abort();
@@ -250,7 +250,7 @@ class Infiniband {
       unsigned n_bufs_allocated;
       // true if it is possible to alloc
       // more memory for the pool
-      MemPoolContext(MemoryManager *m) :
+      explicit MemPoolContext(MemoryManager *m) :
         perf_logger(nullptr),
         manager(m),
         n_bufs_allocated(0) {}
index 58d063a7883b738093c51a94d21424bb0020267d..5a60cb4cbfd9eabab1af8cf8cdccc9b5ac5b3d14 100644 (file)
@@ -80,7 +80,7 @@ class RDMADispatcher {
   class C_handle_cq_async : public EventCallback {
     RDMADispatcher *dispatcher;
    public:
-    C_handle_cq_async(RDMADispatcher *w): dispatcher(w) {}
+    explicit C_handle_cq_async(RDMADispatcher *w): dispatcher(w) {}
     void do_request(uint64_t fd) {
       // worker->handle_tx_event();
       dispatcher->handle_async_event();
@@ -138,7 +138,7 @@ class RDMAWorker : public Worker {
   class C_handle_cq_tx : public EventCallback {
     RDMAWorker *worker;
     public:
-    C_handle_cq_tx(RDMAWorker *w): worker(w) {}
+    explicit C_handle_cq_tx(RDMAWorker *w): worker(w) {}
     void do_request(uint64_t fd) {
       worker->handle_pending_message();
     }
@@ -226,7 +226,7 @@ class RDMAConnectedSocketImpl : public ConnectedSocketImpl {
     RDMAConnectedSocketImpl *csi;
     bool active;
    public:
-    C_handle_connection(RDMAConnectedSocketImpl *w): csi(w), active(true) {}
+    explicit C_handle_connection(RDMAConnectedSocketImpl *w): csi(w), active(true) {}
     void do_request(uint64_t fd) {
       if (active)
         csi->handle_connection();
index ccc99412c62b8b0f951cb3e0b54b59c44bc394e8..8ce33d48256d1cc47028034bb791fcedce2d1e9e 100644 (file)
@@ -36,7 +36,7 @@ class XioInit {
   void package_init(CephContext *cct);
 
 protected:
-  XioInit(CephContext *cct) {
+  explicit XioInit(CephContext *cct) {
     this->package_init(cct);
   }
 };
index c5ab2c4915b24be1fc1d0eb02a28d145a96d6a44..ffde71d6322475b6a7604c4f3b5953b54d4814ad 100644 (file)
@@ -172,7 +172,7 @@ private:
 
   struct object_extent_set : boost::intrusive::set_base_hook<> {
     hobject_t oid;
-    object_extent_set(const hobject_t &oid) : oid(oid) {}
+    explicit object_extent_set(const hobject_t &oid) : oid(oid) {}
 
     using set_member_options = boost::intrusive::member_hook<
       extent,
index 1285c22dce15b48e09fd323d48129ef595330f37..51fbc5cbbb603fb50165f5c9e582cbacd96be184 100644 (file)
@@ -4150,7 +4150,7 @@ void OSD::build_initial_pg_history(
       bool operator()(const set<pg_shard_t> &have) const {
        return have.size() >= pi->min_size;
       }
-      min_size_predicate_t(const pg_pool_t *i) : pi(i) {}
+      explicit min_size_predicate_t(const pg_pool_t *i) : pi(i) {}
     } min_size_predicate(osdmap->get_pg_pool(pgid.pgid.pool()));
 
     bool new_interval = PastIntervals::check_new_interval(
index af969bfd3a0cab4964d2ceb73764145795c58850..f6f22166799e00a6e2a7fc5def49575d1ec3329b 100644 (file)
@@ -127,8 +127,8 @@ struct OSDCapMatch {
   std::string object_prefix;
 
   OSDCapMatch() {}
-  OSDCapMatch(const OSDCapPoolTag& pt) : pool_tag(pt) {}
-  OSDCapMatch(const OSDCapPoolNamespace& pns) : pool_namespace(pns) {}
+  explicit OSDCapMatch(const OSDCapPoolTag& pt) : pool_tag(pt) {}
+  explicit OSDCapMatch(const OSDCapPoolNamespace& pns) : pool_namespace(pns) {}
   OSDCapMatch(const OSDCapPoolNamespace& pns, const std::string& pre)
     : pool_namespace(pns), object_prefix(pre) {}
   OSDCapMatch(const std::string& pl, const std::string& pre)
@@ -192,7 +192,7 @@ struct OSDCapGrant {
 
   OSDCapGrant() {}
   OSDCapGrant(const OSDCapMatch& m, const OSDCapSpec& s) : match(m), spec(s) {}
-  OSDCapGrant(const OSDCapProfile& profile) : profile(profile) {
+  explicit OSDCapGrant(const OSDCapProfile& profile) : profile(profile) {
     expand_profile();
   }
 
index 306c57cdcd5e57ec261e28d75eb905bd91867682..749ef0706127a170f2869116f249a9eadee7bbbe 100644 (file)
@@ -172,7 +172,7 @@ protected:
     return pgid;
   }
 public:
-  PGOpQueueable(spg_t pg) : pgid(pg) {}
+  explicit PGOpQueueable(spg_t pg) : pgid(pg) {}
   uint32_t get_queue_token() const override final {
     return get_pgid().ps();
   }
@@ -185,7 +185,7 @@ public:
     class Locker : public OpQueueItem::OrderLocker {
       PGRef pg;
     public:
-      Locker(PGRef pg) : pg(pg) {}
+      explicit Locker(PGRef pg) : pg(pg) {}
       void lock() override final {
        pg->lock();
       }
index c490c47709d23beee9360da9e7a8c7c29b024ab7..44208dc07eecd6e06d0e549efd8efd5efee318cd 100644 (file)
@@ -4569,7 +4569,7 @@ void PG::Scrubber::cleanup_store(ObjectStore::Transaction *t) {
     return;
   struct OnComplete : Context {
     std::unique_ptr<Scrub::Store> store;
-    OnComplete(
+    explicit OnComplete(
       std::unique_ptr<Scrub::Store> &&store)
       : store(std::move(store)) {}
     void finish(int) override {}
index 7c016077324768f0d927c9aa878d7672e6171249..ffc377b317d2592cf0994927c8768831a04f106c 100644 (file)
@@ -136,7 +136,7 @@ public:
     { }
 
     template <typename... Args>
-    IndexedLog(Args&&... args) :
+    explicit IndexedLog(Args&&... args) :
       pg_log_t(std::forward<Args>(args)...),
       complete_to(log.end()),
       last_requested(0),
index 4454f6b90093f9b1b81c9c00e34921916d3d37b0..656eff8f17270dc03aaabb121d6d5c8ab5274838 100644 (file)
@@ -330,7 +330,7 @@ public:
 struct CopyFromFinisher : public PrimaryLogPG::OpFinisher {
   CopyFromCallback *copy_from_callback;
 
-  CopyFromFinisher(CopyFromCallback *copy_from_callback)
+  explicit CopyFromFinisher(CopyFromCallback *copy_from_callback)
     : copy_from_callback(copy_from_callback) {
   }
 
@@ -837,7 +837,7 @@ class PGLSParentFilter : public PGLSFilter {
   inodeno_t parent_ino;
 public:
   CephContext* cct;
-  PGLSParentFilter(CephContext* cct) : cct(cct) {
+  explicit PGLSParentFilter(CephContext* cct) : cct(cct) {
     xattr = "_parent";
   }
   int init(bufferlist::iterator &params) override
@@ -3422,7 +3422,7 @@ public:
 struct SetManifestFinisher : public PrimaryLogPG::OpFinisher {
   OSDOp& osd_op;
 
-  SetManifestFinisher(OSDOp& osd_op) : osd_op(osd_op) {
+  explicit SetManifestFinisher(OSDOp& osd_op) : osd_op(osd_op) {
   }
 
   int execute() override {
@@ -3703,7 +3703,7 @@ public:
 struct PromoteFinisher : public PrimaryLogPG::OpFinisher {
   PromoteManifestCallback *promote_callback;
 
-  PromoteFinisher(PromoteManifestCallback *promote_callback)
+  explicit PromoteFinisher(PromoteManifestCallback *promote_callback)
     : promote_callback(promote_callback) {
   }
 
@@ -5032,7 +5032,7 @@ void PrimaryLogPG::maybe_create_new_object(
 struct ReadFinisher : public PrimaryLogPG::OpFinisher {
   OSDOp& osd_op;
 
-  ReadFinisher(OSDOp& osd_op) : osd_op(osd_op) {
+  explicit ReadFinisher(OSDOp& osd_op) : osd_op(osd_op) {
   }
 
   int execute() override {
index aa0a57e5356fa54a2493f84c6d36bddda2cc8aea..e28bc595e19fbd9c1a3a56d6f89d1981c516ac28 100644 (file)
@@ -1700,7 +1700,7 @@ private:
     struct ReservationCB : public Context {
       PrimaryLogPGRef pg;
       bool canceled;
-      ReservationCB(PrimaryLogPG *pg) : pg(pg), canceled(false) {}
+      explicit ReservationCB(PrimaryLogPG *pg) : pg(pg), canceled(false) {}
       void finish(int) override {
        pg->lock();
        if (!canceled)
index ebcb7059f00511d3a83886052fd0ce0c93c2be12..13d73e52c2202b2b4d2fe237c3f5a309b294c557 100644 (file)
@@ -276,7 +276,7 @@ class WatchConState {
   std::set<WatchRef> watches;
 public:
   CephContext* cct;
-  WatchConState(CephContext* cct) : lock("WatchConState"), cct(cct) {}
+  explicit WatchConState(CephContext* cct) : lock("WatchConState"), cct(cct) {}
 
   /// Add a watch
   void addWatch(
index 2455b94c93a3fb60092274aba0c8d9270d476698..97ef9a7e25b842476df2598c36687e9b60fc397c 100644 (file)
@@ -2690,7 +2690,7 @@ private:
 
   unique_ptr<interval_rep> past_intervals;
 
-  PastIntervals(interval_rep *rep) : past_intervals(rep) {}
+  explicit PastIntervals(interval_rep *rep) : past_intervals(rep) {}
 
 public:
   void add_interval(bool ec_pool, const pg_interval_t &interval) {
index 63cf435e4c056663ff880abd1e5e8b8c30686498..4cff1bad3ca2ab1f80203deb3c16557991d99ab1 100644 (file)
@@ -32,7 +32,7 @@ using std::chrono::seconds;
 class Journaler::C_DelayFlush : public Context {
   Journaler *journaler;
   public:
-  C_DelayFlush(Journaler *j) : journaler(j) {}
+  explicit C_DelayFlush(Journaler *j) : journaler(j) {}
   void finish(int r) override {
     journaler->_do_delayed_flush();
   }
index 20c7825f9dc3d378f7a3854b79ef06531ecb414e..4aa95192f01cace5faf29d4ed97aee77181a19b6 100644 (file)
@@ -284,7 +284,7 @@ struct ObjectOperation {
   // object cmpext
   struct C_ObjectOperation_cmpext : public Context {
     int *prval;
-    C_ObjectOperation_cmpext(int *prval)
+    explicit C_ObjectOperation_cmpext(int *prval)
       : prval(prval) {}
 
     void finish(int r) {
@@ -1313,7 +1313,7 @@ public:
        base_oloc(oloc)
       {}
 
-    op_target_t(pg_t pgid)
+    explicit op_target_t(pg_t pgid)
       : base_oloc(pgid.pool(), pgid.ps()),
        precalc_pgid(true),
        base_pgid(pgid)
@@ -1732,7 +1732,7 @@ public:
       watch_pending_async.pop_front();
     }
 
-    LingerOp(Objecter *o) : linger_id(0),
+    explicit LingerOp(Objecter *o) : linger_id(0),
                            target(object_t(), object_locator_t(), 0),
                            snap(CEPH_NOSNAP), poutbl(NULL), pobjver(NULL),
                            is_watch(false), last_error(0),
index f5b4558da88662febbfbab8db60c53bddc6b4497..f5365b04eb732839e9b9479cbe5e4d87a820b9bc 100644 (file)
@@ -38,7 +38,7 @@ public:
 class RGWAccessControlPolicy_SWIFTAcct : public RGWAccessControlPolicy
 {
 public:
-  RGWAccessControlPolicy_SWIFTAcct(CephContext * const cct)
+  explicit RGWAccessControlPolicy_SWIFTAcct(CephContext * const cct)
     : RGWAccessControlPolicy(cct) {
   }
   ~RGWAccessControlPolicy_SWIFTAcct() override {}
index fcdfe25b0fc687ca9a9b6c8be738b26177765244..f1eb5a1f1b969872c2330173522d9f33afc3d30e 100644 (file)
@@ -217,7 +217,7 @@ class AsioFrontend {
     tcp::socket socket;
     bool use_ssl = false;
 
-    Listener(boost::asio::io_service& service)
+    explicit Listener(boost::asio::io_service& service)
       : acceptor(service), socket(service) {}
   };
   std::vector<Listener> listeners;
index b0330193ccd4711c5dcd0cb9bed8f38821e4529b..bdc0e4c1944fc836a53c0d73e39f0203ef357cba 100644 (file)
@@ -188,7 +188,7 @@ public:
 
     std::pair<IdentityApplier::aplptr_t, Completer::cmplptr_t> result_pair;
 
-    AuthResult(const int reason)
+    explicit AuthResult(const int reason)
       : reason(reason) {
     }
 
@@ -199,7 +199,7 @@ public:
 
     /* Allow only the reasonable combintations - returning just Completer
      * without accompanying IdentityApplier is strictly prohibited! */
-    AuthResult(IdentityApplier::aplptr_t&& applier)
+    explicit AuthResult(IdentityApplier::aplptr_t&& applier)
       : result_pair(std::move(applier), nullptr) {
     }
 
index 7f90b7027a76b240d4f760e19892ce63b19859b7..29003040fb77f9eb542721adb5b84d32863dc685 100644 (file)
@@ -60,7 +60,7 @@ class DecoratedApplier : public rgw::auth::IdentityApplier {
   }
 
 public:
-  DecoratedApplier(DecorateeT&& decoratee)
+  explicit DecoratedApplier(DecorateeT&& decoratee)
     : decoratee(std::forward<DecorateeT>(decoratee)) {
   }
 
index 21a71c5a7337745252c6cddc556a06b951f43544..c3e011c312048735ac7a4faaebe4c3996eee41f4 100644 (file)
@@ -213,7 +213,7 @@ TokenEngine::authenticate(const std::string& token,
   /* This will be initialized on the first call to this method. In C++11 it's
    * also thread-safe. */
   static const struct RolesCacher {
-    RolesCacher(CephContext* const cct) {
+    explicit RolesCacher(CephContext* const cct) {
       get_str_vec(cct->_conf->rgw_keystone_accepted_roles, plain);
       get_str_vec(cct->_conf->rgw_keystone_accepted_admin_roles, admin);
 
@@ -429,7 +429,7 @@ rgw::auth::Engine::result_t EC2Engine::authenticate(
   /* This will be initialized on the first call to this method. In C++11 it's
    * also thread-safe. */
   static const struct RolesCacher {
-    RolesCacher(CephContext* const cct) {
+    explicit RolesCacher(CephContext* const cct) {
       get_str_vec(cct->_conf->rgw_keystone_accepted_roles, plain);
       get_str_vec(cct->_conf->rgw_keystone_accepted_admin_roles, admin);
 
index 6bcdebaf1cc2174bb04c639950e89fecd50bb14a..26c4e828edff0cdc64d4ea8779d024b0ba042da1 100644 (file)
@@ -177,7 +177,7 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
         signature(signature.to_string()) {
     }
 
-    ChunkMeta(const boost::string_view& signature)
+    explicit ChunkMeta(const boost::string_view& signature)
       : signature(signature.to_string()) {
     }
 
@@ -281,7 +281,7 @@ public:
   /* Defined in rgw_auth_s3.cc because of get_v4_exp_payload_hash(). We need
    * the constructor to be public because of the std::make_shared employed by
    * the create() method. */
-  AWSv4ComplSingle(const req_state* const s);
+  explicit AWSv4ComplSingle(const req_state* const s);
 
   ~AWSv4ComplSingle() {
     if (sha256_hash) {
index 76b065ad4774050696e1db48f23c80d10415d4b8..179f2b94a7e094ab996cc9d8ca59c1153792093c 100644 (file)
@@ -119,7 +119,7 @@ class Principal {
   types t;
   rgw_user u;
 
-  Principal(types t)
+  explicit Principal(types t)
     : t(t) {}
 
   Principal(types t, std::string&& n, std::string i)
index 0e309fc2650d2c20c08fcc68ab77ee03a4ede3da..6a6acd5879f0c4c90224ef90dd7e29343f95aeda 100644 (file)
@@ -53,7 +53,7 @@ public:
     return env;
   }
 
-  RGWCivetWeb(mg_connection *_conn);
+  explicit RGWCivetWeb(mg_connection *_conn);
 };
 
 #endif
index 8ee423b2ef51d32e25b27f800f16c373235ca87b..6f904e01be68a17fa5492cf03d25d4caafdbb7dd 100644 (file)
@@ -202,7 +202,7 @@ protected:
   }
 
 public:
-  DecoratedRestfulClient(DecorateeT&& decoratee)
+  explicit DecoratedRestfulClient(DecorateeT&& decoratee)
     : decoratee(std::forward<DecorateeT>(decoratee)) {
   }
 
@@ -308,7 +308,7 @@ class StaticOutputBufferer : public std::streambuf {
   std::streambuf::char_type buffer[BufferSizeV];
 
 public:
-  StaticOutputBufferer(BuffererSink& sink)
+  explicit StaticOutputBufferer(BuffererSink& sink)
     : sink(sink) {
     constexpr size_t len = sizeof(buffer) - sizeof(std::streambuf::char_type);
     std::streambuf::setp(buffer, buffer + len);
index 04761fc782905236a4fdbcb5fcc72993fcc38769..0ae02e26a458a534efd19c7151f25082ada938bc 100644 (file)
@@ -269,7 +269,7 @@ protected:
 
 public:
   template <typename U>
-  ChunkingFilter(U&& decoratee)
+  explicit ChunkingFilter(U&& decoratee)
     : DecoratedRestfulClient<T>(std::forward<U>(decoratee)),
       chunking_enabled(false) {
   }
@@ -331,7 +331,7 @@ protected:
 
 public:
   template <typename U>
-  ConLenControllingFilter(U&& decoratee)
+  explicit ConLenControllingFilter(U&& decoratee)
     : DecoratedRestfulClient<T>(std::forward<U>(decoratee)),
       action(ContentLengthAction::UNKNOWN) {
   }
@@ -399,7 +399,7 @@ protected:
 
 public:
   template <typename U>
-  ReorderingFilter(U&& decoratee)
+  explicit ReorderingFilter(U&& decoratee)
     : DecoratedRestfulClient<T>(std::forward<U>(decoratee)),
       phase(ReorderState::RGW_EARLY_HEADERS) {
   }
index 7212a4fc84a11b3ad2d2c0b3c1fd1ed253960d22..73841f2ebe9459846cfe963eb507ae93d98ca28e 100644 (file)
@@ -62,7 +62,7 @@ protected:
   void _wakeup(void *opaque);
   void _complete(RGWAioCompletionNotifier *cn, const rgw_io_id& io_id, void *user_info);
 public:
-  RGWCompletionManager(CephContext *_cct);
+  explicit RGWCompletionManager(CephContext *_cct);
   ~RGWCompletionManager() override;
 
   void complete(RGWAioCompletionNotifier *cn, const rgw_io_id& io_id, void *user_info);
@@ -192,7 +192,7 @@ class RGWCoroutine : public RefCountedObject, public boost::asio::coroutine {
     utime_t timestamp;
     stringstream status;
 
-    Status(CephContext *_cct) : cct(_cct), lock("RGWCoroutine::Status::lock"), max_history(MAX_COROUTINE_HISTORY) {}
+    explicit Status(CephContext *_cct) : cct(_cct), lock("RGWCoroutine::Status::lock"), max_history(MAX_COROUTINE_HISTORY) {}
 
     deque<StatusItem> history;
 
@@ -334,7 +334,7 @@ class RGWConsumerCR : public RGWCoroutine {
   list<T> product;
 
 public:
-  RGWConsumerCR(CephContext *_cct) : RGWCoroutine(_cct) {}
+  explicit RGWConsumerCR(CephContext *_cct) : RGWCoroutine(_cct) {}
 
   bool has_product() {
     return !product.empty();
@@ -531,7 +531,7 @@ class RGWCoroutinesManagerRegistry : public RefCountedObject, public AdminSocket
   string admin_command;
 
 public:
-  RGWCoroutinesManagerRegistry(CephContext *_cct) : cct(_cct), lock("RGWCoroutinesRegistry::lock") {}
+  explicit RGWCoroutinesManagerRegistry(CephContext *_cct) : cct(_cct), lock("RGWCoroutinesRegistry::lock") {}
   ~RGWCoroutinesManagerRegistry() override;
 
   void add(RGWCoroutinesManager *mgr);
index 0518edcb1ea5e3222d6a01db211b5e257fe46349..da7ed3436c3e6d8852ea78eedb831b54d767d488 100644 (file)
@@ -478,7 +478,7 @@ protected:
   class WriteDrainNotify : public RGWWriteDrainCB {
     RGWStreamWriteHTTPResourceCRF *crf;
   public:
-    WriteDrainNotify(RGWStreamWriteHTTPResourceCRF *_crf) : crf(_crf) {}
+    explicit WriteDrainNotify(RGWStreamWriteHTTPResourceCRF *_crf) : crf(_crf) {}
     void notify(uint64_t pending_size) override;
   } write_drain_notify_cb;
 
index 03dcf6df49dfb0c1cdfe7fa1af447ed4a82484b8..2143bf0c1aaeeb539961247b57ca9cab86247dde 100644 (file)
@@ -37,7 +37,7 @@ private:
   CephContext* cct;
   uint8_t key[AES_256_KEYSIZE];
 public:
-  AES_256_CTR(CephContext* cct): cct(cct) {
+  explicit AES_256_CTR(CephContext* cct): cct(cct) {
   }
   ~AES_256_CTR() {
     memset(key, 0, AES_256_KEYSIZE);
@@ -200,7 +200,7 @@ private:
   CephContext* cct;
   uint8_t key[AES_256_KEYSIZE];
 public:
-  AES_256_CBC(CephContext* cct): cct(cct) {
+  explicit AES_256_CBC(CephContext* cct): cct(cct) {
   }
   ~AES_256_CBC() {
     memset(key, 0, AES_256_KEYSIZE);
index 628577f90c74856e97f5d87a043f646c692cfe2c..548c1240106b61248b81dec882bab9c175ad51e3 100644 (file)
@@ -57,7 +57,7 @@ struct auth {
  */
 struct log_content {
   const boost::string_view buf;
-  log_content(const boost::string_view buf)
+  explicit log_content(const boost::string_view buf)
   : buf(buf) {}
 };
 
index 606372feb0ea5f276aa598ec6a56a43cccc9d544..e1e0013481da47bb05da566ed0fb0f3296aec336 100644 (file)
@@ -963,7 +963,7 @@ public:
 // ostream wrappers to print buckets without copying strings
 struct bucket_str {
   const rgw_bucket& b;
-  bucket_str(const rgw_bucket& b) : b(b) {}
+  explicit bucket_str(const rgw_bucket& b) : b(b) {}
 };
 std::ostream& operator<<(std::ostream& out, const bucket_str& rhs) {
   auto& b = rhs.b;
@@ -979,7 +979,7 @@ std::ostream& operator<<(std::ostream& out, const bucket_str& rhs) {
 
 struct bucket_str_noinstance {
   const rgw_bucket& b;
-  bucket_str_noinstance(const rgw_bucket& b) : b(b) {}
+  explicit bucket_str_noinstance(const rgw_bucket& b) : b(b) {}
 };
 std::ostream& operator<<(std::ostream& out, const bucket_str_noinstance& rhs) {
   auto& b = rhs.b;
@@ -992,7 +992,7 @@ std::ostream& operator<<(std::ostream& out, const bucket_str_noinstance& rhs) {
 
 struct bucket_shard_str {
   const rgw_bucket_shard& bs;
-  bucket_shard_str(const rgw_bucket_shard& bs) : bs(bs) {}
+  explicit bucket_shard_str(const rgw_bucket_shard& bs) : bs(bs) {}
 };
 std::ostream& operator<<(std::ostream& out, const bucket_shard_str& rhs) {
   auto& bs = rhs.bs;
index b30435c09df5cacb4e14b1acc74a3dec6af51f7d..badd334a9568356e3f0ea392c787dd209eee6d4d 100644 (file)
@@ -127,7 +127,7 @@ class ESQueryNode_Bool : public ESQueryNode {
   ESQueryNode *first{nullptr};
   ESQueryNode *second{nullptr};
 public:
-  ESQueryNode_Bool(ESQueryCompiler *compiler) : ESQueryNode(compiler) {}
+  explicit ESQueryNode_Bool(ESQueryCompiler *compiler) : ESQueryNode(compiler) {}
   ESQueryNode_Bool(ESQueryCompiler *compiler, const string& _op, ESQueryNode *_first, ESQueryNode *_second) :ESQueryNode(compiler), op(_op), first(_first), second(_second) {}
   bool init(ESQueryStack *s, ESQueryNode **pnode, string *perr) override {
     bool valid = s->pop(&op);
@@ -279,7 +279,7 @@ public:
 
 class ESQueryNode_Op_Equal : public ESQueryNode_Op {
 public:
-  ESQueryNode_Op_Equal(ESQueryCompiler *compiler) : ESQueryNode_Op(compiler) {}
+  explicit ESQueryNode_Op_Equal(ESQueryCompiler *compiler) : ESQueryNode_Op(compiler) {}
   ESQueryNode_Op_Equal(ESQueryCompiler *compiler, const string& f, const string& v) : ESQueryNode_Op(compiler) {
     op = "==";
     field = f;
index 1341e4443a9e0f25c557f9a95c837814fe6a8092..5b2702006c197a3a1d02225ee390b97f99207d29 100644 (file)
@@ -8,7 +8,7 @@ class ESQueryStack {
   list<string>::iterator iter;
 
 public:
-  ESQueryStack(list<string>& src) {
+  explicit ESQueryStack(list<string>& src) {
     assign(src);
   }
 
@@ -58,7 +58,7 @@ class ESInfixQueryParser {
   bool parse_close_bracket();
 
 public:
-  ESInfixQueryParser(const string& _query) : query(_query), size(query.size()), str(query.c_str()) {}
+  explicit ESInfixQueryParser(const string& _query) : query(_query), size(query.size()), str(query.c_str()) {}
   bool parse(list<string> *result);
 };
 
@@ -74,7 +74,7 @@ struct ESEntityTypeMap {
 
   map<string, EntityType> m;
 
-  ESEntityTypeMap(map<string, EntityType>& _m) : m(_m) {}
+  explicit ESEntityTypeMap(map<string, EntityType>& _m) : m(_m) {}
 
   bool find(const string& entity, EntityType *ptype) {
     auto i = m.find(entity);
index c7795b4a187a48fe633569091f8ef93239bad651..da46af7a2a7c90a0ee5980dec1370a1f70d70286 100644 (file)
@@ -786,7 +786,7 @@ namespace rgw {
     {
       RGWLibFS* fs;
     public:
-      ObjUnref(RGWLibFS* _fs) : fs(_fs) {}
+      explicit ObjUnref(RGWLibFS* _fs) : fs(_fs) {}
       void operator()(RGWFileHandle* fh) const {
        lsubdout(fs->get_context(), rgw, 5)
          << __func__
index b83761fb5ee8e6241188b56e8d5df95643f9e357..5e0c86d0bfbe0a193003fba77f4fae54efda612f 100644 (file)
@@ -261,7 +261,7 @@ namespace rgw {
     friend class RGWLibFS;
 
   private:
-    RGWFileHandle(RGWLibFS* _fs)
+    explicit RGWFileHandle(RGWLibFS* _fs)
       : fs(_fs), bucket(nullptr), parent(nullptr), variant_type{directory()},
        depth(0), flags(FLAG_NONE)
       {
@@ -819,7 +819,7 @@ namespace rgw {
     {
       RGWFileHandle& rgw_fh;
 
-      WriteCompletion(RGWFileHandle& _fh) : rgw_fh(_fh) {
+      explicit WriteCompletion(RGWFileHandle& _fh) : rgw_fh(_fh) {
        rgw_fh.get_fs()->ref(&rgw_fh);
       }
 
index c5d9613536d28c212c1cc28f783748e28d9c9f26..75bdd86d748c100093e4961e16210716e9b6c6ee 100644 (file)
@@ -29,7 +29,7 @@ class RGWFrontendConfig {
                    std::multimap<std::string, std::string>& config_map);
 
 public:
-  RGWFrontendConfig(const std::string& config)
+  explicit RGWFrontendConfig(const std::string& config)
     : config(config) {
   }
 
@@ -85,7 +85,7 @@ struct RGWMongooseEnv : public RGWProcessEnv {
   static constexpr bool prioritize_write = true;
   RWLock mutex;
 
-  RGWMongooseEnv(const RGWProcessEnv &env)
+  explicit RGWMongooseEnv(const RGWProcessEnv &env)
     : RGWProcessEnv(env),
       mutex("RGWCivetWebFrontend", false, true, prioritize_write) {
   }
index d32f1b6734e0cdc0e8fe31eeaece46f879664c61..a659f4c144a6f980b4e5506a9b9ae2e7696ef0f9 100644 (file)
@@ -99,7 +99,7 @@ struct RGWCurlHandle {
   mono_time lastuse;
   CURL* h;
 
-  RGWCurlHandle(CURL* h) : uses(0), h(h) {};
+  explicit RGWCurlHandle(CURL* h) : uses(0), h(h) {};
   CURL* operator*() {
     return this->h;
   }
index 4f40402a0e24755c428363b417a535613a37cdc0..ec5aa20a5722d52e5f79aecef23c9fe58cf1cce0 100644 (file)
@@ -330,7 +330,7 @@ class RGWHTTPManager {
     RGWHTTPManager *manager;
 
   public:
-    ReqsThread(RGWHTTPManager *_m) : manager(_m) {}
+    explicit ReqsThread(RGWHTTPManager *_m) : manager(_m) {}
     void *entry() override;
   };
 
index 4129c4d9045beb58d977cf9a36882f31c0fbf369..346813484690bea21094b4fb1e586d9524ed7454 100644 (file)
@@ -21,7 +21,7 @@ class RGWSSLSetup
 {
   std::vector <std::mutex> locks;
 public:
-  RGWSSLSetup(int n) : locks (n){}
+  explicit RGWSSLSetup(int n) : locks (n){}
 
   void set_lock(int id){
     try {
index 4bb06b1195f65588c60b9f73b2471661aa1f82ad..d00e65e55d08e5663a9e865357648d63074d60db 100644 (file)
@@ -438,7 +438,7 @@ std::ostream& operator <<(ostream& m, const Statement& s);
 struct PolicyParseException : public std::exception {
   rapidjson::ParseResult pr;
 
-  PolicyParseException(rapidjson::ParseResult&& pr)
+  explicit PolicyParseException(rapidjson::ParseResult&& pr)
     : pr(pr) { }
   const char* what() const noexcept override {
     return rapidjson::GetParseError_En(pr.Code());
index 05504527f27330bad17b04ce41159a2c8137e6e7..281582c783745e7c69cb7fdf3c9b66221fcb96b1 100644 (file)
@@ -259,7 +259,7 @@ class TokenCache {
 
   const size_t max;
 
-  TokenCache(const rgw::keystone::Config& config)
+  explicit TokenCache(const rgw::keystone::Config& config)
     : revocator(g_ceph_context, this, config),
       cct(g_ceph_context),
       lock("rgw::keystone::TokenCache"),
@@ -332,7 +332,7 @@ class AdminTokenRequestVer2 : public AdminTokenRequest {
   const Config& conf;
 
 public:
-  AdminTokenRequestVer2(const Config& conf)
+  explicit AdminTokenRequestVer2(const Config& conf)
     : conf(conf) {
   }
   void dump(Formatter *f) const override;
@@ -342,7 +342,7 @@ class AdminTokenRequestVer3 : public AdminTokenRequest {
   const Config& conf;
 
 public:
-  AdminTokenRequestVer3(const Config& conf)
+  explicit AdminTokenRequestVer3(const Config& conf)
     : conf(conf) {
   }
   void dump(Formatter *f) const override;
@@ -352,7 +352,7 @@ class BarbicanTokenRequestVer2 : public AdminTokenRequest {
   CephContext *cct;
 
 public:
-  BarbicanTokenRequestVer2(CephContext * const _cct)
+  explicit BarbicanTokenRequestVer2(CephContext * const _cct)
     : cct(_cct) {
   }
   void dump(Formatter *f) const;
@@ -362,7 +362,7 @@ class BarbicanTokenRequestVer3 : public AdminTokenRequest {
   CephContext *cct;
 
 public:
-  BarbicanTokenRequestVer3(CephContext * const _cct)
+  explicit BarbicanTokenRequestVer3(CephContext * const _cct)
     : cct(_cct) {
   }
   void dump(Formatter *f) const;
index a8ab9c461c6c59bb20724598b798f4093ffd767b..ec8a0e20fea2a1068085e3ce6cf267b26462d895 100644 (file)
@@ -289,7 +289,7 @@ protected:
   bool _add_rule(LCRule *rule);
   bool has_same_action(const lc_op& first, const lc_op& second);
 public:
-  RGWLifecycleConfiguration(CephContext *_cct) : cct(_cct) {}
+  explicit RGWLifecycleConfiguration(CephContext *_cct) : cct(_cct) {}
   RGWLifecycleConfiguration() : cct(NULL) {}
 
   void set_ctx(CephContext *ctx) {
index 10960c6365db574b8c826b3829e38f6418f45c39..93d72ced9b275cbb4d94802f8c42ff1527d5c329 100644 (file)
@@ -189,7 +189,7 @@ private:
   CephContext *cct;
 public:
   LCRule_S3(): cct(nullptr) {}
-  LCRule_S3(CephContext *_cct): cct(_cct) {}
+  explicit LCRule_S3(CephContext *_cct): cct(_cct) {}
   ~LCRule_S3() override {}
 
   void to_xml(ostream& out);
@@ -233,13 +233,13 @@ class RGWLCXMLParser_S3 : public RGWXMLParser
 
   XMLObj *alloc_obj(const char *el) override;
 public:
-  RGWLCXMLParser_S3(CephContext *_cct) : cct(_cct) {}
+  explicit RGWLCXMLParser_S3(CephContext *_cct) : cct(_cct) {}
 };
 
 class RGWLifecycleConfiguration_S3 : public RGWLifecycleConfiguration, public XMLObj
 {
 public:
-  RGWLifecycleConfiguration_S3(CephContext *_cct) : RGWLifecycleConfiguration(_cct) {}
+  explicit RGWLifecycleConfiguration_S3(CephContext *_cct) : RGWLifecycleConfiguration(_cct) {}
   RGWLifecycleConfiguration_S3() : RGWLifecycleConfiguration(NULL) {}
   ~RGWLifecycleConfiguration_S3() override {}
 
index 7ab037f5934a2fe1647ae9d72da7d251bbb03e27..2be201b0ad82c7371710742b3c69204f2233cdae 100644 (file)
@@ -60,7 +60,7 @@ namespace rgw {
     RGWLibIO() {
       get_env().set("HTTP_HOST", "");
     }
-    RGWLibIO(const RGWUserInfo &_user_info)
+    explicit RGWLibIO(const RGWUserInfo &_user_info)
       : user_info(_user_info) {}
 
     int init_env(CephContext *cct) override {
index 82b811a651346e5f8661d903b9e9e52b9e50ca85..b2337587588c61d755ccf2076bcf6d5babd130fc 100644 (file)
@@ -167,7 +167,7 @@ class RGWMetadataLogInfoCompletion : public RefCountedObject {
   std::mutex mutex; //< protects callback between cancel/complete
   boost::optional<info_callback_t> callback; //< cleared on cancel
  public:
-  RGWMetadataLogInfoCompletion(info_callback_t callback);
+  explicit RGWMetadataLogInfoCompletion(info_callback_t callback);
   ~RGWMetadataLogInfoCompletion() override;
 
   librados::IoCtx& get_io_ctx() { return io_ctx; }
index 3b77eff5265da5987b5163fa909825ee46f8e9ee..8c9e568e8a5f83318ba0b0d0e64466988c471cad 100644 (file)
@@ -3324,7 +3324,7 @@ class RGWPutObj_CB : public RGWGetObj_Filter
 {
   RGWPutObj *op;
 public:
-  RGWPutObj_CB(RGWPutObj *_op) : op(_op) {}
+  explicit RGWPutObj_CB(RGWPutObj *_op) : op(_op) {}
   ~RGWPutObj_CB() override {}
 
   int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override {
index da638eb4c0307549d5fd9da478654acfef71ea9c..cfcb86b0dfa5ca4ff419fef840d965e0cfc65c0e 100644 (file)
@@ -186,7 +186,7 @@ protected:
   RGWGetObj_Filter *next{nullptr};
 public:
   RGWGetObj_Filter() {}
-  RGWGetObj_Filter(RGWGetObj_Filter *next): next(next) {}
+  explicit RGWGetObj_Filter(RGWGetObj_Filter *next): next(next) {}
   ~RGWGetObj_Filter() override {}
   /**
    * Passes data through filter.
@@ -555,7 +555,7 @@ protected:
   }
 
 public:
-  DecoratedStreamGetter(StreamGetter& decoratee)
+  explicit DecoratedStreamGetter(StreamGetter& decoratee)
     : decoratee(decoratee) {
   }
   virtual ~DecoratedStreamGetter() = default;
@@ -1081,7 +1081,7 @@ class RGWPutObj_Filter : public RGWPutObjDataProcessor
 protected:
   RGWPutObjDataProcessor* next;
 public:
-  RGWPutObj_Filter(RGWPutObjDataProcessor* next) :
+  explicit RGWPutObj_Filter(RGWPutObjDataProcessor* next) :
   next(next){}
   ~RGWPutObj_Filter() override {}
   int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again) override {
index 1cb8998b2d5f8e0de97ad979b5dd59a37979bf9b..9018d5841dab19794cd86b1b8a05d55505b789b5 100644 (file)
@@ -12,7 +12,7 @@ class RGWPeriod;
 class RGWPeriodPuller : public RGWPeriodHistory::Puller {
   RGWRados *const store;
  public:
-  RGWPeriodPuller(RGWRados* store) : store(store) {}
+  explicit RGWPeriodPuller(RGWRados* store) : store(store) {}
 
   int pull(const std::string& period_id, RGWPeriod& period) override;
 };
index 7146bef42afccaa9ecf410398fc80f4b45d03b16..be833f5fc036e042b9406a4975d65cf9ae6ee38d 100644 (file)
@@ -23,7 +23,7 @@ using RGWZonesNeedPeriod = RGWPeriod;
 class RGWPeriodPusher final : public RGWRealmWatcher::Watcher,
                               public RGWRealmReloader::Pauser {
  public:
-  RGWPeriodPusher(RGWRados* store);
+  explicit RGWPeriodPusher(RGWRados* store);
   ~RGWPeriodPusher() override;
 
   /// respond to realm notifications by pushing new periods to other zones
index 699ee1c5544a3b8d09b32043d647cbc46b20312e..6fa788db0e5f8bb342d42b3f4d6fa03c2ccb0426 100644 (file)
@@ -166,7 +166,7 @@ public:
 class RGWProcessControlThread : public Thread {
   RGWProcess *pprocess;
 public:
-  RGWProcessControlThread(RGWProcess *_pprocess) : pprocess(_pprocess) {}
+  explicit RGWProcessControlThread(RGWProcess *_pprocess) : pprocess(_pprocess) {}
 
   void *entry() override {
     pprocess->run();
index c742932f3ca2cae70efebcaca75c1a1eeb2ebcae..c6a9c473d426beb7c610bc1bc0512b3fbd850352 100644 (file)
@@ -147,8 +147,8 @@ class rgw_obj_select {
 
 public:
   rgw_obj_select() : is_raw(false) {}
-  rgw_obj_select(const rgw_obj& _obj) : obj(_obj), is_raw(false) {}
-  rgw_obj_select(const rgw_raw_obj& _raw_obj) : raw_obj(_raw_obj), is_raw(true) {}
+  explicit rgw_obj_select(const rgw_obj& _obj) : obj(_obj), is_raw(false) {}
+  explicit rgw_obj_select(const rgw_raw_obj& _raw_obj) : raw_obj(_raw_obj), is_raw(true) {}
   rgw_obj_select(const rgw_obj_select& rhs) {
     placement_rule = rhs.placement_rule;
     is_raw = rhs.is_raw;
@@ -1185,7 +1185,7 @@ struct RGWZoneParams : RGWSystemMetaObj {
   JSONFormattable tier_config;
 
   RGWZoneParams() : RGWSystemMetaObj() {}
-  RGWZoneParams(const string& name) : RGWSystemMetaObj(name){}
+  explicit RGWZoneParams(const string& name) : RGWSystemMetaObj(name){}
   RGWZoneParams(const string& id, const string& name) : RGWSystemMetaObj(id, name) {}
   RGWZoneParams(const string& id, const string& name, const string& _realm_id)
     : RGWSystemMetaObj(id, name), realm_id(_realm_id) {}
@@ -1510,7 +1510,7 @@ struct RGWZoneGroup : public RGWSystemMetaObj {
 
   RGWZoneGroup(): is_master(false){}
   RGWZoneGroup(const std::string &id, const std::string &name):RGWSystemMetaObj(id, name) {}
-  RGWZoneGroup(const std::string &_name):RGWSystemMetaObj(_name) {}
+  explicit RGWZoneGroup(const std::string &_name):RGWSystemMetaObj(_name) {}
   RGWZoneGroup(const std::string &_name, bool _is_master, CephContext *cct, RGWRados* store,
               const string& _realm_id, const list<string>& _endpoints)
     : RGWSystemMetaObj(_name, cct , store), endpoints(_endpoints), is_master(_is_master),
@@ -2138,7 +2138,7 @@ class RGWObjectCtxImpl {
   RWLock lock;
 
 public:
-  RGWObjectCtxImpl(RGWRados *_store) : store(_store), lock("RGWObjectCtxImpl") {}
+  explicit RGWObjectCtxImpl(RGWRados *_store) : store(_store), lock("RGWObjectCtxImpl") {}
 
   S *get_state(const T& obj) {
     S *result;
@@ -2222,7 +2222,7 @@ struct tombstone_entry {
   uint64_t pg_ver;
 
   tombstone_entry() = default;
-  tombstone_entry(const RGWObjState& state)
+  explicit tombstone_entry(const RGWObjState& state)
     : mtime(state.mtime), zone_short_id(state.zone_short_id),
       pg_ver(state.pg_ver) {}
 };
index af4a72c5dc8b2079c57a58ceaff998f76f1a5b10..8e7d28db4041b8a5a730bd20ca8934da8d7b55a0 100644 (file)
@@ -44,7 +44,7 @@ RGWRealmReloader::~RGWRealmReloader()
 class RGWRealmReloader::C_Reload : public Context {
   RGWRealmReloader* reloader;
  public:
-  C_Reload(RGWRealmReloader* reloader) : reloader(reloader) {}
+  explicit C_Reload(RGWRealmReloader* reloader) : reloader(reloader) {}
   void finish(int r) override { reloader->reload(); }
 };
 
index 6fe43129906f0fdd642d37594c3895a693a7d076..3e45625d97151aeeef9345f0303e84aa1fe335ba 100644 (file)
@@ -112,7 +112,7 @@ class RGWReshardWait {
 
   int do_wait();
 public:
-  RGWReshardWait(RGWRados *_store) : store(_store) {}
+  explicit RGWReshardWait(RGWRados *_store) : store(_store) {}
   ~RGWReshardWait() {
     assert(going_down);
   }
index cd8b8e08122e154cddfeaabdae51947b0d2fa069..73833eef0fb2031748515d34e036d04a83f6dcca 100644 (file)
@@ -980,7 +980,7 @@ int RGWHTTPStreamRWRequest::send_data(void *ptr, size_t len, bool *pause)
 class StreamIntoBufferlist : public RGWGetDataCB {
   bufferlist& bl;
 public:
-  StreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
+  explicit StreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
   int handle_data(bufferlist& inbl, off_t bl_ofs, off_t bl_len) override {
     bl.claim_append(inbl);
     return bl_len;
index 5751f8b0687fe4d5567928584d6a484766f99b52..b647c8c813eee1dcfa4888a4cf58b36c415e92ec 100644 (file)
@@ -19,7 +19,7 @@ class RGWOp_ZoneGroupMap_Get : public RGWRESTOp {
   RGWZoneGroupMap zonegroup_map;
   bool old_format;
 public:
-  RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
+  explicit RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
   ~RGWOp_ZoneGroupMap_Get() override {}
 
   int verify_permission() override {
index 4ae17760a49447204aa29e06e42c4fc7aadfb7c0..d0819eaffdd23637c671a851a32a60a451c1319a 100644 (file)
@@ -240,7 +240,7 @@ int RGWRESTConn::get_json_resource(const string& resource,  const rgw_http_param
 class RGWStreamIntoBufferlist : public RGWHTTPStreamRWRequest::ReceiveCB {
   bufferlist& bl;
 public:
-  RGWStreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
+  explicit RGWStreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
   int handle_data(bufferlist& inbl, bool *pause) override {
     bl.claim_append(inbl);
     return inbl.length();
index 9e5ef4316aeb00d77cb614e3f7145b738ebd137b..1c928bd98bcb6084247a7bd4ea8b4fbc45733830 100644 (file)
@@ -478,7 +478,7 @@ class RGWHandler_Auth_S3 : public RGWHandler_REST {
   const rgw::auth::StrategyRegistry& auth_registry;
 
 public:
-  RGWHandler_Auth_S3(const rgw::auth::StrategyRegistry& auth_registry)
+  explicit RGWHandler_Auth_S3(const rgw::auth::StrategyRegistry& auth_registry)
     : RGWHandler_REST(),
       auth_registry(auth_registry) {
   }
@@ -503,7 +503,7 @@ class RGWHandler_REST_S3 : public RGWHandler_REST {
 public:
   static int init_from_header(struct req_state *s, int default_formatter, bool configurable_format);
 
-  RGWHandler_REST_S3(const rgw::auth::StrategyRegistry& auth_registry)
+  explicit RGWHandler_REST_S3(const rgw::auth::StrategyRegistry& auth_registry)
     : RGWHandler_REST(),
       auth_registry(auth_registry) {
   }
@@ -772,7 +772,7 @@ class AWSGeneralAbstractor : public AWSEngine::VersionAbstractor {
   auth_data_t get_auth_data_v4(const req_state* s, const bool using_qs) const;
 
 public:
-  AWSGeneralAbstractor(CephContext* const cct)
+  explicit AWSGeneralAbstractor(CephContext* const cct)
     : cct(cct) {
   }
 
@@ -799,7 +799,7 @@ class AWSBrowserUploadAbstractor : public AWSEngine::VersionAbstractor {
   auth_data_t get_auth_data_v4(const req_state* s) const;
 
 public:
-  AWSBrowserUploadAbstractor(CephContext*) {
+  explicit AWSBrowserUploadAbstractor(CephContext*) {
   }
 
   auth_data_t get_auth_data(const req_state* s) const override;
@@ -897,7 +897,7 @@ class S3AuthFactory : public rgw::auth::RemoteApplier::Factory,
   RGWRados* const store;
 
 public:
-  S3AuthFactory(RGWRados* const store)
+  explicit S3AuthFactory(RGWRados* const store)
     : store(store) {
   }
 
index ebf2803b6215d4fbfdac14905bcce5aba7123a34..86133f2ee32f197d2dcdb50ccfe5f1e0fda31013 100644 (file)
@@ -2317,7 +2317,7 @@ RGWOp* RGWSwiftWebsiteHandler::get_ws_redirect_op()
   class RGWMovedPermanently: public RGWOp {
     const std::string location;
   public:
-    RGWMovedPermanently(const std::string& location)
+    explicit RGWMovedPermanently(const std::string& location)
       : location(location) {
     }
 
@@ -2418,7 +2418,7 @@ RGWOp* RGWSwiftWebsiteHandler::get_ws_listing_op()
   public:
     /* Taking prefix_override by value to leverage std::string r-value ref
      * ctor and thus avoid extra memory copying/increasing ref counter. */
-    RGWWebsiteListing(std::string prefix_override)
+    explicit RGWWebsiteListing(std::string prefix_override)
       : prefix_override(std::move(prefix_override)) {
     }
   };
index a0fd8cfd05798859fe34da0d433787e521cba7ca..6ed9346d5b83a7b04b71b8bbc614767c5cf56413 100644 (file)
@@ -385,7 +385,7 @@ protected:
   static int init_from_header(struct req_state* s,
                               const std::string& frontend_prefix);
 public:
-  RGWHandler_REST_SWIFT(const rgw::auth::Strategy& auth_strategy)
+  explicit RGWHandler_REST_SWIFT(const rgw::auth::Strategy& auth_strategy)
     : auth_strategy(auth_strategy) {
   }
   ~RGWHandler_REST_SWIFT() override = default;
index 660b10b6897dff8f5a7fed90eb91f460e7bf4450..bda0b85f54c71361d54cdfcf2a06d3d288419e99 100644 (file)
@@ -2740,7 +2740,7 @@ class MetaMasterStatusCollectCR : public RGWShardCollectCR {
   connection_map::iterator c;
   std::vector<rgw_meta_sync_status>::iterator s;
  public:
-  MetaMasterStatusCollectCR(MasterTrimEnv& env)
+  explicit MetaMasterStatusCollectCR(MasterTrimEnv& env)
     : RGWShardCollectCR(env.store->ctx(), MAX_CONCURRENT_SHARDS),
       env(env), c(env.connections.begin()), s(env.peer_status.begin())
   {}
@@ -2772,7 +2772,7 @@ class MetaMasterTrimCR : public RGWCoroutine {
   int ret{0};
 
  public:
-  MetaMasterTrimCR(MasterTrimEnv& env)
+  explicit MetaMasterTrimCR(MasterTrimEnv& env)
     : RGWCoroutine(env.store->ctx()), env(env)
   {}
 
@@ -2976,7 +2976,7 @@ class MetaPeerTrimCR : public RGWCoroutine {
   rgw_mdlog_info mdlog_info; //< master's mdlog info
 
  public:
-  MetaPeerTrimCR(PeerTrimEnv& env) : RGWCoroutine(env.store->ctx()), env(env) {}
+  explicit MetaPeerTrimCR(PeerTrimEnv& env) : RGWCoroutine(env.store->ctx()), env(env) {}
 
   int operate();
 };
index cea8a5cb886720463e57ee6deec7ab238d020c1e..22ea97c82106ed1c4216442251831497a1033a06 100644 (file)
@@ -116,7 +116,7 @@ class RGWSyncBackoff {
 
   void update_wait_time();
 public:
-  RGWSyncBackoff(int _max_secs = DEFAULT_BACKOFF_MAX) : cur_wait(0), max_secs(_max_secs) {}
+  explicit RGWSyncBackoff(int _max_secs = DEFAULT_BACKOFF_MAX) : cur_wait(0), max_secs(_max_secs) {}
 
   void backoff_sleep();
   void reset() {
@@ -302,7 +302,7 @@ class RGWLastCallerWinsCR : public RGWOrderCallCR
   RGWCoroutine *cr{nullptr};
 
 public:
-  RGWLastCallerWinsCR(CephContext *cct) : RGWOrderCallCR(cct) {}
+  explicit RGWLastCallerWinsCR(CephContext *cct) : RGWOrderCallCR(cct) {}
   ~RGWLastCallerWinsCR() {
     if (cr) {
       cr->put();
index e1002253b8d704a617dd60891a2f358ef88a41ae..1024c9d8d2c0d84eb2f20208166c432a7576abf7 100644 (file)
@@ -101,7 +101,7 @@ struct TrimCounters {
   class Handler : public TrimNotifyHandler {
     Server *const server;
    public:
-    Handler(Server *server) : server(server) {}
+    explicit Handler(Server *server) : server(server) {}
 
     void handle(bufferlist::iterator& input, bufferlist& output) override;
   };
@@ -185,7 +185,7 @@ struct TrimComplete {
   class Handler : public TrimNotifyHandler {
     Server *const server;
    public:
-    Handler(Server *server) : server(server) {}
+    explicit Handler(Server *server) : server(server) {}
 
     void handle(bufferlist::iterator& input, bufferlist& output) override;
   };
index 9231df5f1849da371621a5f93b313d2ce8a98a22..f6ae14bd7ac7d36e23bbe39366ab00cedf194d80 100644 (file)
@@ -660,7 +660,7 @@ struct AWSSyncInstanceEnv {
   AWSSyncConfig conf;
   string id;
 
-  AWSSyncInstanceEnv(AWSSyncConfig& _conf) : conf(_conf) {}
+  explicit AWSSyncInstanceEnv(AWSSyncConfig& _conf) : conf(_conf) {}
 
   void init(RGWDataSyncEnv *sync_env, uint64_t instance_id) {
     char buf[32];
@@ -1241,7 +1241,7 @@ class RGWAWSCompleteMultipartCR : public RGWCoroutine {
   struct CompleteMultipartReq {
     map<int, rgw_sync_aws_multipart_part_info> parts;
 
-    CompleteMultipartReq(const map<int, rgw_sync_aws_multipart_part_info>& _parts) : parts(_parts) {}
+    explicit CompleteMultipartReq(const map<int, rgw_sync_aws_multipart_part_info>& _parts) : parts(_parts) {}
 
     void dump_xml(Formatter *f) const {
       for (auto p : parts) {
index 200335ffa6377778d282e25f312db7b63022cc43..271c549afdbbf842774c830c1ac14a19131d8081 100644 (file)
@@ -263,7 +263,7 @@ void RGWMetadataSearchOp::execute()
 
 class RGWMetadataSearch_ObjStore_S3 : public RGWMetadataSearchOp {
 public:
-  RGWMetadataSearch_ObjStore_S3(const RGWSyncModuleInstanceRef& _sync_module) : RGWMetadataSearchOp(_sync_module) {
+  explicit RGWMetadataSearch_ObjStore_S3(const RGWSyncModuleInstanceRef& _sync_module) : RGWMetadataSearchOp(_sync_module) {
     custom_prefix = "x-amz-meta-";
   }
 
@@ -383,7 +383,7 @@ protected:
     return nullptr;
   }
 public:
-  RGWHandler_REST_MDSearch_S3(const rgw::auth::StrategyRegistry& auth_registry) : RGWHandler_REST_S3(auth_registry) {}
+  explicit RGWHandler_REST_MDSearch_S3(const rgw::auth::StrategyRegistry& auth_registry) : RGWHandler_REST_S3(auth_registry) {}
   virtual ~RGWHandler_REST_MDSearch_S3() {}
 };
 
index 0378c040b6affea5b8ebff6e75c44e83d015c7a7..25e3c61ca0eb205530611651fc3a128773692fad 100644 (file)
@@ -36,7 +36,7 @@ public:
 class RGWLogDataSyncModule : public RGWDataSyncModule {
   string prefix;
 public:
-  RGWLogDataSyncModule(const string& _prefix) : prefix(_prefix) {}
+  explicit RGWLogDataSyncModule(const string& _prefix) : prefix(_prefix) {}
 
   RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch, rgw_zone_set *zones_trace) override {
     ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: sync_object: b=" << bucket_info.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch << dendl;
@@ -57,7 +57,7 @@ public:
 class RGWLogSyncModuleInstance : public RGWSyncModuleInstance {
   RGWLogDataSyncModule data_handler;
 public:
-  RGWLogSyncModuleInstance(const string& prefix) : data_handler(prefix) {}
+  explicit RGWLogSyncModuleInstance(const string& prefix) : data_handler(prefix) {}
   RGWDataSyncModule *get_data_handler() override {
     return &data_handler;
   }
index 2e5add6ed13011d4cb8bb663ca724b2bdfca4f1c..b322a2916daa4e51dac089063e98640251855319 100644 (file)
@@ -92,7 +92,7 @@ protected:
   }
 
 public:
-  HeaderView(const char (&header)[BLOCK_SIZE])
+  explicit HeaderView(const char (&header)[BLOCK_SIZE])
     : header(reinterpret_cast<const header_t*>(header)) {
   }
 
index 8558c97f88c8b77977f4a019f984c8cdbfb502ac..201053b8133cbc73e2f11859c467a1bf760bd64f 100644 (file)
@@ -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;
index 5db18314c4bd9789d2d7085c34f290b54c15b9c5..29f32aac373c5468878318b51f0f0a2007063e12 100644 (file)
@@ -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;}
 };
 
index 3db94d8a56fda6c5f781ac1d888190e7c194efd0..56d264090d0f1cf4808b51a252556bb8982b4898 100644 (file)
@@ -25,7 +25,7 @@ struct Request {
     value(0)
   {}
   Request(const Request& o) = default;
-  Request(int value) :
+  explicit Request(int value) :
     value(value)
   {}
 };
index bfa5733d81798a2acb610c83c2536b9185c9ba1e..29b45badaead9c7d70a969566c1e4aa0812de07c 100644 (file)
@@ -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; }
 };
 
index 18f89314b7ab86fa8844fc03a6b920046771cdd7..138c9131064392dd5a2089936724282b573a00e1 100644 (file)
@@ -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;
index 197ac2675160bd18c865f0bab33aad5c33f6d16a..c020487c6b9f9d7817eedb0932b95d42cb57495f 100644 (file)
@@ -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);
index bd8932e788bb148390c1af21813224284f282209..e2a189a76d828857f7073f7cfb02c359d59eef84 100644 (file)
@@ -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) {
   }
 };
index 448e5dda89c4a8729732fe0ea31216ed2c2970cf..d568a1f4d93e75362418c0a72a6e029857a9e805 100644 (file)
@@ -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) {
   }
 };
index b29b875e27d9c566484a0ac8a87bae793daaa20c..bebcddcd737d8e611914063720f0d1ba2bb9b040 100644 (file)
@@ -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) {
   }
 };
index 805003e7f51f1ebd4bc8f8baef028bbdcce803ee..8dcaf266d6f09594c3da1a5ca63533d278928211 100644 (file)
@@ -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) {
   }
 };
index b43a338baee6dcb079243b554bef92a6b17a8f22..e60a4a3be48e9ce6047450a20da9b873dadc250d 100644 (file)
@@ -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) {
   }
 };
index 0f47a75043da3da48dbf41c6f11ebe939a6520d2..dd2e2c6690665bb7392e454e554d1644477ff1d2 100644 (file)
@@ -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) {
   }
 };
index 467dd3924942009a4a3cea30dab0ab268764c3a5..5b4bce6dd5855d1be73b0924e1837e605dc5fbc7 100644 (file)
@@ -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) {
   }
 };
index 155c5fd5d805601efeece8f2bab8bac0763d6bbb..866ab5bea83e55d37a9e3adafa06b665bb44b6fc 100644 (file)
@@ -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) {
   }
 };
 
index 775a1463655aeed2cec3bdc4964dff021f37431b..17120dc72c3bd85058fce14515e90ea8d2d4f1fc 100644 (file)
@@ -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) {
   }
 };
 
index d5b5da852e4497a820392dda5bb58b460207f079..1c9a9c0875e639fb1068b1195730ba82c4d305bb 100644 (file)
@@ -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) {
   }
 };
 
index df5a9c3e76c6fbe2be973d821c2fb5af0afddf0a..6ab1be748e66efda2a59860fa5fe1104086207ce 100644 (file)
@@ -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) {
   }
 };
 
index 4841ec143b4ca519cc079775914c2a6bd900a709..a18f67e5a9d88c78060749509910c29164414a74 100644 (file)
@@ -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;
index ce21e3f87567c45142bd07707456ce5c0bb7e191..b4fdeae3f3301055418074dc67edfd0bab5a1aef 100644 (file)
@@ -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 {
index 1148d4584002195c56dec8255170cc763fb8e98a..64ea61d9245af0f02051c48c5544edb453d4ba45 100644 (file)
@@ -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) {
   }
 };
index e4b8c4c0b0c10ccffed9ef333da6114dfa35cfca..1a841b4c690d707cbf5e928f66cb6249a1fe229c 100644 (file)
@@ -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 {
index 3e38728b7c466e5cbd8543fa4c444f224e7a9fda..859cd14074dc2a4efe10967ad1b15d003af76e81 100644 (file)
@@ -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) {
index e48952a85d8e4e7a8e0bdf6a0261718ad867eaa2..80a165418a4e4eea3acdd1d48a33c28ed9e6587e 100644 (file)
@@ -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) {
index 79fe772945feb558c092a2546d79d3268d131439..d4fd66e897817febd617300e87bdf0f6df16c5d8 100644 (file)
@@ -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);
       }
index 81a24c31833cb78b2085e6cc1770654c6f6a0fca..b3d36cae8e0a6f7d6c85413c0e63867773f6fcda 100644 (file)
@@ -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();
       }
index caaa2e9a8b8359513c9d40d621510d0ce18a6053..865309cfc6aa022f723d14f0931fe9f69b483f5f 100644 (file)
@@ -34,7 +34,7 @@ TEST(BitAllocator, test_bmap_iter)
       BmapEntityTmp() {
 
       }
-      BmapEntityTmp(int num) {
+      explicit BmapEntityTmp(int num) {
         m_num = num;
         m_len = num;
       }
index 5788651f39933fd5ecf84f77127e0a12fbccbb85..02b1235cbc36c841370c3fd1405eb40a8cf8e50f 100644 (file)
@@ -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")
   {}
 
index 2c8a9b476db22a83f5d0104996e1facf5485aa0b..777cbe73de6fadc1e10e9dbf5db4c6d694f1ea55 100644 (file)
@@ -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) {
index 62c0e43e3856297238e9086feb87f77953f7731f..0c3bf6613ff1f47e872f067b13ce87c91755603a 100644 (file)
@@ -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) {
   }
 };
index 84511411f74b9d98db80c8b3c1c5b587e51336b4..9e02a82f38ddc829ed0ab5c075c92cb2eb2fe47f 100644 (file)
@@ -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) {
   }
 };
index 1414d333597d901c80ae1d8c6ad0c5ed3706b61f..37556257a3fa0a68beb958757fba33512b13f94b 100644 (file)
@@ -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) {
   }
 };
index f02645b045b7a1bba40c647307591b46af88cbd2..d230944e1b2234d518b80ab561b1409e75bc1e9f 100644 (file)
@@ -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) {
   }
 };
index bcaeaab1229ceaa1abcd728ed8667229a9f13a74..afabcdfc27ad874eed3ef820c4006976b067e107 100644 (file)
@@ -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) {
   }
 };
index 74383d96b43cac73447bf755bb393155a8365467..02e96422d8c4d5e58c3d28d29eb2bc874fdd675b 100644 (file)
@@ -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,
index 8414f8ce604ab15d43afce1b574157f426028ef8..c858f412315eec93fa6db114721a96bb7142518c 100644 (file)
@@ -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) {
   }
 };
index e434ceb2273c5bce11044ec0b8615aa45a799e9d..6684dff516e79368679e158f63f9bb7f054eae0f 100644 (file)
@@ -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 = "";
   }
index ecad57adb72e71b236dea07b793f743aaac13df0..3bc3a45869cf0dfe9efcf1bbabb419b665a3a567 100644 (file)
@@ -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;
index 8c4eba70026dd21db6e2847dd68e7bd741e12492..46519d8438558677bb247515d97f3a60338f5d9f 100644 (file)
@@ -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);
index 03807da05f79b206f77dac37896465e3fafafe50..82d4a43f1dc2278b8f11be6e8350438396812438 100644 (file)
@@ -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>
index a147a626e995838fc9bc5e7194ecebf273852905..674d7f6bbff53f1b1599e6b668e461f2787f8849 100644 (file)
@@ -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;
   }
index 44fcbcbeaca2c85d64396810902529ad69a0c6e8..51e8352099bf8c58048aed537d62f7842d2f66fc 100644 (file)
@@ -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;