From bda3c2673bec0e32232594ba349b49a43c080879 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 19 Oct 2017 14:21:30 -0400 Subject: [PATCH] OSD: Silence unused variable warnings Even though extending the lifetime of this temporary delays execution of its destructor, the compiler does not consider the reference to have a side-effecting constructor. The compiler is wrong, but we can silence its complaints. This will cease to be an issue once we adopt C++17, since mandatory RVO will solve the inability to bind a variable to a returned move-only object and the need to extend a temporary. Signed-off-by: Adam C. Emerson --- src/osd/OSD.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index bbcd2aad0c0..95923006d63 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4183,7 +4183,7 @@ bool OSD::maybe_wait_for_max_pg(spg_t pgid, bool is_mon_create) if (pg_map.size() < max_pgs_per_osd) { return false; } - auto&& pending_creates_locker = guardedly_lock(pending_creates_lock); + [[gnu::unused]] auto&& pending_creates_locker = guardedly_lock(pending_creates_lock); if (is_mon_create) { pending_creates_from_mon++; } else { @@ -4221,7 +4221,7 @@ void OSD::resume_creating_pg() return; } unsigned spare_pgs = max_pgs_per_osd - pg_map.size(); - auto&& locker = guardedly_lock(pending_creates_lock); + [[gnu::unused]] auto&& locker = guardedly_lock(pending_creates_lock); if (pending_creates_from_mon > 0) { do_sub_pg_creates = true; if (pending_creates_from_mon >= spare_pgs) { @@ -7810,7 +7810,7 @@ void OSD::consume_map() pg->unlock(); } - auto&& pending_create_locker = guardedly_lock(pending_creates_lock); + [[gnu::unused]] auto&& pending_create_locker = guardedly_lock(pending_creates_lock); for (auto pg = pending_creates_from_osd.cbegin(); pg != pending_creates_from_osd.cend();) { if (osdmap->get_pg_acting_rank(*pg, whoami) < 0) { -- 2.39.5