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 <aemerson@redhat.com>
This commit is contained in:
Adam C. Emerson 2017-10-19 14:21:30 -04:00
parent 87b4d1646e
commit bda3c2673b

View File

@ -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) {