]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code,test: silence -Wunused-variable warnings 25200/head
authorKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 12:43:38 +0000 (20:43 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 12:47:56 +0000 (20:47 +0800)
GCC 7.3 does not support [[maybe_unused]] very well, so it emits
-Wunused-variable warnings even if the variables are marked with
maybe_unused. moreover, the C++17 standard does not forbid these
warnings:

> For an entity marked maybe_unused, implementations are encouraged not
to emit a warning that the entity is unused, or that the entity is used
despite the presence of the attribute.

see also n4659, dcl.attr.unused

so, in this change, the warnings are silenced manually.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/erasure-code/clay/ErasureCodeClay.cc
src/test/crimson/test_perfcounters.cc

index 9276465edd51f4f0609113e7ef677a8dd1061004..2bf45b72f9de72911b9ceba9f88f7b582bc12403 100644 (file)
@@ -113,6 +113,7 @@ int ErasureCodeClay::decode(const set<int> &want_to_read,
   set<int> avail;
   for ([[maybe_unused]] auto& [node, bl] : chunks) {
     avail.insert(node);
+    (void)bl;  // silence -Wunused-variable
   }
 
   if (is_repair(want_to_read, avail) && 
@@ -484,6 +485,7 @@ int ErasureCodeClay::repair_one_lost_chunk(map<int, bufferlist> &recovered_data,
       // check across all erasures and aloof nodes
       for ([[maybe_unused]] auto& [node, bl] : recovered_data) {
         if (node % q == z_vec[node / q]) order++;
+        (void)bl;  // silence -Wunused-variable
       }
       for (auto node : aloof_nodes) {
         if (node % q == z_vec[node / q]) order++;
@@ -511,6 +513,7 @@ int ErasureCodeClay::repair_one_lost_chunk(map<int, bufferlist> &recovered_data,
   for ([[maybe_unused]] auto& [node, bl] : recovered_data) {
     lost_chunk = node;
     count++;
+    (void)bl;  // silence -Wunused-variable
   }
   ceph_assert(count == 1);
 
@@ -655,6 +658,7 @@ int ErasureCodeClay::decode_layered(set<int> &erased_chunks,
   for (int i = k+nu; (num_erasures < m) && (i < q*t); i++) {
     if ([[maybe_unused]] auto [it, added] = erased_chunks.emplace(i); added) {
       num_erasures++;
+      (void)it;  // silence -Wunused-variable
     }
   }
   ceph_assert(num_erasures == m);
index 581844d133f488e49a35c35ed3555d3e86484d5c..da8cc8f31da67c01e84a29fb0bfae44779314b06 100644 (file)
@@ -36,6 +36,7 @@ static seastar::future<> test_perfcounters(){
           if (PERF_VAL != perf_counter_ref.perf_counters->get(PERFTEST_INDEX)) {
             throw std::runtime_error("perf counter does not match");
           }
+          (void)path;           // silence -Wunused-variable
         }
       });
     });