From 67e2213f701e3336730dbe2d52463d28bd0ba92e Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Wed, 28 Sep 2022 18:12:48 -0400 Subject: [PATCH] test/perf_local: Mark unused but useful variables as `maybe_unused` Since they're used for a print that's commented out, keep them around but silence the warning about them. Signed-off-by: Adam C. Emerson --- src/test/perf_local.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index 6c733acf9e8..321f2d30ca6 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -132,7 +132,7 @@ double atomic_int_read() { int count = 1000000; std::atomic value = { 11 }; - int total = 0; + [[maybe_unused]] int total = 0; uint64_t start = Cycles::rdtsc(); for (int i = 0; i < count; i++) { total += value; @@ -566,7 +566,7 @@ double rdtsc_test() { int count = 1000000; uint64_t start = Cycles::rdtsc(); - uint64_t total = 0; + [[maybe_unused]] uint64_t total = 0; for (int i = 0; i < count; i++) { total += Cycles::rdtsc(); } @@ -578,7 +578,7 @@ double rdtsc_test() double perf_cycles_to_seconds() { int count = 1000000; - double total = 0; + [[maybe_unused]] double total = 0; uint64_t cycles = 994261; uint64_t start = Cycles::rdtsc(); for (int i = 0; i < count; i++) { @@ -593,7 +593,7 @@ double perf_cycles_to_seconds() double perf_cycles_to_nanoseconds() { int count = 1000000; - uint64_t total = 0; + [[maybe_unused]] uint64_t total = 0; uint64_t cycles = 994261; uint64_t start = Cycles::rdtsc(); for (int i = 0; i < count; i++) { -- 2.47.3