[libcxx-commits] [libcxx] 3df9c29 - [libc++] Fix minor warnings in libcxx benchmarks

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 13 14:07:41 PDT 2023


Author: Dmitry Ilvokhin
Date: 2023-09-13T17:05:56-04:00
New Revision: 3df9c2984b4e15c9777c3d8046927014f8a04b34

URL: https://github.com/llvm/llvm-project/commit/3df9c2984b4e15c9777c3d8046927014f8a04b34
DIFF: https://github.com/llvm/llvm-project/commit/3df9c2984b4e15c9777c3d8046927014f8a04b34.diff

LOG: [libc++] Fix minor warnings in libcxx benchmarks

This fixes some unused variable and "comparison of integers of different
signs" warnings in the benchmarks.

Differential Revision: https://reviews.llvm.org/D156613

Added: 
    

Modified: 
    libcxx/benchmarks/allocation.bench.cpp
    libcxx/benchmarks/monotonic_buffer.bench.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/benchmarks/allocation.bench.cpp b/libcxx/benchmarks/allocation.bench.cpp
index 16be2b17fb70ebe..1d0c71f5bec19ea 100644
--- a/libcxx/benchmarks/allocation.bench.cpp
+++ b/libcxx/benchmarks/allocation.bench.cpp
@@ -76,8 +76,8 @@ static void BM_DeallocateOnly(benchmark::State& st) {
     p = AllocWrapper::Allocate(alloc_size);
   }
 
-  void** Data      = Pointers.data();
-  void** const End = Pointers.data() + Pointers.size();
+  void** Data                       = Pointers.data();
+  [[maybe_unused]] void** const End = Pointers.data() + Pointers.size();
   while (st.KeepRunning()) {
     AllocWrapper::Deallocate(*Data, alloc_size);
     Data += 1;

diff  --git a/libcxx/benchmarks/monotonic_buffer.bench.cpp b/libcxx/benchmarks/monotonic_buffer.bench.cpp
index cfedbe582ded0c7..39bb853ccba5dd1 100644
--- a/libcxx/benchmarks/monotonic_buffer.bench.cpp
+++ b/libcxx/benchmarks/monotonic_buffer.bench.cpp
@@ -16,7 +16,7 @@ static void bm_list(benchmark::State& state) {
   std::pmr::monotonic_buffer_resource resource(buffer, sizeof(buffer));
   for (auto _ : state) {
     std::pmr::list<int> l(&resource);
-    for (size_t i = 0; i != state.range(); ++i) {
+    for (int64_t i = 0; i != state.range(); ++i) {
       l.push_back(1);
       benchmark::DoNotOptimize(l);
     }


        


More information about the libcxx-commits mailing list