]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
OSD: Silence unused variable warnings
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 19 Oct 2017 18:21:30 +0000 (14:21 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 19 Oct 2017 18:43:57 +0000 (14:43 -0400)
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>
src/osd/OSD.cc

index bbcd2aad0c0ab36cfb6afdea61b63c237824abf7..95923006d63a352911d46520b572e239926ad016 100644 (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) {