From: liuchang0812 Date: Thu, 16 Feb 2017 02:49:13 +0000 (+0800) Subject: common: add override for common submodule and misc X-Git-Tag: v12.0.1~373^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F13443%2Fhead;p=ceph.git common: add override for common submodule and misc Fixes: http://tracker.ceph.com/issues/18922 Signed-off-by: liuchang0812 --- diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index 3746975ca9dd..922db84793db 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -67,12 +67,12 @@ uint64_t get_random(uint64_t min_val, uint64_t max_val) class CryptoNoneKeyHandler : public CryptoKeyHandler { public: int encrypt(const bufferlist& in, - bufferlist& out, std::string *error) const { + bufferlist& out, std::string *error) const override { out = in; return 0; } int decrypt(const bufferlist& in, - bufferlist& out, std::string *error) const { + bufferlist& out, std::string *error) const override { out = in; return 0; } @@ -82,16 +82,16 @@ class CryptoNone : public CryptoHandler { public: CryptoNone() { } ~CryptoNone() {} - int get_type() const { + int get_type() const override { return CEPH_CRYPTO_NONE; } - int create(bufferptr& secret) { + int create(bufferptr& secret) override { return 0; } - int validate_secret(const bufferptr& secret) { + int validate_secret(const bufferptr& secret) override { return 0; } - CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error) { + CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error) override { return new CryptoNoneKeyHandler; } }; @@ -104,12 +104,12 @@ class CryptoAES : public CryptoHandler { public: CryptoAES() { } ~CryptoAES() {} - int get_type() const { + int get_type() const override { return CEPH_CRYPTO_AES; } - int create(bufferptr& secret); - int validate_secret(const bufferptr& secret); - CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error); + int create(bufferptr& secret) override; + int validate_secret(const bufferptr& secret) override; + CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error) override; }; #ifdef USE_CRYPTOPP @@ -312,11 +312,11 @@ public: } int encrypt(const bufferlist& in, - bufferlist& out, std::string *error) const { + bufferlist& out, std::string *error) const override { return nss_aes_operation(CKA_ENCRYPT, mechanism, key, param, in, out, error); } int decrypt(const bufferlist& in, - bufferlist& out, std::string *error) const { + bufferlist& out, std::string *error) const override { return nss_aes_operation(CKA_DECRYPT, mechanism, key, param, in, out, error); } }; diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index a2d7287c9a44..d44b2b9d7228 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -149,8 +149,8 @@ int main(int argc, const char **argv, const char *envp[]) { cfuse = cf; client = cl; } - virtual ~RemountTest() {} - virtual void *entry() { + ~RemountTest() {} + void *entry() override { #if defined(__linux__) int ver = get_linux_version(); assert(ver != 0); diff --git a/src/client/Client.cc b/src/client/Client.cc index b1ffba576d81..fd0dcde3240b 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2985,7 +2985,7 @@ private: InodeRef inode; public: C_Client_FlushComplete(Client *c, Inode *in) : client(c), inode(in) { } - void finish(int r) { + void finish(int r) override { assert(client->client_lock.is_locked_by_me()); if (r != 0) { client_t const whoami = client->whoami; // For the benefit of ldout prefix @@ -3633,7 +3633,7 @@ public: else ino = in->vino(); } - void finish(int r) { + void finish(int r) override { // _async_invalidate takes the lock when it needs to, call this back from outside of lock. assert(!client->client_lock.is_locked_by_me()); client->_async_invalidate(ino, offset, length); @@ -3940,7 +3940,7 @@ private: Client *client; public: explicit C_Client_Remount(Client *c) : client(c) {} - void finish(int r) { + void finish(int r) override { assert (r == 0); r = client->remount_cb(client->callback_handle); if (r != 0) { @@ -4835,7 +4835,7 @@ public: if (!del) ino.ino = inodeno_t(); } - void finish(int r) { + void finish(int r) override { // _async_dentry_invalidate is responsible for its own locking assert(!client->client_lock.is_locked_by_me()); client->_async_dentry_invalidate(dirino, ino, name); @@ -5812,7 +5812,7 @@ class C_C_Tick : public Context { Client *client; public: explicit C_C_Tick(Client *c) : client(c) {} - void finish(int r) { + void finish(int r) override { // Called back via Timer, which takes client_lock for us assert(client->client_lock.is_locked_by_me()); client->tick(); @@ -12441,7 +12441,7 @@ public: C_Client_RequestInterrupt(Client *c, MetaRequest *r) : client(c), req(r) { req->get(); } - void finish(int r) { + void finish(int r) override { Mutex::Locker l(client->client_lock); assert(req->head.op == CEPH_MDS_OP_SETFILELOCK); client->_interrupt_filelock(req); diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 4650fed25d0c..4b0bae38c887 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -2221,7 +2221,7 @@ public: (*ref)++; lock.Unlock(); } - void finish(int) { + void finish(int) override { lock.Lock(); (*ref)--; cond.Signal(); diff --git a/src/cls/cephfs/cls_cephfs.cc b/src/cls/cephfs/cls_cephfs.cc index 3537f68450b9..61c51823704a 100644 --- a/src/cls/cephfs/cls_cephfs.cc +++ b/src/cls/cephfs/cls_cephfs.cc @@ -127,7 +127,7 @@ class PGLSCephFSFilter : public PGLSFilter { protected: std::string scrub_tag; public: - int init(bufferlist::iterator& params) { + int init(bufferlist::iterator& params) override { try { InodeTagFilterArgs args; args.decode(params); @@ -145,10 +145,10 @@ public: return 0; } - virtual ~PGLSCephFSFilter() {} - virtual bool reject_empty_xattr() { return false; } - virtual bool filter(const hobject_t &obj, bufferlist& xattr_data, - bufferlist& outdata); + ~PGLSCephFSFilter() {} + bool reject_empty_xattr() override { return false; } + bool filter(const hobject_t &obj, bufferlist& xattr_data, + bufferlist& outdata) override; }; bool PGLSCephFSFilter::filter(const hobject_t &obj, diff --git a/src/cls/hello/cls_hello.cc b/src/cls/hello/cls_hello.cc index d181d3fab60b..48759255b6fa 100644 --- a/src/cls/hello/cls_hello.cc +++ b/src/cls/hello/cls_hello.cc @@ -252,7 +252,7 @@ static int bad_writer(cls_method_context_t hctx, bufferlist *in, bufferlist *out class PGLSHelloFilter : public PGLSFilter { string val; public: - int init(bufferlist::iterator& params) { + int init(bufferlist::iterator& params) override { try { ::decode(xattr, params); ::decode(val, params); @@ -262,9 +262,9 @@ public: return 0; } - virtual ~PGLSHelloFilter() {} - virtual bool filter(const hobject_t &obj, bufferlist& xattr_data, - bufferlist& outdata) + ~PGLSHelloFilter() {} + bool filter(const hobject_t &obj, bufferlist& xattr_data, + bufferlist& outdata) override { if (val.size() != xattr_data.length()) return false; diff --git a/src/cls/journal/cls_journal_client.cc b/src/cls/journal/cls_journal_client.cc index 8d25dee64794..88f221328a44 100644 --- a/src/cls/journal/cls_journal_client.cc +++ b/src/cls/journal/cls_journal_client.cc @@ -54,7 +54,7 @@ struct C_ClientList : public C_AioExec { rados_completion->release(); } - virtual void complete(int r) { + void complete(int r) override { if (r < 0) { finish(r); return; @@ -81,7 +81,7 @@ struct C_ClientList : public C_AioExec { } } - virtual void finish(int r) { + void finish(int r) override { on_finish->complete(r); delete this; } @@ -115,7 +115,7 @@ struct C_ImmutableMetadata : public C_AioExec { rados_completion->release(); } - virtual void finish(int r) { + void finish(int r) override { if (r == 0) { try { bufferlist::iterator iter = outbl.begin(); @@ -155,7 +155,7 @@ struct C_MutableMetadata : public C_AioExec { rados_completion->release(); } - virtual void finish(int r) { + void finish(int r) override { if (r == 0) { try { bufferlist::iterator iter = outbl.begin(); diff --git a/src/cls/log/cls_log_client.cc b/src/cls/log/cls_log_client.cc index 88e104597330..799f7eb43dfb 100644 --- a/src/cls/log/cls_log_client.cc +++ b/src/cls/log/cls_log_client.cc @@ -88,7 +88,7 @@ class LogListCtx : public ObjectOperationCompletion { public: LogListCtx(list *_entries, string *_marker, bool *_truncated) : entries(_entries), marker(_marker), truncated(_truncated) {} - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_log_list_ret ret; try { @@ -128,7 +128,7 @@ class LogInfoCtx : public ObjectOperationCompletion { cls_log_header *header; public: explicit LogInfoCtx(cls_log_header *_header) : header(_header) {} - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_log_info_ret ret; try { diff --git a/src/cls/statelog/cls_statelog_client.cc b/src/cls/statelog/cls_statelog_client.cc index 2ba38686a08e..1b68c6f3fb3d 100644 --- a/src/cls/statelog/cls_statelog_client.cc +++ b/src/cls/statelog/cls_statelog_client.cc @@ -74,7 +74,7 @@ class StateLogListCtx : public ObjectOperationCompletion { public: StateLogListCtx(list *_entries, string *_marker, bool *_truncated) : entries(_entries), marker(_marker), truncated(_truncated) {} - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_statelog_list_ret ret; try { diff --git a/src/cls/timeindex/cls_timeindex_client.cc b/src/cls/timeindex/cls_timeindex_client.cc index 6b9abce2e7bb..778cf12e0665 100644 --- a/src/cls/timeindex/cls_timeindex_client.cc +++ b/src/cls/timeindex/cls_timeindex_client.cc @@ -111,7 +111,7 @@ public: bool *_truncated) : entries(_entries), marker(_marker), truncated(_truncated) {} - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_timeindex_list_ret ret; try { diff --git a/src/cls/user/cls_user_client.cc b/src/cls/user/cls_user_client.cc index b2b4cbb64846..8bb7d8447b17 100644 --- a/src/cls/user/cls_user_client.cc +++ b/src/cls/user/cls_user_client.cc @@ -49,7 +49,7 @@ class ClsUserListCtx : public ObjectOperationCompletion { public: ClsUserListCtx(list *_entries, string *_marker, bool *_truncated, int *_pret) : entries(_entries), marker(_marker), truncated(_truncated), pret(_pret) {} - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_user_list_buckets_ret ret; try { @@ -102,7 +102,7 @@ public: ret_ctx->put(); } } - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_user_get_header_ret ret; try { diff --git a/src/cls/version/cls_version_client.cc b/src/cls/version/cls_version_client.cc index fafc62e75371..4c463e3e35a2 100644 --- a/src/cls/version/cls_version_client.cc +++ b/src/cls/version/cls_version_client.cc @@ -61,7 +61,7 @@ class VersionReadCtx : public ObjectOperationCompletion { obj_version *objv; public: explicit VersionReadCtx(obj_version *_objv) : objv(_objv) {} - void handle_completion(int r, bufferlist& outbl) { + void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { cls_version_read_ret ret; try { diff --git a/src/common/Timer.cc b/src/common/Timer.cc index 20545e12481b..fb7a1bfbc036 100644 --- a/src/common/Timer.cc +++ b/src/common/Timer.cc @@ -34,7 +34,7 @@ class SafeTimerThread : public Thread { SafeTimer *parent; public: explicit SafeTimerThread(SafeTimer *s) : parent(s) {} - void *entry() { + void *entry() override { parent->timer_thread(); return NULL; } diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index d44927732614..bc1feec69c31 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -488,8 +488,8 @@ int AdminSocket::unregister_command(std::string command) class VersionHook : public AdminSocketHook { public: - virtual bool call(std::string command, cmdmap_t &cmdmap, std::string format, - bufferlist& out) { + bool call(std::string command, cmdmap_t &cmdmap, std::string format, + bufferlist& out) override { if (command == "0") { out.append(CEPH_ADMIN_SOCK_VERSION); } else { @@ -512,7 +512,7 @@ class HelpHook : public AdminSocketHook { AdminSocket *m_as; public: explicit HelpHook(AdminSocket *as) : m_as(as) {} - bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) { + bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) override { Formatter *f = Formatter::create(format, "json-pretty", "json-pretty"); f->open_object_section("help"); for (map::iterator p = m_as->m_help.begin(); @@ -534,7 +534,7 @@ class GetdescsHook : public AdminSocketHook { AdminSocket *m_as; public: explicit GetdescsHook(AdminSocket *as) : m_as(as) {} - bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) { + bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) override { int cmdnum = 0; JSONFormatter jf(false); jf.open_object_section("command_descriptions"); diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 883e7131183e..2de7e1661b3d 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -258,7 +258,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; ~raw_combined() { dec_total_alloc(len); } - raw* clone_empty() { + raw* clone_empty() override { return create(len, alignment); } @@ -314,7 +314,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; dec_total_alloc(len); bdout << "raw_malloc " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; } - raw* clone_empty() { + raw* clone_empty() override { return new raw_malloc(len); } }; @@ -337,7 +337,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; dec_total_alloc(len); bdout << "raw_mmap " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; } - raw* clone_empty() { + raw* clone_empty() override { return new raw_mmap_pages(len); } }; @@ -362,7 +362,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; dec_total_alloc(len); bdout << "raw_posix_aligned " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; } - raw* clone_empty() { + raw* clone_empty() override { return new raw_posix_aligned(len, align); } }; @@ -448,7 +448,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; << buffer::get_total_alloc() << bendl; } - bool can_zero_copy() const { + bool can_zero_copy() const override { return true; } @@ -465,7 +465,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; return 0; } - int zero_copy_to_fd(int fd, loff_t *offset) { + int zero_copy_to_fd(int fd, loff_t *offset) override { assert(!source_consumed); int flags = SPLICE_F_NONBLOCK; ssize_t r = safe_splice_exact(pipefds[0], NULL, fd, offset, len, flags); @@ -478,13 +478,13 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; return 0; } - buffer::raw* clone_empty() { + buffer::raw* clone_empty() override { // cloning doesn't make sense for pipe-based buffers, // and is only used by unit tests for other types of buffers return NULL; } - char *get_data() { + char *get_data() override { if (data) return data; return copy_pipe(pipefds); @@ -601,7 +601,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; dec_total_alloc(len); bdout << "raw_char " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; } - raw* clone_empty() { + raw* clone_empty() override { return new raw_char(len); } }; @@ -618,10 +618,10 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; } raw_unshareable(unsigned l, char *b) : raw(b, l) { } - raw* clone_empty() { + raw* clone_empty() override { return new raw_char(len); } - bool is_shareable() { + bool is_shareable() override { return false; // !shareable, will force make_shareable() } ~raw_unshareable() { @@ -635,7 +635,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; raw_static(const char *d, unsigned l) : raw((char*)d, l) { } ~raw_static() {} - raw* clone_empty() { + raw* clone_empty() override { return new buffer::raw_char(len); } }; @@ -646,7 +646,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; raw_claim_buffer(const char *b, unsigned l, deleter d) : raw((char*)b, l), del(std::move(d)) { } ~raw_claim_buffer() {} - raw* clone_empty() { + raw* clone_empty() override { return new buffer::raw_char(len); } }; diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index bf47a224696e..689ecca451f7 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -51,19 +51,19 @@ class LockdepObs : public md_config_obs_t { public: explicit LockdepObs(CephContext *cct) : m_cct(cct), m_registered(false) { } - virtual ~LockdepObs() { + ~LockdepObs() { if (m_registered) { lockdep_unregister_ceph_context(m_cct); } } - const char** get_tracked_conf_keys() const { + const char** get_tracked_conf_keys() const override { static const char *KEYS[] = {"lockdep", NULL}; return KEYS; } void handle_conf_change(const md_config_t *conf, - const std::set &changed) { + const std::set &changed) override { if (conf->lockdep && !m_registered) { lockdep_register_ceph_context(m_cct); m_registered = true; @@ -97,7 +97,7 @@ public: } // md_config_obs_t - const char** get_tracked_conf_keys() const { + const char** get_tracked_conf_keys() const override { static const char *KEYS[] = { "mempool_debug", NULL @@ -106,7 +106,7 @@ public: } void handle_conf_change(const md_config_t *conf, - const std::set &changed) { + const std::set &changed) override { if (changed.count("mempool_debug")) { mempool::set_debug_mode(cct->_conf->mempool_debug); } @@ -114,7 +114,7 @@ public: // AdminSocketHook bool call(std::string command, cmdmap_t& cmdmap, std::string format, - bufferlist& out) { + bufferlist& out) override { if (command == "dump_mempools") { std::unique_ptr f(Formatter::create(format)); f->open_object_section("mempools"); @@ -140,7 +140,7 @@ public: ~CephContextServiceThread() {} - void *entry() + void *entry() override { while (1) { Mutex::Locker l(_lock); @@ -203,7 +203,7 @@ class LogObs : public md_config_obs_t { public: explicit LogObs(ceph::logging::Log *l) : log(l) {} - const char** get_tracked_conf_keys() const { + const char** get_tracked_conf_keys() const override { static const char *KEYS[] = { "log_file", "log_max_new", @@ -224,7 +224,7 @@ public: } void handle_conf_change(const md_config_t *conf, - const std::set &changed) { + const std::set &changed) override { // stderr if (changed.count("log_to_stderr") || changed.count("err_to_stderr")) { int l = conf->log_to_stderr ? 99 : (conf->err_to_stderr ? -1 : -2); @@ -287,7 +287,7 @@ class CephContextObs : public md_config_obs_t { public: explicit CephContextObs(CephContext *cct) : cct(cct) {} - const char** get_tracked_conf_keys() const { + const char** get_tracked_conf_keys() const override { static const char *KEYS[] = { "enable_experimental_unrecoverable_data_corrupting_features", "crush_location", @@ -297,7 +297,7 @@ public: } void handle_conf_change(const md_config_t *conf, - const std::set &changed) { + const std::set &changed) override { if (changed.count( "enable_experimental_unrecoverable_data_corrupting_features")) { ceph_spin_lock(&cct->_feature_lock); @@ -364,7 +364,7 @@ public: explicit CephContextHook(CephContext *cct) : m_cct(cct) {} bool call(std::string command, cmdmap_t& cmdmap, std::string format, - bufferlist& out) { + bufferlist& out) override { m_cct->do_command(command, cmdmap, format, &out); return true; } diff --git a/src/common/pick_address.cc b/src/common/pick_address.cc index ebce2d553d71..06d58e46cd6d 100644 --- a/src/common/pick_address.cc +++ b/src/common/pick_address.cc @@ -56,11 +56,11 @@ struct Observer : public md_config_obs_t { keys[1] = NULL; } - const char** get_tracked_conf_keys() const { + const char** get_tracked_conf_keys() const override { return (const char **)keys; } void handle_conf_change(const struct md_config_t *conf, - const std::set &changed) { + const std::set &changed) override { // do nothing. } }; diff --git a/src/crush/CrushTester.cc b/src/crush/CrushTester.cc index 635b66530f28..5cf68da2f46d 100644 --- a/src/crush/CrushTester.cc +++ b/src/crush/CrushTester.cc @@ -417,7 +417,7 @@ namespace { public: CrushWalker(const CrushWrapper *crush, unsigned max_id) : Parent(crush), max_id(max_id) {} - void dump_item(const CrushTreeDumper::Item &qi, DumbFormatter *) { + void dump_item(const CrushTreeDumper::Item &qi, DumbFormatter *) override { int type = -1; if (qi.is_bucket()) { if (!crush->get_item_name(qi.id)) { diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 6f81606e1129..932c2c91a9c3 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1687,7 +1687,7 @@ public: } protected: - virtual void dump_item(const CrushTreeDumper::Item &qi, ostream *out) { + void dump_item(const CrushTreeDumper::Item &qi, ostream *out) override { *out << qi.id << "\t" << weightf_t(qi.weight) << "\t"; diff --git a/src/global/signal_handler.cc b/src/global/signal_handler.cc index 66db79d2b209..2f894efd7ec8 100644 --- a/src/global/signal_handler.cc +++ b/src/global/signal_handler.cc @@ -256,7 +256,7 @@ struct SignalHandler : public Thread { } // thread entry point - void *entry() { + void *entry() override { while (!stop) { // build fd list struct pollfd fds[33]; diff --git a/src/journal/JournalMetadata.cc b/src/journal/JournalMetadata.cc index 967529ddb68e..acbe3cb27078 100644 --- a/src/journal/JournalMetadata.cc +++ b/src/journal/JournalMetadata.cc @@ -37,7 +37,7 @@ struct C_GetClient : public Context { client_id(client_id), client(client), on_finish(on_finish) { async_op_tracker.start_op(); } - virtual ~C_GetClient() { + ~C_GetClient() { async_op_tracker.finish_op(); } @@ -70,7 +70,7 @@ struct C_GetClient : public Context { complete(r); } - virtual void finish(int r) override { + void finish(int r) override { on_finish->complete(r); } }; @@ -95,7 +95,7 @@ struct C_AllocateTag : public Context { async_op_tracker.start_op(); tag->data = data; } - virtual ~C_AllocateTag() { + ~C_AllocateTag() { async_op_tracker.finish_op(); } @@ -193,7 +193,7 @@ struct C_AllocateTag : public Context { complete(r); } - virtual void finish(int r) override { + void finish(int r) override { on_finish->complete(r); } }; @@ -216,7 +216,7 @@ struct C_GetTag : public Context { tag_tid(tag_tid), tag(tag), on_finish(on_finish) { async_op_tracker.start_op(); } - virtual ~C_GetTag() { + ~C_GetTag() { async_op_tracker.finish_op(); } @@ -245,7 +245,7 @@ struct C_GetTag : public Context { complete(r); } - virtual void finish(int r) override { + void finish(int r) override { on_finish->complete(r); } }; @@ -275,7 +275,7 @@ struct C_GetTags : public Context { tags(tags), on_finish(on_finish) { async_op_tracker.start_op(); } - virtual ~C_GetTags() { + ~C_GetTags() { async_op_tracker.finish_op(); } @@ -318,7 +318,7 @@ struct C_GetTags : public Context { complete(r); } - virtual void finish(int r) override { + void finish(int r) override { on_finish->complete(r); } }; @@ -330,7 +330,7 @@ struct C_FlushCommitPosition : public Context { C_FlushCommitPosition(Context *commit_position_ctx, Context *on_finish) : commit_position_ctx(commit_position_ctx), on_finish(on_finish) { } - virtual void finish(int r) override { + void finish(int r) override { if (commit_position_ctx != nullptr) { commit_position_ctx->complete(r); } @@ -357,7 +357,7 @@ struct C_AssertActiveTag : public Context { client_id(client_id), tag_tid(tag_tid), on_finish(on_finish) { async_op_tracker.start_op(); } - virtual ~C_AssertActiveTag() { + ~C_AssertActiveTag() { async_op_tracker.finish_op(); } @@ -393,7 +393,7 @@ struct C_AssertActiveTag : public Context { complete(r); } - virtual void finish(int r) { + void finish(int r) override { on_finish->complete(r); } }; diff --git a/src/journal/JournalPlayer.cc b/src/journal/JournalPlayer.cc index 09f2d2ca3f32..b313820c4a83 100644 --- a/src/journal/JournalPlayer.cc +++ b/src/journal/JournalPlayer.cc @@ -21,10 +21,10 @@ struct C_HandleComplete : public Context { : replay_handler(_replay_handler) { replay_handler->get(); } - virtual ~C_HandleComplete() { + ~C_HandleComplete() { replay_handler->put(); } - virtual void finish(int r) { + void finish(int r) override { replay_handler->handle_complete(r); } }; @@ -36,10 +36,10 @@ struct C_HandleEntriesAvailable : public Context { : replay_handler(_replay_handler) { replay_handler->get(); } - virtual ~C_HandleEntriesAvailable() { + ~C_HandleEntriesAvailable() { replay_handler->put(); } - virtual void finish(int r) { + void finish(int r) override { replay_handler->handle_entries_available(); } }; diff --git a/src/journal/JournalRecorder.cc b/src/journal/JournalRecorder.cc index 1917165008fe..d0c6406a3ac4 100644 --- a/src/journal/JournalRecorder.cc +++ b/src/journal/JournalRecorder.cc @@ -28,7 +28,7 @@ struct C_Flush : public Context { pending_flushes(_pending_flushes), ret_val(0) { } - virtual void complete(int r) { + void complete(int r) override { if (r < 0 && ret_val == 0) { ret_val = r; } @@ -38,7 +38,7 @@ struct C_Flush : public Context { delete this; } } - virtual void finish(int r) { + void finish(int r) override { } }; diff --git a/src/journal/JournalTrimmer.cc b/src/journal/JournalTrimmer.cc index ec48f9aaed04..0e60a58437c9 100644 --- a/src/journal/JournalTrimmer.cc +++ b/src/journal/JournalTrimmer.cc @@ -22,8 +22,8 @@ struct JournalTrimmer::C_RemoveSet : public Context { C_RemoveSet(JournalTrimmer *_journal_trimmer, uint64_t _object_set, uint8_t _splay_width); - virtual void complete(int r); - virtual void finish(int r) { + void complete(int r) override; + void finish(int r) override { journal_trimmer->handle_set_removed(r, object_set); journal_trimmer->m_async_op_tracker.finish_op(); } diff --git a/src/kv/LevelDBStore.cc b/src/kv/LevelDBStore.cc index b2793653ac42..a1895b639f4e 100644 --- a/src/kv/LevelDBStore.cc +++ b/src/kv/LevelDBStore.cc @@ -27,7 +27,7 @@ public: } // Write an entry to the log file with the specified format. - void Logv(const char* format, va_list ap) { + void Logv(const char* format, va_list ap) override { dout(1); char buf[65536]; vsnprintf(buf, sizeof(buf), format, ap); diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 75f6941e6715..29f9d0f1e145 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -40,7 +40,7 @@ using std::string; class RocksDBStore::MergeOperatorRouter : public rocksdb::AssociativeMergeOperator { RocksDBStore& store; public: - const char *Name() const { + const char *Name() const override { // Construct a name that rocksDB will validate against. We want to // do this in a way that doesn't constrain the ordering of calls // to set_merge_operator, so sort the merge operators and then @@ -59,11 +59,11 @@ class RocksDBStore::MergeOperatorRouter : public rocksdb::AssociativeMergeOperat MergeOperatorRouter(RocksDBStore &_store) : store(_store) {} - virtual bool Merge(const rocksdb::Slice& key, + bool Merge(const rocksdb::Slice& key, const rocksdb::Slice* existing_value, const rocksdb::Slice& value, std::string* new_value, - rocksdb::Logger* logger) const { + rocksdb::Logger* logger) const override { // Check each prefix for (auto& p : store.merge_ops) { if (p.first.compare(0, p.first.length(), @@ -105,7 +105,7 @@ public: } // Write an entry to the log file with the specified format. - void Logv(const char* format, va_list ap) { + void Logv(const char* format, va_list ap) override { Logv(rocksdb::INFO_LEVEL, format, ap); } @@ -114,7 +114,7 @@ public: // of *this (see @SetInfoLogLevel and @GetInfoLogLevel) will not be // printed. void Logv(const rocksdb::InfoLogLevel log_level, const char* format, - va_list ap) { + va_list ap) override { int v = rocksdb::NUM_INFO_LOG_LEVELS - log_level - 1; dout(v); char buf[65536]; diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 07add406807f..e5b39f1d4c33 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -52,7 +52,7 @@ class C_time_wakeup : public EventCallback { public: explicit C_time_wakeup(AsyncConnectionRef c): conn(c) {} - void do_request(int fd_or_id) { + void do_request(int fd_or_id) override { conn->wakeup_from(fd_or_id); } }; @@ -62,7 +62,7 @@ class C_handle_read : public EventCallback { public: explicit C_handle_read(AsyncConnectionRef c): conn(c) {} - void do_request(int fd_or_id) { + void do_request(int fd_or_id) override { conn->process(); } }; @@ -72,7 +72,7 @@ class C_handle_write : public EventCallback { public: explicit C_handle_write(AsyncConnectionRef c): conn(c) {} - void do_request(int fd) { + void do_request(int fd) override { conn->handle_write(); } }; @@ -81,7 +81,7 @@ class C_clean_handler : public EventCallback { AsyncConnectionRef conn; public: explicit C_clean_handler(AsyncConnectionRef c): conn(c) {} - void do_request(int id) { + void do_request(int id) override { conn->cleanup(); delete this; } @@ -92,7 +92,7 @@ class C_tick_wakeup : public EventCallback { public: explicit C_tick_wakeup(AsyncConnectionRef c): conn(c) {} - void do_request(int fd_or_id) { + void do_request(int fd_or_id) override { conn->tick(fd_or_id); } }; diff --git a/src/msg/async/AsyncMessenger.cc b/src/msg/async/AsyncMessenger.cc index 506b71be471f..1e14ce1e0425 100644 --- a/src/msg/async/AsyncMessenger.cc +++ b/src/msg/async/AsyncMessenger.cc @@ -50,7 +50,7 @@ class Processor::C_processor_accept : public EventCallback { public: explicit C_processor_accept(Processor *p): pro(p) {} - void do_request(int id) { + void do_request(int id) override { pro->accept(); } }; @@ -232,7 +232,7 @@ class C_handle_reap : public EventCallback { public: explicit C_handle_reap(AsyncMessenger *m): msgr(m) {} - void do_request(int id) { + void do_request(int id) override { // judge whether is a time event msgr->reap_dead(); } diff --git a/src/msg/async/Event.cc b/src/msg/async/Event.cc index ca48d38be878..eee29fc51b70 100644 --- a/src/msg/async/Event.cc +++ b/src/msg/async/Event.cc @@ -41,7 +41,7 @@ class C_handle_notify : public EventCallback { public: C_handle_notify(EventCenter *c, CephContext *cc): center(c), cct(cc) {} - void do_request(int fd_or_id) { + void do_request(int fd_or_id) override { char c[256]; int r = 0; do { diff --git a/src/msg/async/PosixStack.cc b/src/msg/async/PosixStack.cc index 7651961ec252..32f3b2b2ba97 100644 --- a/src/msg/async/PosixStack.cc +++ b/src/msg/async/PosixStack.cc @@ -52,7 +52,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { explicit PosixConnectedSocketImpl(NetHandler &h, const entity_addr_t &sa, int f, bool connected) : handler(h), _fd(f), sa(sa), connected(connected) {} - virtual int is_connected() override { + int is_connected() override { if (connected) return 1; @@ -67,11 +67,11 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { } } - virtual ssize_t zero_copy_read(bufferptr&) override { + ssize_t zero_copy_read(bufferptr&) override { return -EOPNOTSUPP; } - virtual ssize_t read(char *buf, size_t len) override { + ssize_t read(char *buf, size_t len) override { ssize_t r = ::read(_fd, buf, len); if (r < 0) r = -errno; @@ -184,7 +184,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { return (ssize_t)sent; } - virtual ssize_t send(bufferlist &bl, bool more) { + ssize_t send(bufferlist &bl, bool more) override { size_t sent_bytes = 0; std::list::const_iterator pb = bl.buffers().begin(); uint64_t left_pbrs = bl.buffers().size(); @@ -229,13 +229,13 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl { return static_cast(sent_bytes); } - virtual void shutdown() { + void shutdown() override { ::shutdown(_fd, SHUT_RDWR); } - virtual void close() { + void close() override { ::close(_fd); } - virtual int fd() const override { + int fd() const override { return _fd; } friend class PosixServerSocketImpl; @@ -248,11 +248,11 @@ class PosixServerSocketImpl : public ServerSocketImpl { public: explicit PosixServerSocketImpl(NetHandler &h, int f): handler(h), _fd(f) {} - virtual int accept(ConnectedSocket *sock, const SocketOptions &opts, entity_addr_t *out, Worker *w) override; - virtual void abort_accept() override { + int accept(ConnectedSocket *sock, const SocketOptions &opts, entity_addr_t *out, Worker *w) override; + void abort_accept() override { ::close(_fd); } - virtual int fd() const override { + int fd() const override { return _fd; } }; diff --git a/src/msg/async/Stack.cc b/src/msg/async/Stack.cc index 625e472d808d..edef7537fcb2 100644 --- a/src/msg/async/Stack.cc +++ b/src/msg/async/Stack.cc @@ -180,7 +180,7 @@ class C_drain : public EventCallback { explicit C_drain(size_t c) : drain_lock("C_drain::drain_lock"), drain_count(c) {} - void do_request(int id) { + void do_request(int id) override { Mutex::Locker l(drain_lock); drain_count--; if (drain_count == 0) drain_cond.Signal(); diff --git a/src/msg/simple/Pipe.cc b/src/msg/simple/Pipe.cc index 1b531675d866..9cc82d30245e 100644 --- a/src/msg/simple/Pipe.cc +++ b/src/msg/simple/Pipe.cc @@ -88,7 +88,7 @@ public: ~DelayedDelivery() { discard(); } - void *entry(); + void *entry() override; void queue(utime_t release, Message *m) { Mutex::Locker l(delay_lock); delay_queue.push_back(make_pair(release, m)); diff --git a/src/test/ObjectMap/KeyValueDBMemory.cc b/src/test/ObjectMap/KeyValueDBMemory.cc index 690f6945c300..a7fc929ead30 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.cc +++ b/src/test/ObjectMap/KeyValueDBMemory.cc @@ -27,9 +27,9 @@ protected: public: explicit WholeSpaceMemIterator(KeyValueDBMemory *db) : db(db), ready(false) { } - virtual ~WholeSpaceMemIterator() { } + ~WholeSpaceMemIterator() { } - int seek_to_first() { + int seek_to_first() override { if (db->db.empty()) { it = db->db.end(); ready = false; @@ -40,7 +40,7 @@ public: return 0; } - int seek_to_first(const string &prefix) { + int seek_to_first(const string &prefix) override { it = db->db.lower_bound(make_pair(prefix, "")); if (db->db.empty() || (it == db->db.end())) { it = db->db.end(); @@ -51,7 +51,7 @@ public: return 0; } - int seek_to_last() { + int seek_to_last() override { it = db->db.end(); if (db->db.empty()) { ready = false; @@ -63,7 +63,7 @@ public: return 0; } - int seek_to_last(const string &prefix) { + int seek_to_last(const string &prefix) override { string tmp(prefix); tmp.append(1, (char) 0); it = db->db.upper_bound(make_pair(tmp,"")); @@ -78,7 +78,7 @@ public: return 0; } - int lower_bound(const string &prefix, const string &to) { + int lower_bound(const string &prefix, const string &to) override { it = db->db.lower_bound(make_pair(prefix,to)); if ((db->db.empty()) || (it == db->db.end())) { it = db->db.end(); @@ -92,7 +92,7 @@ public: return 0; } - int upper_bound(const string &prefix, const string &after) { + int upper_bound(const string &prefix, const string &after) override { it = db->db.upper_bound(make_pair(prefix,after)); if ((db->db.empty()) || (it == db->db.end())) { it = db->db.end(); @@ -104,7 +104,7 @@ public: return 0; } - bool valid() { + bool valid() override { return ready && (it != db->db.end()); } @@ -112,7 +112,7 @@ public: return ready && (it == db->db.begin()); } - int prev() { + int prev() override { if (!begin() && ready) --it; else @@ -120,38 +120,38 @@ public: return 0; } - int next() { + int next() override { if (valid()) ++it; return 0; } - string key() { + string key() override { if (valid()) return (*it).first.second; else return ""; } - pair raw_key() { + pair raw_key() override { if (valid()) return (*it).first; else return make_pair("", ""); } - bool raw_key_is_prefixed(const string &prefix) { + bool raw_key_is_prefixed(const string &prefix) override { return prefix == (*it).first.first; } - bufferlist value() { + bufferlist value() override { if (valid()) return (*it).second; else return bufferlist(); } - int status() { + int status() override { return 0; } }; diff --git a/src/test/ObjectMap/test_keyvaluedb_iterators.cc b/src/test/ObjectMap/test_keyvaluedb_iterators.cc index 454719c40fe8..cd8e28a5213b 100644 --- a/src/test/ObjectMap/test_keyvaluedb_iterators.cc +++ b/src/test/ObjectMap/test_keyvaluedb_iterators.cc @@ -33,7 +33,7 @@ public: boost::scoped_ptr db; boost::scoped_ptr mock; - virtual void SetUp() { + void SetUp() override { assert(!store_path.empty()); KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context, "leveldb", store_path); @@ -42,7 +42,7 @@ public: mock.reset(new KeyValueDBMemory()); } - virtual void TearDown() { } + void TearDown() override { } ::testing::AssertionResult validate_db_clear(KeyValueDB *store) { KeyValueDB::WholeSpaceIterator it = store->get_iterator(); @@ -274,7 +274,7 @@ public: db->submit_transaction_sync(tx); } - virtual void SetUp() { + void SetUp() override { IteratorTest::SetUp(); prefix1 = "_PREFIX_1_"; @@ -292,7 +292,7 @@ public: ASSERT_TRUE(validate_db_match()); } - virtual void TearDown() { + void TearDown() override { IteratorTest::TearDown(); } @@ -543,7 +543,7 @@ public: db->submit_transaction_sync(tx); } - virtual void SetUp() { + void SetUp() override { IteratorTest::SetUp(); prefix1 = "_PREFIX_1_"; @@ -560,7 +560,7 @@ public: ASSERT_TRUE(validate_db_match()); } - virtual void TearDown() { + void TearDown() override { IteratorTest::TearDown(); } @@ -786,7 +786,7 @@ public: store->submit_transaction_sync(tx); } - virtual void SetUp() { + void SetUp() override { IteratorTest::SetUp(); prefix1 = "_PREFIX_1_"; @@ -804,7 +804,7 @@ public: ASSERT_TRUE(validate_db_match()); } - virtual void TearDown() { + void TearDown() override { IteratorTest::TearDown(); } @@ -1257,7 +1257,7 @@ public: store->submit_transaction_sync(tx); } - virtual void SetUp() { + void SetUp() override { IteratorTest::SetUp(); prefix0 = "_PREFIX_0_"; @@ -1278,7 +1278,7 @@ public: ASSERT_TRUE(validate_db_match()); } - virtual void TearDown() { + void TearDown() override { IteratorTest::TearDown(); } @@ -1519,7 +1519,7 @@ public: store->submit_transaction_sync(tx); } - virtual void SetUp() { + void SetUp() override { IteratorTest::SetUp(); prefix1 = "_PREFIX_1_"; @@ -1535,7 +1535,7 @@ public: ASSERT_TRUE(validate_db_match()); } - virtual void TearDown() { + void TearDown() override { IteratorTest::TearDown(); } @@ -1591,7 +1591,7 @@ TEST_F(KeySpaceIteration, BackwardIterationMockDB) { class EmptyStore : public IteratorTest { public: - virtual void SetUp() { + void SetUp() override { IteratorTest::SetUp(); clear(db.get()); diff --git a/src/test/ObjectMap/test_object_map.cc b/src/test/ObjectMap/test_object_map.cc index e7eeda2646fc..5ad1bf9930a9 100644 --- a/src/test/ObjectMap/test_object_map.cc +++ b/src/test/ObjectMap/test_object_map.cc @@ -522,7 +522,7 @@ class ObjectMapTest : public ::testing::Test { public: boost::scoped_ptr< ObjectMap > db; ObjectMapTester tester; - virtual void SetUp() { + void SetUp() override { char *path = getenv("OBJECT_MAP_PATH"); if (!path) { db.reset(new DBObjectMap(g_ceph_context, new KeyValueDBMemory())); @@ -540,7 +540,7 @@ public: tester.db = db.get(); } - virtual void TearDown() { + void TearDown() override { std::cerr << "Checking..." << std::endl; assert(db->check(std::cerr)); } diff --git a/src/test/TestTimers.cc b/src/test/TestTimers.cc index 69be6921ceff..77b64d9356e8 100644 --- a/src/test/TestTimers.cc +++ b/src/test/TestTimers.cc @@ -31,7 +31,7 @@ public: { } - virtual void finish(int r) + void finish(int r) override { array_lock.Lock(); cout << "TestContext " << num << std::endl; @@ -39,7 +39,7 @@ public: array_lock.Unlock(); } - virtual ~TestContext() + ~TestContext() { } @@ -55,7 +55,7 @@ public: { } - virtual void finish(int r) + void finish(int r) override { array_lock.Lock(); cout << "StrictOrderTestContext " << num << std::endl; @@ -63,7 +63,7 @@ public: array_lock.Unlock(); } - virtual ~StrictOrderTestContext() + ~StrictOrderTestContext() { } }; diff --git a/src/test/admin_socket.cc b/src/test/admin_socket.cc index a3fdeaae538d..2949400f84c2 100644 --- a/src/test/admin_socket.cc +++ b/src/test/admin_socket.cc @@ -120,7 +120,7 @@ TEST(AdminSocket, SendTooLongRequest) { } class MyTest : public AdminSocketHook { - bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) { + bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) override { std::vector args; cmd_getval(g_ceph_context, cmdmap, "args", args); result.append(command); @@ -152,7 +152,7 @@ TEST(AdminSocket, RegisterCommand) { } class MyTest2 : public AdminSocketHook { - bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) { + bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) override { std::vector args; cmd_getval(g_ceph_context, cmdmap, "args", args); result.append(command); @@ -204,7 +204,7 @@ public: BlockingHook() : _lock("BlockingHook::_lock") {} - bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) { + bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) override { Mutex::Locker l(_lock); _cond.Wait(_lock); return true; diff --git a/src/test/bench/bencher.cc b/src/test/bench/bencher.cc index 451637a0e3e1..9937c5c8c31a 100644 --- a/src/test/bench/bencher.cc +++ b/src/test/bench/bencher.cc @@ -13,7 +13,7 @@ struct C_Holder : public Context { explicit C_Holder( T obj) : obj(obj) {} - void finish(int r) { + void finish(int r) override { return; } }; @@ -27,7 +27,7 @@ struct OnDelete { struct Cleanup : public Context { Bencher *bench; explicit Cleanup(Bencher *bench) : bench(bench) {} - void finish(int r) { + void finish(int r) override { bench->complete_op(); } }; @@ -40,7 +40,7 @@ struct OnWriteApplied : public Context { Bencher *bench, uint64_t seq, ceph::shared_ptr on_delete ) : bench(bench), seq(seq), on_delete(on_delete) {} - void finish(int r) { + void finish(int r) override { bench->stat_collector->write_applied(seq); } }; @@ -53,7 +53,7 @@ struct OnWriteCommit : public Context { Bencher *bench, uint64_t seq, ceph::shared_ptr on_delete ) : bench(bench), seq(seq), on_delete(on_delete) {} - void finish(int r) { + void finish(int r) override { bench->stat_collector->write_committed(seq); } }; @@ -64,7 +64,7 @@ struct OnReadComplete : public Context { boost::scoped_ptr bl; OnReadComplete(Bencher *bench, uint64_t seq, bufferlist *bl) : bench(bench), seq(seq), bl(bl) {} - void finish(int r) { + void finish(int r) override { bench->stat_collector->read_complete(seq); bench->complete_op(); } diff --git a/src/test/bench/small_io_bench_fs.cc b/src/test/bench/small_io_bench_fs.cc index b02780ed2230..619f14d62bce 100644 --- a/src/test/bench/small_io_bench_fs.cc +++ b/src/test/bench/small_io_bench_fs.cc @@ -30,7 +30,7 @@ using namespace std; struct MorePrinting : public DetailedStatCollector::AdditionalPrinting { CephContext *cct; explicit MorePrinting(CephContext *cct) : cct(cct) {} - void operator()(std::ostream *out) { + void operator()(std::ostream *out) override { bufferlist bl; Formatter *f = Formatter::create("json-pretty"); cct->get_perfcounters_collection()->dump_formatted(f, 0); diff --git a/src/test/bench/tp_bench.cc b/src/test/bench/tp_bench.cc index 9c81dc0ad119..599e03614d70 100644 --- a/src/test/bench/tp_bench.cc +++ b/src/test/bench/tp_bench.cc @@ -39,13 +39,13 @@ class Base : public Queueable { public: Base(DetailedStatCollector *col, Semaphore *sem) : col(col), sem(sem) {} - void queue(unsigned *item) { + void queue(unsigned *item) override { col->read_complete(*item); sem->Put(); delete item; } - void start() {} - void stop() {} + void start() override {} + void stop() override {} }; class WQWrapper : public Queueable { boost::scoped_ptr > wq; @@ -53,9 +53,9 @@ class WQWrapper : public Queueable { public: WQWrapper(ThreadPool::WorkQueue *wq, ThreadPool *tp): wq(wq), tp(tp) {} - void queue(unsigned *item) { wq->queue(item); } - void start() { tp->start(); } - void stop() { tp->stop(); } + void queue(unsigned *item) override { wq->queue(item); } + void start() override { tp->start(); } + void stop() override { tp->stop(); } }; class FinisherWrapper : public Queueable { class CB : public Context { @@ -63,7 +63,7 @@ class FinisherWrapper : public Queueable { unsigned *item; public: CB(Queueable *next, unsigned *item) : next(next), item(item) {} - void finish(int) { + void finish(int) override { next->queue(item); } }; @@ -72,21 +72,21 @@ class FinisherWrapper : public Queueable { public: FinisherWrapper(CephContext *cct, Queueable *next) : f(cct), next(next) {} - void queue(unsigned *item) { + void queue(unsigned *item) override { f.queue(new CB(next, item)); } - void start() { f.start(); } - void stop() { f.stop(); } + void start() override { f.start(); } + void stop() override { f.stop(); } }; class PassAlong : public ThreadPool::WorkQueue { Queueable *next; list q; - bool _enqueue(unsigned *item) { + bool _enqueue(unsigned *item) override { q.push_back(item); return true; } - void _dequeue(unsigned *item) { ceph_abort(); } - unsigned *_dequeue() { + void _dequeue(unsigned *item) override { ceph_abort(); } + unsigned *_dequeue() override { if (q.empty()) return 0; unsigned *val = q.front(); @@ -96,8 +96,8 @@ class PassAlong : public ThreadPool::WorkQueue { void _process(unsigned *item, ThreadPool::TPHandle &) override { next->queue(item); } - void _clear() { q.clear(); } - bool _empty() { return q.empty(); } + void _clear() override { q.clear(); } + bool _empty() override { return q.empty(); } public: PassAlong(ThreadPool *tp, Queueable *_next) : ThreadPool::WorkQueue("TestQueue", 100, 100, tp), next(_next) {} diff --git a/src/test/bench_log.cc b/src/test/bench_log.cc index ca8f2f3e0644..0e5bcfce51e7 100644 --- a/src/test/bench_log.cc +++ b/src/test/bench_log.cc @@ -22,7 +22,7 @@ struct T : public Thread { mymap[10] = "bar"; } - void *entry() { + void *entry() override { while (num-- > 0) generic_dout(0) << "this is a typical log line. set " << myset << " and map " << mymap << dendl; diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index 253de0106dad..22b7082b1c0b 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -249,7 +249,7 @@ TEST(BufferRaw, ostream) { #ifdef CEPH_HAVE_SPLICE class TestRawPipe : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { len = 4; ::unlink(FILENAME); snprintf(cmd, sizeof(cmd), "echo ABC > %s", FILENAME); @@ -257,7 +257,7 @@ protected: fd = ::open(FILENAME, O_RDONLY); assert(fd >= 0); } - virtual void TearDown() { + void TearDown() override { ::close(fd); ::unlink(FILENAME); } diff --git a/src/test/ceph_crypto.cc b/src/test/ceph_crypto.cc index cafe1691c2e0..2a35aeb08ba9 100644 --- a/src/test/ceph_crypto.cc +++ b/src/test/ceph_crypto.cc @@ -7,7 +7,7 @@ class CryptoEnvironment: public ::testing::Environment { public: - void SetUp() { + void SetUp() override { ceph::crypto::init(g_ceph_context); } }; @@ -110,12 +110,12 @@ TEST(HMACSHA1, Restart) { class ForkDeathTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { // shutdown NSS so it can be reinitialized after the fork ceph::crypto::shutdown(); } - virtual void TearDown() { + void TearDown() override { // undo the NSS shutdown we did in the parent process, after the // test is done ceph::crypto::init(g_ceph_context); diff --git a/src/test/cls_lua/test_cls_lua.cc b/src/test/cls_lua/test_cls_lua.cc index dd49f0181a35..e97dcef5c7df 100644 --- a/src/test/cls_lua/test_cls_lua.cc +++ b/src/test/cls_lua/test_cls_lua.cc @@ -539,7 +539,7 @@ class ClsLua : public ::testing::Test { ASSERT_EQ(0, destroy_one_pool_pp(pool_name, rados)); } - virtual void SetUp() { + void SetUp() override { /* Grab test names to build unique objects */ const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info(); @@ -553,7 +553,7 @@ class ClsLua : public ::testing::Test { oid = ss_oid.str(); } - virtual void TearDown() { + void TearDown() override { } /* diff --git a/src/test/cls_replica_log/test_cls_replica_log.cc b/src/test/cls_replica_log/test_cls_replica_log.cc index 8c204caef046..de6146e554aa 100644 --- a/src/test/cls_replica_log/test_cls_replica_log.cc +++ b/src/test/cls_replica_log/test_cls_replica_log.cc @@ -26,7 +26,7 @@ public: list > entries; cls_replica_log_progress_marker progress; - void SetUp() { + void SetUp() override { pool_name = get_temp_pool_name(); ASSERT_EQ("", create_one_pool_pp(pool_name, rados)); ASSERT_EQ(0, rados.ioctx_create(pool_name.c_str(), ioctx)); diff --git a/src/test/common/Throttle.cc b/src/test/common/Throttle.cc index 000fb83a682b..979b6f161d30 100644 --- a/src/test/common/Throttle.cc +++ b/src/test/common/Throttle.cc @@ -50,7 +50,7 @@ protected: { } - virtual void *entry() { + void *entry() override { usleep(5); waited = throttle.get(count); throttle.put(count); diff --git a/src/test/common/dns_resolve.cc b/src/test/common/dns_resolve.cc index 1cf86087e0c9..275479694cec 100644 --- a/src/test/common/dns_resolve.cc +++ b/src/test/common/dns_resolve.cc @@ -33,11 +33,11 @@ using ::testing::StrEq; class DNSResolverTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { g_ceph_context->_conf->subsys.set_log_level(dout_subsys, TEST_DEBUG); } - virtual void TearDown() { + void TearDown() override { DNSResolver::get_instance(nullptr); } }; diff --git a/src/test/common/test_async_compressor.cc b/src/test/common/test_async_compressor.cc index 6e77306fdc0a..e43b9bf172fc 100644 --- a/src/test/common/test_async_compressor.cc +++ b/src/test/common/test_async_compressor.cc @@ -27,12 +27,12 @@ typedef boost::mt11213b gen_type; class AsyncCompressorTest : public ::testing::Test { public: AsyncCompressor *async_compressor; - virtual void SetUp() { + void SetUp() override { cerr << __func__ << " start set up " << std::endl; async_compressor = new AsyncCompressor(g_ceph_context); async_compressor->init(); } - virtual void TearDown() { + void TearDown() override { async_compressor->terminate(); delete async_compressor; } diff --git a/src/test/common/test_prioritized_queue.cc b/src/test/common/test_prioritized_queue.cc index 7b29413ac57b..72de64149f8f 100644 --- a/src/test/common/test_prioritized_queue.cc +++ b/src/test/common/test_prioritized_queue.cc @@ -19,13 +19,13 @@ protected: enum { item_size = 100, }; vector items; - virtual void SetUp() { + void SetUp() override { for (int i = 0; i < item_size; i++) { items.push_back(Item(i)); } std::random_shuffle(items.begin(), items.end()); } - virtual void TearDown() { + void TearDown() override { items.clear(); } }; diff --git a/src/test/common/test_shared_cache.cc b/src/test/common/test_shared_cache.cc index d0a907d31644..7b7602ffe08b 100644 --- a/src/test/common/test_shared_cache.cc +++ b/src/test/common/test_shared_cache.cc @@ -53,7 +53,7 @@ public: value(_value), in_method(_in_method) { } - virtual void * entry() { + void * entry() override { switch (in_method) { case LOWER_BOUND: ptr = cache.lower_bound(key); diff --git a/src/test/common/test_sharedptr_registry.cc b/src/test/common/test_sharedptr_registry.cc index 925395aa099b..078259971e2b 100644 --- a/src/test/common/test_sharedptr_registry.cc +++ b/src/test/common/test_sharedptr_registry.cc @@ -53,7 +53,7 @@ public: { } - virtual void *entry() { + void *entry() override { switch(in_method) { case LOOKUP_OR_CREATE: if (value) @@ -303,7 +303,7 @@ public: int value; }; - virtual void SetUp() { + void SetUp() override { died = UNDEFINED; } }; diff --git a/src/test/common/test_weighted_priority_queue.cc b/src/test/common/test_weighted_priority_queue.cc index 558b80c6e4fa..b32c2ce2f0db 100644 --- a/src/test/common/test_weighted_priority_queue.cc +++ b/src/test/common/test_weighted_priority_queue.cc @@ -153,10 +153,10 @@ protected: } } - virtual void SetUp() { + void SetUp() override { srand(time(0)); } - virtual void TearDown() { + void TearDown() override { } }; diff --git a/src/test/compressor/compressor_plugin_example.cc b/src/test/compressor/compressor_plugin_example.cc index 19135532a8f1..5a6ddd32ebf5 100644 --- a/src/test/compressor/compressor_plugin_example.cc +++ b/src/test/compressor/compressor_plugin_example.cc @@ -26,8 +26,8 @@ public: explicit CompressorPluginExample(CephContext* cct) : CompressionPlugin(cct) {} - virtual int factory(CompressorRef *cs, - ostream *ss) + int factory(CompressorRef *cs, + ostream *ss) override { if (compressor == 0) { CompressorExample *interface = new CompressorExample(); diff --git a/src/test/compressor/test_compression.cc b/src/test/compressor/test_compression.cc index 11e68932ad2a..f4006c6d2ff1 100644 --- a/src/test/compressor/test_compression.cc +++ b/src/test/compressor/test_compression.cc @@ -56,11 +56,11 @@ public: g_ceph_context->_conf->apply_changes(NULL); } - void SetUp() { + void SetUp() override { compressor = Compressor::create(g_ceph_context, plugin); ASSERT_TRUE(compressor); } - void TearDown() { + void TearDown() override { compressor.reset(); } }; diff --git a/src/test/crypto.cc b/src/test/crypto.cc index f4a40cd41cde..df09b7d5dfcf 100644 --- a/src/test/crypto.cc +++ b/src/test/crypto.cc @@ -11,7 +11,7 @@ class CryptoEnvironment: public ::testing::Environment { public: - void SetUp() { + void SetUp() override { ceph::crypto::init(g_ceph_context); } }; diff --git a/src/test/encoding/ceph_dencoder.cc b/src/test/encoding/ceph_dencoder.cc index 87e4fec2aa9e..676e7d4ad050 100644 --- a/src/test/encoding/ceph_dencoder.cc +++ b/src/test/encoding/ceph_dencoder.cc @@ -108,7 +108,7 @@ public: delete m_object; } - string decode(bufferlist bl, uint64_t seek) { + string decode(bufferlist bl, uint64_t seek) override { bufferlist::iterator p = bl.begin(); p.seek(seek); try { @@ -125,18 +125,18 @@ public: return string(); } - virtual void encode(bufferlist& out, uint64_t features) = 0; + void encode(bufferlist& out, uint64_t features) override = 0; - void dump(ceph::Formatter *f) { + void dump(ceph::Formatter *f) override { m_object->dump(f); } - void generate() { + void generate() override { T::generate_test_instances(m_list); } - int num_generated() { + int num_generated() override { return m_list.size(); } - string select_generated(unsigned i) { + string select_generated(unsigned i) override { // allow 0- or 1-based (by wrapping) if (i == 0) i = m_list.size(); @@ -148,7 +148,7 @@ public: return string(); } - bool is_deterministic() { + bool is_deterministic() override { return !nondeterministic; } }; @@ -158,7 +158,7 @@ class DencoderImplNoFeatureNoCopy : public DencoderBase { public: DencoderImplNoFeatureNoCopy(bool stray_ok, bool nondeterministic) : DencoderBase(stray_ok, nondeterministic) {} - virtual void encode(bufferlist& out, uint64_t features) { + void encode(bufferlist& out, uint64_t features) override { out.clear(); ::encode(*this->m_object, out); } @@ -169,13 +169,13 @@ class DencoderImplNoFeature : public DencoderImplNoFeatureNoCopy { public: DencoderImplNoFeature(bool stray_ok, bool nondeterministic) : DencoderImplNoFeatureNoCopy(stray_ok, nondeterministic) {} - void copy() { + void copy() override { T *n = new T; *n = *this->m_object; delete this->m_object; this->m_object = n; } - void copy_ctor() { + void copy_ctor() override { T *n = new T(*this->m_object); delete this->m_object; this->m_object = n; @@ -187,7 +187,7 @@ class DencoderImplFeaturefulNoCopy : public DencoderBase { public: DencoderImplFeaturefulNoCopy(bool stray_ok, bool nondeterministic) : DencoderBase(stray_ok, nondeterministic) {} - virtual void encode(bufferlist& out, uint64_t features) { + void encode(bufferlist& out, uint64_t features) override { out.clear(); ::encode(*(this->m_object), out, features); } @@ -198,13 +198,13 @@ class DencoderImplFeatureful : public DencoderImplFeaturefulNoCopy { public: DencoderImplFeatureful(bool stray_ok, bool nondeterministic) : DencoderImplFeaturefulNoCopy(stray_ok, nondeterministic) {} - void copy() { + void copy() override { T *n = new T; *n = *this->m_object; delete this->m_object; this->m_object = n; } - void copy_ctor() { + void copy_ctor() override { T *n = new T(*this->m_object); delete this->m_object; this->m_object = n; @@ -224,7 +224,7 @@ public: m_object->put(); } - string decode(bufferlist bl, uint64_t seek) { + string decode(bufferlist bl, uint64_t seek) override { bufferlist::iterator p = bl.begin(); p.seek(seek); try { @@ -250,21 +250,21 @@ public: return string(); } - void encode(bufferlist& out, uint64_t features) { + void encode(bufferlist& out, uint64_t features) override { out.clear(); encode_message(m_object, features, out); } - void dump(ceph::Formatter *f) { + void dump(ceph::Formatter *f) override { m_object->dump(f); } - void generate() { + void generate() override { //T::generate_test_instances(m_list); } - int num_generated() { + int num_generated() override { return m_list.size(); } - string select_generated(unsigned i) { + string select_generated(unsigned i) override { // allow 0- or 1-based (by wrapping) if (i == 0) i = m_list.size(); @@ -276,7 +276,7 @@ public: m_object = *p; return string(); } - bool is_deterministic() { + bool is_deterministic() override { return true; } diff --git a/src/test/erasure-code/ErasureCodePluginExample.cc b/src/test/erasure-code/ErasureCodePluginExample.cc index adbda834eb89..de105953a47a 100644 --- a/src/test/erasure-code/ErasureCodePluginExample.cc +++ b/src/test/erasure-code/ErasureCodePluginExample.cc @@ -23,10 +23,10 @@ class ErasureCodePluginExample : public ErasureCodePlugin { public: - virtual int factory(const std::string &directory, + int factory(const std::string &directory, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream *ss) + ostream *ss) override { *erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample()); (*erasure_code)->init(profile, ss); diff --git a/src/test/erasure-code/TestErasureCode.cc b/src/test/erasure-code/TestErasureCode.cc index 55b12818f3e4..ddd571fb5a4f 100644 --- a/src/test/erasure-code/TestErasureCode.cc +++ b/src/test/erasure-code/TestErasureCode.cc @@ -31,25 +31,25 @@ public: ErasureCodeTest(unsigned int _k, unsigned int _m, unsigned int _chunk_size) : k(_k), m(_m), chunk_size(_chunk_size) {} - virtual ~ErasureCodeTest() {} + ~ErasureCodeTest() {} - virtual int init(ErasureCodeProfile &profile, ostream *ss) { + int init(ErasureCodeProfile &profile, ostream *ss) override { return 0; } - virtual unsigned int get_chunk_count() const { return k + m; } - virtual unsigned int get_data_chunk_count() const { return k; } - virtual unsigned int get_chunk_size(unsigned int object_size) const { + unsigned int get_chunk_count() const override { return k + m; } + unsigned int get_data_chunk_count() const override { return k; } + unsigned int get_chunk_size(unsigned int object_size) const override { return chunk_size; } - virtual int encode_chunks(const set &want_to_encode, - map *encoded) { + int encode_chunks(const set &want_to_encode, + map *encoded) override { encode_chunks_encoded = *encoded; return 0; } - virtual int create_ruleset(const string &name, + int create_ruleset(const string &name, CrushWrapper &crush, - ostream *ss) const { return 0; } + ostream *ss) const override { return 0; } }; diff --git a/src/test/erasure-code/TestErasureCodePlugin.cc b/src/test/erasure-code/TestErasureCodePlugin.cc index d86545b33b16..1476f64fb45c 100644 --- a/src/test/erasure-code/TestErasureCodePlugin.cc +++ b/src/test/erasure-code/TestErasureCodePlugin.cc @@ -36,7 +36,7 @@ protected: instance.lock.Unlock(); } - virtual void *entry() { + void *entry() override { ErasureCodeProfile profile; ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); ErasureCodeInterfaceRef erasure_code; diff --git a/src/test/gather.cc b/src/test/gather.cc index 5df344f23cdb..496403625466 100644 --- a/src/test/gather.cc +++ b/src/test/gather.cc @@ -20,7 +20,7 @@ public: int *result; C_Checker(bool* _finish_called, int *r) : finish_called(_finish_called), result(r) {} - void finish(int r) { *finish_called = true; *result = r; } + void finish(int r) override { *finish_called = true; *result = r; } }; TEST(ContextGather, Constructor) { diff --git a/src/test/journal/test_FutureImpl.cc b/src/test/journal/test_FutureImpl.cc index af8ca7656424..f904c6eefbb9 100644 --- a/src/test/journal/test_FutureImpl.cc +++ b/src/test/journal/test_FutureImpl.cc @@ -13,14 +13,14 @@ public: uint64_t refs; uint64_t flushes; FlushHandler() : refs(0), flushes(0) {} - virtual void get() { + void get() override { ++refs; } - virtual void put() { + void put() override { assert(refs > 0); --refs; } - virtual void flush(const journal::FutureImplPtr &future) { + void flush(const journal::FutureImplPtr &future) override { ++flushes; } }; diff --git a/src/test/journal/test_JournalMetadata.cc b/src/test/journal/test_JournalMetadata.cc index 560ee4e569f7..bdb3107f982a 100644 --- a/src/test/journal/test_JournalMetadata.cc +++ b/src/test/journal/test_JournalMetadata.cc @@ -9,7 +9,7 @@ class TestJournalMetadata : public RadosTestFixture { public: - virtual void TearDown() { + void TearDown() override { for (MetadataList::iterator it = m_metadata_list.begin(); it != m_metadata_list.end(); ++it) { (*it)->remove_listener(&m_listener); diff --git a/src/test/journal/test_JournalPlayer.cc b/src/test/journal/test_JournalPlayer.cc index 6888ee06bb52..7522198ec18a 100644 --- a/src/test/journal/test_JournalPlayer.cc +++ b/src/test/journal/test_JournalPlayer.cc @@ -33,16 +33,16 @@ public: : lock("lock"), entries_available(false), complete(false), complete_result(0) {} - virtual void get() {} - virtual void put() {} + void get() override {} + void put() override {} - virtual void handle_entries_available() { + void handle_entries_available() override { Mutex::Locker locker(lock); entries_available = true; cond.Signal(); } - virtual void handle_complete(int r) { + void handle_complete(int r) override { Mutex::Locker locker(lock); complete = true; complete_result = r; @@ -50,7 +50,7 @@ public: } }; - virtual void TearDown() { + void TearDown() override { for (JournalPlayers::iterator it = m_players.begin(); it != m_players.end(); ++it) { delete *it; diff --git a/src/test/journal/test_JournalRecorder.cc b/src/test/journal/test_JournalRecorder.cc index c06ea6df5b5a..59cc3907f8b9 100644 --- a/src/test/journal/test_JournalRecorder.cc +++ b/src/test/journal/test_JournalRecorder.cc @@ -11,7 +11,7 @@ class TestJournalRecorder : public RadosTestFixture { public: - virtual void TearDown() { + void TearDown() override { for (std::list::iterator it = m_recorders.begin(); it != m_recorders.end(); ++it) { delete *it; diff --git a/src/test/journal/test_JournalTrimmer.cc b/src/test/journal/test_JournalTrimmer.cc index 8e09e870d254..6d6917e4300d 100644 --- a/src/test/journal/test_JournalTrimmer.cc +++ b/src/test/journal/test_JournalTrimmer.cc @@ -11,7 +11,7 @@ class TestJournalTrimmer : public RadosTestFixture { public: - virtual void TearDown() { + void TearDown() override { for (MetadataList::iterator it = m_metadata_list.begin(); it != m_metadata_list.end(); ++it) { (*it)->remove_listener(&m_listener); diff --git a/src/test/journal/test_Journaler.cc b/src/test/journal/test_Journaler.cc index 7b8be81b5607..4fd06ad6535f 100644 --- a/src/test/journal/test_Journaler.cc +++ b/src/test/journal/test_Journaler.cc @@ -18,14 +18,14 @@ public: return stringify(++_journal_id); } - virtual void SetUp() { + void SetUp() override { RadosTestFixture::SetUp(); m_journal_id = get_temp_journal_id(); m_journaler = new journal::Journaler(m_work_queue, m_timer, &m_timer_lock, m_ioctx, m_journal_id, CLIENT_ID, {}); } - virtual void TearDown() { + void TearDown() override { delete m_journaler; RadosTestFixture::TearDown(); } diff --git a/src/test/journal/test_ObjectRecorder.cc b/src/test/journal/test_ObjectRecorder.cc index 1e0a366d7b41..ed071c8d56b4 100644 --- a/src/test/journal/test_ObjectRecorder.cc +++ b/src/test/journal/test_ObjectRecorder.cc @@ -31,12 +31,12 @@ public: Handler() : lock("lock") { } - virtual void closed(journal::ObjectRecorder *object_recorder) { + void closed(journal::ObjectRecorder *object_recorder) override { Mutex::Locker locker(lock); is_closed = true; cond.Signal(); } - virtual void overflow(journal::ObjectRecorder *object_recorder) { + void overflow(journal::ObjectRecorder *object_recorder) override { Mutex::Locker locker(lock); journal::AppendBuffers append_buffers; object_lock->Lock(); @@ -59,7 +59,7 @@ public: double m_flush_age; Handler m_handler; - void TearDown() { + void TearDown() override { for (ObjectRecorders::iterator it = m_object_recorders.begin(); it != m_object_recorders.end(); ++it) { C_SaferCond cond; diff --git a/src/test/msgr/perf_msgr_client.cc b/src/test/msgr/perf_msgr_client.cc index f71682ce3403..a5f5ef659198 100644 --- a/src/test/msgr/perf_msgr_client.cc +++ b/src/test/msgr/perf_msgr_client.cc @@ -38,8 +38,8 @@ class MessengerClient { public: ClientDispatcher(uint64_t delay, ClientThread *t): Dispatcher(g_ceph_context), think_time(delay), thread(t) {} - bool ms_can_fast_dispatch_any() const { return true; } - bool ms_can_fast_dispatch(Message *m) const { + bool ms_can_fast_dispatch_any() const override { return true; } + bool ms_can_fast_dispatch(Message *m) const override { switch (m->get_type()) { case CEPH_MSG_OSD_OPREPLY: return true; @@ -48,16 +48,16 @@ class MessengerClient { } } - void ms_handle_fast_connect(Connection *con) {} - void ms_handle_fast_accept(Connection *con) {} - bool ms_dispatch(Message *m) { return true; } - void ms_fast_dispatch(Message *m); - bool ms_handle_reset(Connection *con) { return true; } - void ms_handle_remote_reset(Connection *con) {} - bool ms_handle_refused(Connection *con) { return false; } + void ms_handle_fast_connect(Connection *con) override {} + void ms_handle_fast_accept(Connection *con) override {} + bool ms_dispatch(Message *m) override { return true; } + void ms_fast_dispatch(Message *m) override; + bool ms_handle_reset(Connection *con) override { return true; } + void ms_handle_remote_reset(Connection *con) override {} + bool ms_handle_refused(Connection *con) override { return false; } bool ms_verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& authorizer, bufferlist& authorizer_reply, - bool& isvalid, CryptoKey& session_key) { + bool& isvalid, CryptoKey& session_key) override { isvalid = true; return true; } @@ -89,7 +89,7 @@ class MessengerClient { memset(ptr.c_str(), 0, msg_len); data.append(ptr); } - void *entry() { + void *entry() override { lock.Lock(); for (int i = 0; i < ops; ++i) { if (inflight > uint64_t(concurrent)) { diff --git a/src/test/msgr/perf_msgr_server.cc b/src/test/msgr/perf_msgr_server.cc index 86c652bb708c..8ce3acb85b39 100644 --- a/src/test/msgr/perf_msgr_server.cc +++ b/src/test/msgr/perf_msgr_server.cc @@ -40,17 +40,17 @@ class ServerDispatcher : public Dispatcher { OpWQ(time_t timeout, time_t suicide_timeout, ThreadPool *tp) : ThreadPool::WorkQueue("ServerDispatcher::OpWQ", timeout, suicide_timeout, tp) {} - bool _enqueue(Message *m) { + bool _enqueue(Message *m) override { messages.push_back(m); return true; } - void _dequeue(Message *m) { + void _dequeue(Message *m) override { ceph_abort(); } - bool _empty() { + bool _empty() override { return messages.empty(); } - Message *_dequeue() { + Message *_dequeue() override { if (messages.empty()) return NULL; Message *m = messages.front(); @@ -63,8 +63,8 @@ class ServerDispatcher : public Dispatcher { m->get_connection()->send_message(reply); m->put(); } - void _process_finish(Message *m) { } - void _clear() { + void _process_finish(Message *m) override { } + void _clear() override { assert(messages.empty()); } } op_wq; @@ -78,8 +78,8 @@ class ServerDispatcher : public Dispatcher { ~ServerDispatcher() { op_tp.stop(); } - bool ms_can_fast_dispatch_any() const { return true; } - bool ms_can_fast_dispatch(Message *m) const { + bool ms_can_fast_dispatch_any() const override { return true; } + bool ms_can_fast_dispatch(Message *m) const override { switch (m->get_type()) { case CEPH_MSG_OSD_OP: return true; @@ -88,20 +88,20 @@ class ServerDispatcher : public Dispatcher { } } - void ms_handle_fast_connect(Connection *con) {} - void ms_handle_fast_accept(Connection *con) {} - bool ms_dispatch(Message *m) { return true; } - bool ms_handle_reset(Connection *con) { return true; } - void ms_handle_remote_reset(Connection *con) {} - bool ms_handle_refused(Connection *con) { return false; } - void ms_fast_dispatch(Message *m) { + void ms_handle_fast_connect(Connection *con) override {} + void ms_handle_fast_accept(Connection *con) override {} + bool ms_dispatch(Message *m) override { return true; } + bool ms_handle_reset(Connection *con) override { return true; } + void ms_handle_remote_reset(Connection *con) override {} + bool ms_handle_refused(Connection *con) override { return false; } + void ms_fast_dispatch(Message *m) override { usleep(think_time); //cerr << __func__ << " reply message=" << m << std::endl; op_wq.queue(m); } bool ms_verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& authorizer, bufferlist& authorizer_reply, - bool& isvalid, CryptoKey& session_key) { + bool& isvalid, CryptoKey& session_key) override { isvalid = true; return true; } diff --git a/src/test/msgr/test_async_driver.cc b/src/test/msgr/test_async_driver.cc index 7773db77c57d..697198a38ded 100644 --- a/src/test/msgr/test_async_driver.cc +++ b/src/test/msgr/test_async_driver.cc @@ -65,7 +65,7 @@ class EventDriverTest : public ::testing::TestWithParam { EventDriver *driver; EventDriverTest(): driver(0) {} - virtual void SetUp() { + void SetUp() override { cerr << __func__ << " start set up " << GetParam() << std::endl; #ifdef HAVE_EPOLL if (strcmp(GetParam(), "epoll")) @@ -79,7 +79,7 @@ class EventDriverTest : public ::testing::TestWithParam { driver = new SelectDriver(g_ceph_context); driver->init(NULL, 100); } - virtual void TearDown() { + void TearDown() override { delete driver; } }; @@ -250,7 +250,7 @@ TEST_P(EventDriverTest, NetworkSocketTest) { class FakeEvent : public EventCallback { public: - void do_request(int fd_or_id) {} + void do_request(int fd_or_id) override {} }; TEST(EventCenterTest, FileEventExpansion) { @@ -283,7 +283,7 @@ class Worker : public Thread { done = true; center.wakeup(); } - void* entry() { + void* entry() override { center.set_owner(); while (!done) center.process_events(1000000); @@ -298,7 +298,7 @@ class CountEvent: public EventCallback { public: CountEvent(atomic_t *atomic, Mutex *l, Cond *c): count(atomic), lock(l), cond(c) {} - void do_request(int id) { + void do_request(int id) override { lock->Lock(); count->dec(); cond->Signal(); diff --git a/src/test/msgr/test_async_networkstack.cc b/src/test/msgr/test_async_networkstack.cc index 585077c764b7..e3b24f814d52 100644 --- a/src/test/msgr/test_async_networkstack.cc +++ b/src/test/msgr/test_async_networkstack.cc @@ -38,7 +38,7 @@ class NetworkWorkerTest : public ::testing::TestWithParam { string addr, port_addr; NetworkWorkerTest() {} - virtual void SetUp() { + void SetUp() override { cerr << __func__ << " start set up " << GetParam() << std::endl; if (strncmp(GetParam(), "dpdk", 4)) { g_ceph_context->_conf->set_val("ms_type", "async+posix", false, false); @@ -58,7 +58,7 @@ class NetworkWorkerTest : public ::testing::TestWithParam { stack = NetworkStack::create(g_ceph_context, GetParam()); stack->start(); } - virtual void TearDown() { + void TearDown() override { stack->stop(); } string get_addr() const { @@ -83,7 +83,7 @@ class NetworkWorkerTest : public ::testing::TestWithParam { std::atomic_bool done; public: C_dispatch(Worker *w, func &&_f): worker(w), f(std::move(_f)), done(false) {} - void do_request(int id) { + void do_request(int id) override { f(worker); done = true; } @@ -120,7 +120,7 @@ class C_poll : public EventCallback { public: C_poll(EventCenter *c): center(c), woken(false) {} - void do_request(int r) { + void do_request(int r) override { woken = true; } bool poll(int milliseconds) { @@ -626,7 +626,7 @@ class StressFactory { T *ctxt; public: C_delete(T *c): ctxt(c) {} - void do_request(int id) { + void do_request(int id) override { delete ctxt; delete this; } @@ -651,7 +651,7 @@ class StressFactory { Client *c; public: Client_read_handle(Client *_c): c(_c) {} - void do_request(int id) { + void do_request(int id) override { c->do_read_request(); } } read_ctxt; @@ -660,7 +660,7 @@ class StressFactory { Client *c; public: Client_write_handle(Client *_c): c(_c) {} - void do_request(int id) { + void do_request(int id) override { c->do_write_request(); } } write_ctxt; @@ -790,7 +790,7 @@ class StressFactory { Server *s; public: Server_read_handle(Server *_s): s(_s) {} - void do_request(int id) { + void do_request(int id) override { s->do_read_request(); } } read_ctxt; @@ -799,7 +799,7 @@ class StressFactory { Server *s; public: Server_write_handle(Server *_s): s(_s) {} - void do_request(int id) { + void do_request(int id) override { s->do_write_request(); } } write_ctxt; @@ -903,7 +903,7 @@ class StressFactory { public: C_accept(StressFactory *f, ServerSocket s, ThreadData *data, Worker *w) : factory(f), bind_socket(std::move(s)), t_data(data), worker(w) {} - void do_request(int id) { + void do_request(int id) override { while (true) { entity_addr_t cli_addr; ConnectedSocket srv_socket; diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index 02d42fe21b94..71017f41ee64 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -63,14 +63,14 @@ class MessengerTest : public ::testing::TestWithParam { Messenger *client_msgr; MessengerTest(): server_msgr(NULL), client_msgr(NULL) {} - virtual void SetUp() { + void SetUp() override { lderr(g_ceph_context) << __func__ << " start set up " << GetParam() << dendl; server_msgr = Messenger::create(g_ceph_context, string(GetParam()), entity_name_t::OSD(0), "server", getpid(), 0); client_msgr = Messenger::create(g_ceph_context, string(GetParam()), entity_name_t::CLIENT(-1), "client", getpid(), 0); server_msgr->set_default_policy(Messenger::Policy::stateless_server(0, 0)); client_msgr->set_default_policy(Messenger::Policy::lossy_client(0, 0)); } - virtual void TearDown() { + void TearDown() override { ASSERT_EQ(server_msgr->get_dispatch_queue_len(), 0); ASSERT_EQ(client_msgr->get_dispatch_queue_len(), 0); delete server_msgr; @@ -102,8 +102,8 @@ class FakeDispatcher : public Dispatcher { explicit FakeDispatcher(bool s): Dispatcher(g_ceph_context), lock("FakeDispatcher::lock"), is_server(s), got_new(false), got_remote_reset(false), got_connect(false), loopback(false) {} - bool ms_can_fast_dispatch_any() const { return true; } - bool ms_can_fast_dispatch(Message *m) const { + bool ms_can_fast_dispatch_any() const override { return true; } + bool ms_can_fast_dispatch(Message *m) const override { switch (m->get_type()) { case CEPH_MSG_PING: return true; @@ -112,7 +112,7 @@ class FakeDispatcher : public Dispatcher { } } - void ms_handle_fast_connect(Connection *con) { + void ms_handle_fast_connect(Connection *con) override { lock.Lock(); lderr(g_ceph_context) << __func__ << " " << con << dendl; Session *s = static_cast(con->get_priv()); @@ -126,7 +126,7 @@ class FakeDispatcher : public Dispatcher { cond.Signal(); lock.Unlock(); } - void ms_handle_fast_accept(Connection *con) { + void ms_handle_fast_accept(Connection *con) override { Session *s = static_cast(con->get_priv()); if (!s) { s = new Session(con); @@ -134,7 +134,7 @@ class FakeDispatcher : public Dispatcher { } s->put(); } - bool ms_dispatch(Message *m) { + bool ms_dispatch(Message *m) override { Session *s = static_cast(m->get_connection()->get_priv()); if (!s) { s = new Session(m->get_connection()); @@ -152,7 +152,7 @@ class FakeDispatcher : public Dispatcher { m->put(); return true; } - bool ms_handle_reset(Connection *con) { + bool ms_handle_reset(Connection *con) override { Mutex::Locker l(lock); lderr(g_ceph_context) << __func__ << " " << con << dendl; Session *s = static_cast(con->get_priv()); @@ -163,7 +163,7 @@ class FakeDispatcher : public Dispatcher { } return true; } - void ms_handle_remote_reset(Connection *con) { + void ms_handle_remote_reset(Connection *con) override { Mutex::Locker l(lock); lderr(g_ceph_context) << __func__ << " " << con << dendl; Session *s = static_cast(con->get_priv()); @@ -175,10 +175,10 @@ class FakeDispatcher : public Dispatcher { got_remote_reset = true; cond.Signal(); } - bool ms_handle_refused(Connection *con) { + bool ms_handle_refused(Connection *con) override { return false; } - void ms_fast_dispatch(Message *m) { + void ms_fast_dispatch(Message *m) override { Session *s = static_cast(m->get_connection()->get_priv()); if (!s) { s = new Session(m->get_connection()); @@ -203,7 +203,7 @@ class FakeDispatcher : public Dispatcher { bool ms_verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& authorizer, bufferlist& authorizer_reply, - bool& isvalid, CryptoKey& session_key) { + bool& isvalid, CryptoKey& session_key) override { isvalid = true; return true; } @@ -813,8 +813,8 @@ class SyntheticDispatcher : public Dispatcher { SyntheticDispatcher(bool s, SyntheticWorkload *wl): Dispatcher(g_ceph_context), lock("SyntheticDispatcher::lock"), is_server(s), got_new(false), got_remote_reset(false), got_connect(false), index(0), workload(wl) {} - bool ms_can_fast_dispatch_any() const { return true; } - bool ms_can_fast_dispatch(Message *m) const { + bool ms_can_fast_dispatch_any() const override { return true; } + bool ms_can_fast_dispatch(Message *m) const override { switch (m->get_type()) { case CEPH_MSG_PING: case MSG_COMMAND: @@ -824,7 +824,7 @@ class SyntheticDispatcher : public Dispatcher { } } - void ms_handle_fast_connect(Connection *con) { + void ms_handle_fast_connect(Connection *con) override { Mutex::Locker l(lock); list c = conn_sent[con]; for (list::iterator it = c.begin(); @@ -834,7 +834,7 @@ class SyntheticDispatcher : public Dispatcher { got_connect = true; cond.Signal(); } - void ms_handle_fast_accept(Connection *con) { + void ms_handle_fast_accept(Connection *con) override { Mutex::Locker l(lock); list c = conn_sent[con]; for (list::iterator it = c.begin(); @@ -843,11 +843,11 @@ class SyntheticDispatcher : public Dispatcher { conn_sent.erase(con); cond.Signal(); } - bool ms_dispatch(Message *m) { + bool ms_dispatch(Message *m) override { ceph_abort(); } - bool ms_handle_reset(Connection *con); - void ms_handle_remote_reset(Connection *con) { + bool ms_handle_reset(Connection *con) override; + void ms_handle_remote_reset(Connection *con) override { Mutex::Locker l(lock); list c = conn_sent[con]; for (list::iterator it = c.begin(); @@ -856,10 +856,10 @@ class SyntheticDispatcher : public Dispatcher { conn_sent.erase(con); got_remote_reset = true; } - bool ms_handle_refused(Connection *con) { + bool ms_handle_refused(Connection *con) override { return false; } - void ms_fast_dispatch(Message *m) { + void ms_fast_dispatch(Message *m) override { // MSG_COMMAND is used to disorganize regular message flow if (m->get_type() == MSG_COMMAND) { m->put(); @@ -893,7 +893,7 @@ class SyntheticDispatcher : public Dispatcher { bool ms_verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& authorizer, bufferlist& authorizer_reply, - bool& isvalid, CryptoKey& session_key) { + bool& isvalid, CryptoKey& session_key) override { isvalid = true; return true; } @@ -1373,8 +1373,8 @@ class MarkdownDispatcher : public Dispatcher { atomic_t count; explicit MarkdownDispatcher(bool s): Dispatcher(g_ceph_context), lock("MarkdownDispatcher::lock"), last_mark(false), count(0) {} - bool ms_can_fast_dispatch_any() const { return false; } - bool ms_can_fast_dispatch(Message *m) const { + bool ms_can_fast_dispatch_any() const override { return false; } + bool ms_can_fast_dispatch(Message *m) const override { switch (m->get_type()) { case CEPH_MSG_PING: return true; @@ -1383,16 +1383,16 @@ class MarkdownDispatcher : public Dispatcher { } } - void ms_handle_fast_connect(Connection *con) { + void ms_handle_fast_connect(Connection *con) override { lderr(g_ceph_context) << __func__ << " " << con << dendl; Mutex::Locker l(lock); conns.insert(con); } - void ms_handle_fast_accept(Connection *con) { + void ms_handle_fast_accept(Connection *con) override { Mutex::Locker l(lock); conns.insert(con); } - bool ms_dispatch(Message *m) { + bool ms_dispatch(Message *m) override { lderr(g_ceph_context) << __func__ << " conn: " << m->get_connection() << dendl; Mutex::Locker l(lock); count.inc(); @@ -1416,27 +1416,27 @@ class MarkdownDispatcher : public Dispatcher { m->put(); return true; } - bool ms_handle_reset(Connection *con) { + bool ms_handle_reset(Connection *con) override { lderr(g_ceph_context) << __func__ << " " << con << dendl; Mutex::Locker l(lock); conns.erase(con); usleep(rand() % 500); return true; } - void ms_handle_remote_reset(Connection *con) { + void ms_handle_remote_reset(Connection *con) override { Mutex::Locker l(lock); conns.erase(con); lderr(g_ceph_context) << __func__ << " " << con << dendl; } - bool ms_handle_refused(Connection *con) { + bool ms_handle_refused(Connection *con) override { return false; } - void ms_fast_dispatch(Message *m) { + void ms_fast_dispatch(Message *m) override { ceph_abort(); } bool ms_verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& authorizer, bufferlist& authorizer_reply, - bool& isvalid, CryptoKey& session_key) { + bool& isvalid, CryptoKey& session_key) override { isvalid = true; return true; } diff --git a/src/test/multi_stress_watch.cc b/src/test/multi_stress_watch.cc index 4dc5489d51d7..ecd7e28dc17c 100644 --- a/src/test/multi_stress_watch.cc +++ b/src/test/multi_stress_watch.cc @@ -22,7 +22,7 @@ static sem_t sem; class WatchNotifyTestCtx : public WatchCtx { public: - void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) + void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override { sem_post(&sem); } diff --git a/src/test/objectstore_bench.cc b/src/test/objectstore_bench.cc index 484fe8ec8df9..303208f8a49f 100644 --- a/src/test/objectstore_bench.cc +++ b/src/test/objectstore_bench.cc @@ -87,7 +87,7 @@ class C_NotifyCond : public Context { public: C_NotifyCond(std::mutex *mutex, std::condition_variable *cond, bool *done) : mutex(mutex), cond(cond), done(done) {} - void finish(int r) { + void finish(int r) override { std::lock_guard lock(*mutex); *done = true; cond->notify_one(); diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index 5fba4b443d12..a74ef8342adb 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -330,7 +330,7 @@ class CondPingPong { CondPingPong *p; public: explicit Consumer(CondPingPong *p): p(p) {} - void* entry() { + void* entry() override { p->consume(); return 0; } @@ -473,7 +473,7 @@ class CenterWorker : public Thread { done = true; center.wakeup(); } - void* entry() { + void* entry() override { center.set_owner(); bind_thread_to_cpu(2); while (!done) @@ -487,7 +487,7 @@ class CountEvent: public EventCallback { public: explicit CountEvent(atomic_t *atomic): count(atomic) {} - void do_request(int id) { + void do_request(int id) override { count->dec(); } }; @@ -749,7 +749,7 @@ double test_spinlock() // Helper for spawn_thread. This is the main function that the thread executes // (intentionally empty). class ThreadHelper : public Thread { - void *entry() { return 0; } + void *entry() override { return 0; } }; // Measure the cost of start and joining with a thread. @@ -768,7 +768,7 @@ double spawn_thread() class FakeContext : public Context { public: - virtual void finish(int r) {} + void finish(int r) override {} }; // Measure the cost of starting and stopping a Dispatch::Timer. diff --git a/src/test/system/rados_list_parallel.cc b/src/test/system/rados_list_parallel.cc index ff1cfaeee6e3..cb1724767673 100644 --- a/src/test/system/rados_list_parallel.cc +++ b/src/test/system/rados_list_parallel.cc @@ -56,7 +56,7 @@ public: { } - int run(void) + int run(void) override { int ret_val = 0; rados_t cl; @@ -141,7 +141,7 @@ public: { } - int run(void) + int run(void) override { int ret_val = 0; rados_t cl; @@ -223,7 +223,7 @@ int main(int argc, const char **argv) const char *num_objects = getenv("NUM_OBJECTS"); const std::string pool = get_temp_pool_name(argv[0]); if (num_objects) { - g_num_objects = atoi(num_objects); + g_num_objects = atoi(num_objects); if (g_num_objects == 0) return 100; } @@ -343,6 +343,6 @@ int main(int argc, const char **argv) rados_connect(cl); rados_pool_delete(cl, pool.c_str()); - printf("******* SUCCESS **********\n"); + printf("******* SUCCESS **********\n"); return EXIT_SUCCESS; } diff --git a/src/test/system/rados_open_pools_parallel.cc b/src/test/system/rados_open_pools_parallel.cc index fbaaf2a6e5e4..12d2f44a53c8 100644 --- a/src/test/system/rados_open_pools_parallel.cc +++ b/src/test/system/rados_open_pools_parallel.cc @@ -63,7 +63,7 @@ public: { } - int run() + int run() override { rados_t cl; RETURN1_IF_NONZERO(rados_create(&cl, NULL)); diff --git a/src/test/test_snap_mapper.cc b/src/test/test_snap_mapper.cc index a48fd03a9518..46969e920658 100644 --- a/src/test/test_snap_mapper.cc +++ b/src/test/test_snap_mapper.cc @@ -44,7 +44,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { struct Remove : public _Op { set to_remove; explicit Remove(const set &to_remove) : to_remove(to_remove) {} - void operate(map *store) { + void operate(map *store) override { for (set::iterator i = to_remove.begin(); i != to_remove.end(); ++i) { @@ -55,7 +55,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { struct Insert : public _Op { map to_insert; explicit Insert(const map &to_insert) : to_insert(to_insert) {} - void operate(map *store) { + void operate(map *store) override { for (map::iterator i = to_insert.begin(); i != to_insert.end(); ++i) { @@ -67,7 +67,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { struct Callback : public _Op { Context *context; explicit Callback(Context *c) : context(c) {} - void operate(map *store) { + void operate(map *store) override { context->complete(0); } }; @@ -77,13 +77,13 @@ public: list ops; list callbacks; public: - void set_keys(const map &i) { + void set_keys(const map &i) override { ops.push_back(Op(new Insert(i))); } - void remove_keys(const set &r) { + void remove_keys(const set &r) override { ops.push_back(Op(new Remove(r))); } - void add_callback(Context *c) { + void add_callback(Context *c) override { callbacks.push_back(Op(new Callback(c))); } }; @@ -103,7 +103,7 @@ private: public: explicit Doer(PausyAsyncMap *parent) : parent(parent), lock("Doer lock"), stopping(0), paused(false) {} - virtual void *entry() { + void *entry() override { while (1) { list ops; { @@ -172,7 +172,7 @@ public: } int get_keys( const set &keys, - map *out) { + map *out) override { Mutex::Locker l(lock); for (set::const_iterator i = keys.begin(); i != keys.end(); @@ -185,7 +185,7 @@ public: } int get_next( const string &key, - pair *next) { + pair *next) override { Mutex::Locker l(lock); map::iterator j = store.upper_bound(key); if (j != store.end()) { @@ -213,7 +213,7 @@ public: public: OnFinish(Mutex *lock, Cond *cond, bool *done) : lock(lock), cond(cond), done(done) {} - void finish(int) { + void finish(int) override { Mutex::Locker l(*lock); *done = true; cond->Signal(); @@ -364,7 +364,7 @@ public: cur = next.first; } } - virtual void SetUp() { + void SetUp() override { driver.reset(new PausyAsyncMap()); cache.reset(new MapCacher::MapCacher(driver.get())); names.clear(); @@ -374,7 +374,7 @@ public: names.insert(random_string(1 + (random_size() % 10))); } } - virtual void TearDown() { + void TearDown() override { driver->stop(); cache.reset(); driver.reset(); @@ -587,12 +587,12 @@ protected: map > mappers; uint32_t pgnum; - virtual void SetUp() { + void SetUp() override { driver.reset(new PausyAsyncMap()); pgnum = 0; } - virtual void TearDown() { + void TearDown() override { driver->stop(); mappers.clear(); driver.reset(); diff --git a/src/test/test_stress_watch.cc b/src/test/test_stress_watch.cc index 5077b13bf6a4..ff964df17ed3 100644 --- a/src/test/test_stress_watch.cc +++ b/src/test/test_stress_watch.cc @@ -28,7 +28,7 @@ static atomic_t stop_flag; class WatchNotifyTestCtx : public WatchCtx { public: - void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) + void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override { sem_post(sem); } @@ -42,7 +42,7 @@ struct WatcherUnwatcher : public Thread { string pool; explicit WatcherUnwatcher(string& _pool) : pool(_pool) {} - void *entry() { + void *entry() override { Rados cluster; connect_cluster_pp(cluster); while (!stop_flag.read()) { diff --git a/src/test/test_trans.cc b/src/test/test_trans.cc index db297f63db97..394b9892aaa8 100644 --- a/src/test/test_trans.cc +++ b/src/test/test_trans.cc @@ -25,7 +25,7 @@ #define dout_prefix *_dout struct Foo : public Thread { - void *entry() { + void *entry() override { dout(0) << "foo started" << dendl; sleep(1); dout(0) << "foo asserting 0" << dendl; diff --git a/src/test/test_xlist.cc b/src/test/test_xlist.cc index c34f8c540420..f13bf41dd688 100644 --- a/src/test/test_xlist.cc +++ b/src/test/test_xlist.cc @@ -26,13 +26,13 @@ protected: // for filling up an ItemList Refs refs; - virtual void SetUp() { + void SetUp() override { for (int i = 0; i < 13; i++) { items.push_back(new Item(i)); refs.push_back(&items.back()->xitem); } } - virtual void TearDown() { + void TearDown() override { for (Items::iterator i = items.begin(); i != items.end(); ++i) { delete *i; } diff --git a/src/test/xattr_bench.cc b/src/test/xattr_bench.cc index 2e016925fa15..4e5f1a79253d 100644 --- a/src/test/xattr_bench.cc +++ b/src/test/xattr_bench.cc @@ -66,7 +66,7 @@ public: (*in_progress)++; } - void finish(int r) { + void finish(int r) override { Mutex::Locker l(*lock); (*in_progress)--; cond->Signal(); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index d7d1319f6c35..2e96d8950bec 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -266,7 +266,7 @@ struct lookup_ghobject : public action_on_object_t { lookup_ghobject(const string& name, const boost::optional& nspace, bool need_snapset = false) : _name(name), _namespace(nspace), _need_snapset(need_snapset) { } - virtual int call(ObjectStore *store, coll_t coll, ghobject_t &ghobj, object_info_t &oi) { + int call(ObjectStore *store, coll_t coll, ghobject_t &ghobj, object_info_t &oi) override { if (_need_snapset && !ghobj.hobj.has_snapset()) return 0; if ((_name.length() == 0 || ghobj.hobj.oid.name == _name) && @@ -1829,8 +1829,8 @@ struct do_fix_lost : public action_on_object_t { explicit do_fix_lost(ObjectStore::Sequencer *_osr) : osr(_osr) {} - virtual int call(ObjectStore *store, coll_t coll, - ghobject_t &ghobj, object_info_t &oi) { + int call(ObjectStore *store, coll_t coll, + ghobject_t &ghobj, object_info_t &oi) override { if (oi.is_lost()) { cout << coll << "/" << ghobj << " is lost"; if (!dry_run) diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index c460bbdd6188..5a100e264eed 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -493,11 +493,11 @@ class RadosWatchCtx : public librados::WatchCtx2 { string name; public: RadosWatchCtx(IoCtx& io, const char *imgname) : ioctx(io), name(imgname) {} - virtual ~RadosWatchCtx() {} + ~RadosWatchCtx() {} void handle_notify(uint64_t notify_id, uint64_t cookie, uint64_t notifier_id, - bufferlist& bl) { + bufferlist& bl) override { cout << "NOTIFY" << " cookie " << cookie << " notify_id " << notify_id @@ -506,7 +506,7 @@ public: bl.hexdump(cout); ioctx.notify_ack(name, notify_id, cookie, bl); } - void handle_error(uint64_t cookie, int err) { + void handle_error(uint64_t cookie, int err) override { cout << "ERROR" << " cookie " << cookie << " err " << cpp_strerror(err) @@ -886,15 +886,15 @@ class RadosBencher : public ObjBencher { OpWriteDest write_destination; protected: - int completions_init(int concurrentios) { + int completions_init(int concurrentios) override { completions = new librados::AioCompletion *[concurrentios]; return 0; } - void completions_done() { + void completions_done() override { delete[] completions; completions = NULL; } - int create_completion(int slot, void (*cb)(void *, void*), void *arg) { + int create_completion(int slot, void (*cb)(void *, void*), void *arg) override { completions[slot] = rados.aio_create_completion((void *) arg, 0, cb); if (!completions[slot]) @@ -902,18 +902,18 @@ protected: return 0; } - void release_completion(int slot) { + void release_completion(int slot) override { completions[slot]->release(); completions[slot] = 0; } int aio_read(const std::string& oid, int slot, bufferlist *pbl, size_t len, - size_t offset) { + size_t offset) override { return io_ctx.aio_read(oid, completions[slot], pbl, len, 0); } int aio_write(const std::string& oid, int slot, bufferlist& bl, size_t len, - size_t offset) { + size_t offset) override { librados::ObjectWriteOperation op; if (write_destination & OP_WRITE_DEST_OBJ) { @@ -941,33 +941,33 @@ protected: return io_ctx.aio_operate(oid, completions[slot], &op); } - int aio_remove(const std::string& oid, int slot) { + int aio_remove(const std::string& oid, int slot) override { return io_ctx.aio_remove(oid, completions[slot]); } - int sync_read(const std::string& oid, bufferlist& bl, size_t len) { + int sync_read(const std::string& oid, bufferlist& bl, size_t len) override { return io_ctx.read(oid, bl, len, 0); } - int sync_write(const std::string& oid, bufferlist& bl, size_t len) { + int sync_write(const std::string& oid, bufferlist& bl, size_t len) override { return io_ctx.write_full(oid, bl); } - int sync_remove(const std::string& oid) { + int sync_remove(const std::string& oid) override { return io_ctx.remove(oid); } - bool completion_is_done(int slot) { + bool completion_is_done(int slot) override { return completions[slot]->is_safe(); } - int completion_wait(int slot) { + int completion_wait(int slot) override { return completions[slot]->wait_for_safe_and_cb(); } - int completion_ret(int slot) { + int completion_ret(int slot) override { return completions[slot]->get_return_value(); } - bool get_objects(std::list* objects, int num) { + bool get_objects(std::list* objects, int num) override { int count = 0; if (!iterator_valid) { @@ -992,7 +992,7 @@ protected: return true; } - void set_namespace( const std::string& ns) { + void set_namespace( const std::string& ns) override { io_ctx.set_namespace(ns); } diff --git a/src/tools/scratchtoolpp.cc b/src/tools/scratchtoolpp.cc index f91424467878..9d6077461bdb 100644 --- a/src/tools/scratchtoolpp.cc +++ b/src/tools/scratchtoolpp.cc @@ -38,7 +38,7 @@ void buf_to_hex(const unsigned char *buf, int len, char *str) class C_Watch : public WatchCtx { public: C_Watch() {} - void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) { + void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override { cout << "C_Watch::notify() opcode=" << (int)opcode << " ver=" << ver << std::endl; } };