Skip to content

Commit 5203418

Browse files
committed
Fix build issues with libc mem* benchmarks
Fix a few issues found when trying to build the benchmark: Errors 1. Unable to find include "src/__support/macros/config.h" in LibcMemoryBenchmarkMain.cpp Warnings 2. Unused variable warning `Index` in MemorySizeDistributions.cpp 3. Fix deprecation warning for const-ref version of `DoNotOptimize`. warning: 'DoNotOptimize<void *>' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks
1 parent 24a8092 commit 5203418

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

libc/benchmarks/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ add_library(libc-memory-benchmark
126126
target_include_directories(libc-memory-benchmark
127127
PUBLIC
128128
${CMAKE_CURRENT_SOURCE_DIR}
129+
${LIBC_SOURCE_DIR}
129130
)
130131
target_link_libraries(libc-memory-benchmark
131132
PUBLIC

libc/benchmarks/LibcBenchmark.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ BenchmarkResult benchmark(const BenchmarkOptions &Options,
211211
// Measuring this Batch.
212212
const auto StartTime = Clock.now();
213213
for (const auto Parameter : Batch) {
214-
const auto Production = foo(Parameter);
214+
auto Production = foo(Parameter);
215215
benchmark::DoNotOptimize(Production);
216216
}
217217
const auto EndTime = Clock.now();

libc/benchmarks/MemorySizeDistributions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ ArrayRef<MemorySizeDistribution> getMemcmpSizeDistributions() {
185185
MemorySizeDistribution
186186
getDistributionOrDie(ArrayRef<MemorySizeDistribution> Distributions,
187187
StringRef Name) {
188-
size_t Index = 0;
189188
for (const auto &MSD : Distributions) {
190189
if (MSD.Name == Name)
191190
return MSD;
192-
++Index;
193191
}
194192
std::string Message;
195193
raw_string_ostream Stream(Message);

0 commit comments

Comments
 (0)