From 3fb6cea2fb6edf07d7895fd451855bff722401bd Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 11 Jan 2020 16:07:42 +0800 Subject: [PATCH] crimson: do not capture unused variables this silences warnings from clang: src/crimson/osd/heartbeat.cc:109:14: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] .then([this, &info=peer_info->second] (auto xcon_front, auto xcon_back) { ^~~~~ Signed-off-by: Kefu Chai --- src/crimson/net/ProtocolV1.cc | 2 +- src/crimson/net/ProtocolV2.cc | 10 +++++----- src/crimson/osd/heartbeat.cc | 4 ++-- src/crimson/osd/osd.cc | 6 +++--- src/crimson/osd/pg_backend.cc | 6 +++--- src/crimson/osd/pg_meta.cc | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/crimson/net/ProtocolV1.cc b/src/crimson/net/ProtocolV1.cc index ac8f65402ab09..9bd41a8fe2e3a 100644 --- a/src/crimson/net/ProtocolV1.cc +++ b/src/crimson/net/ProtocolV1.cc @@ -441,7 +441,7 @@ seastar::future ProtocolV1::send_connect_reply_ready( } else { return socket->flush(); } - }).then([this] { + }).then([] { return stop_t::yes; }); } diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 2de2dd75e98c9..36867b07d42ff 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -917,7 +917,7 @@ void ProtocolV2::execute_connecting() abort_protocol(); } if (socket) { - (void) with_gate(pending_dispatch, [this, sock = std::move(socket)] () mutable { + (void) with_gate(pending_dispatch, [sock = std::move(socket)] () mutable { return sock->close().then([sock = std::move(sock)] {}); }); } @@ -928,7 +928,7 @@ void ProtocolV2::execute_connecting() if (unlikely(state != state_t::CONNECTING)) { logger().debug("{} triggered {} during Socket::connect()", conn, get_state_name(state)); - return sock->close().then([this, sock = std::move(sock)] { + return sock->close().then([sock = std::move(sock)] { abort_protocol(); }); } @@ -1129,7 +1129,7 @@ ProtocolV2::send_wait() { auto wait = WaitFrame::Encode(); logger().debug("{} WRITE WaitFrame", conn); - return write_frame(wait).then([this] { + return write_frame(wait).then([] { return next_step_t::wait; }); } @@ -1319,7 +1319,7 @@ ProtocolV2::server_connect() auto ident_missing_features = IdentMissingFeaturesFrame::Encode(feat_missing); logger().warn("{} WRITE IdentMissingFeaturesFrame: features={} (peer missing)", conn, feat_missing); - return write_frame(ident_missing_features).then([this] { + return write_frame(ident_missing_features).then([] { return next_step_t::wait; }); } @@ -1791,7 +1791,7 @@ void ProtocolV2::trigger_replacing(bool reconnect, } if (socket) { - (void) with_gate(pending_dispatch, [this, sock = std::move(socket)] () mutable { + (void) with_gate(pending_dispatch, [sock = std::move(socket)] () mutable { return sock->close().then([sock = std::move(sock)] {}); }); } diff --git a/src/crimson/osd/heartbeat.cc b/src/crimson/osd/heartbeat.cc index e1a1738a2f3f3..139e684c092e2 100644 --- a/src/crimson/osd/heartbeat.cc +++ b/src/crimson/osd/heartbeat.cc @@ -106,7 +106,7 @@ seastar::future<> Heartbeat::add_peer(osd_id_t peer, epoch_t epoch) CEPH_ENTITY_TYPE_OSD), back_msgr.connect(osdmap->get_hb_back_addrs(peer).front(), CEPH_ENTITY_TYPE_OSD)) - .then([this, &info=peer_info->second] (auto xcon_front, auto xcon_back) { + .then([&info=peer_info->second] (auto xcon_front, auto xcon_back) { // sharded-messenger compatible mode info.con_front = xcon_front->release(); info.con_back = xcon_back->release(); @@ -135,7 +135,7 @@ seastar::future Heartbeat::remove_down_peers() return seastar::make_ready_future(-1); } }, osds_t{}, - [this](osds_t&& extras, osd_id_t extra) { + [](osds_t&& extras, osd_id_t extra) { if (extra >= 0) { extras.push_back(extra); } diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 1d7abd6eb4dc3..64231720bf5fa 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -359,7 +359,7 @@ seastar::future<> OSD::_add_me_to_crush() "args": [{}] }})", whoami, weight, loc); return monc->run_command({cmd}, {}).then( - [this](int32_t code, string message, bufferlist) { + [](int32_t code, string message, bufferlist) { if (code) { logger().warn("fail to add to crush: {} ({})", message, code); throw std::runtime_error("fail to add to crush"); @@ -605,7 +605,7 @@ seastar::future> OSD::load_map(epoch_t e) { auto o = std::make_unique(); if (e > 0) { - return load_map_bl(e).then([e, o=std::move(o), this](bufferlist bl) mutable { + return load_map_bl(e).then([o=std::move(o)](bufferlist bl) mutable { o->decode(bl); return seastar::make_ready_future>(std::move(o)); }); @@ -695,7 +695,7 @@ seastar::future> OSD::handle_pg_create_info( } } return make_pg(startmap, pgid).then( - [this, startmap=std::move(startmap)](auto pg) mutable { + [startmap=std::move(startmap)](auto pg) mutable { return seastar::make_ready_future, cached_map_t>( std::move(pg), std::move(startmap)); diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc index 415c2e7d0f983..418245e6c75cb 100644 --- a/src/crimson/osd/pg_backend.cc +++ b/src/crimson/osd/pg_backend.cc @@ -67,7 +67,7 @@ PGBackend::load_metadata(const hobject_t& oid) return store->get_attrs( coll, ghobject_t{oid, ghobject_t::NO_GEN, shard}).safe_then( - [oid, this](auto &&attrs) -> load_metadata_ertr::future{ + [oid](auto &&attrs) -> load_metadata_ertr::future{ loaded_object_md_t::ref ret(new loaded_object_md_t()); if (auto oiiter = attrs.find(OI_ATTR); oiiter != attrs.end()) { bufferlist bl; @@ -100,7 +100,7 @@ PGBackend::load_metadata(const hobject_t& oid) return load_metadata_ertr::make_ready_future( std::move(ret)); - }, crimson::ct_error::enoent::handle([oid, this] { + }, crimson::ct_error::enoent::handle([oid] { logger().debug( "load_metadata: object {} doesn't exist, returning empty metadata", oid); @@ -360,7 +360,7 @@ PGBackend::list_objects(const hobject_t& start, uint64_t limit) const gstart, ghobject_t::get_max(), limit) - .then([this](std::vector gobjects, ghobject_t next) { + .then([](std::vector gobjects, ghobject_t next) { std::vector objects; boost::copy(gobjects | boost::adaptors::filtered([](const ghobject_t& o) { diff --git a/src/crimson/osd/pg_meta.cc b/src/crimson/osd/pg_meta.cc index 642a18c64be58..6ca3f00f6b9a5 100644 --- a/src/crimson/osd/pg_meta.cc +++ b/src/crimson/osd/pg_meta.cc @@ -63,7 +63,7 @@ seastar::future PGMeta::load() string{info_key}, string{biginfo_key}, string{fastinfo_key}}); - }).then([this](auto&& values) { + }).then([](auto&& values) { { // sanity check auto infover = find_value<__u8>(values, infover_key); -- 2.39.5