Skip to content

Commit f5f070b

Browse files
committed
[libc++] Make benchmarks forward-compatible with the test suite
This patch fixes a few warnings and errors when running the benchmarks as part of the test suite. It also adds most of the necessary Lit annotations to make it pass on various configurations.
1 parent ef67664 commit f5f070b

File tree

63 files changed

+149
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+149
-22
lines changed

libcxx/test/benchmarks/CartesianBenchmarks.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ constexpr auto makeEnumValueTuple(std::index_sequence<Idxs...>) {
2727
}
2828

2929
template <class B>
30-
static auto skip(const B& Bench, int) -> decltype(Bench.skip()) {
30+
auto skip(const B& Bench, int) -> decltype(Bench.skip()) {
3131
return Bench.skip();
3232
}
3333
template <class B>
34-
static auto skip(const B& Bench, char) {
34+
auto skip(const B&, char) {
3535
return false;
3636
}
3737

@@ -51,7 +51,7 @@ void makeBenchmarkFromValues(const std::vector<std::tuple<Args...> >& A) {
5151
}
5252

5353
template <template <class...> class B, class Args, class... U>
54-
void makeBenchmarkImpl(const Args& A, std::tuple<U...> t) {
54+
void makeBenchmarkImpl(const Args& A, std::tuple<U...>) {
5555
makeBenchmarkFromValues<B<U...> >(A);
5656
}
5757

libcxx/test/benchmarks/ContainerBenchmarks.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void BM_EmplaceDuplicate(benchmark::State& st, Container c, GenInputs gen) {
150150
}
151151

152152
template <class Container, class GenInputs>
153-
static void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
153+
void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
154154
auto in = gen(st.range(0));
155155
c.insert(in.begin(), in.end());
156156
benchmark::DoNotOptimize(&(*c.begin()));
@@ -164,7 +164,7 @@ static void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
164164
}
165165

166166
template <class Container, class GenInputs>
167-
static void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
167+
void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
168168
c.rehash(8);
169169
auto in = gen(st.range(0));
170170
c.insert(in.begin(), in.end());
@@ -179,7 +179,7 @@ static void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
179179
}
180180

181181
template <class Container, class GenInputs>
182-
static void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
182+
void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
183183
auto in = gen(st.range(0));
184184
c.max_load_factor(3.0);
185185
c.insert(in.begin(), in.end());
@@ -193,7 +193,7 @@ static void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
193193
}
194194

195195
template <class Container, class GenInputs>
196-
static void BM_Compare_same_container(benchmark::State& st, Container, GenInputs gen) {
196+
void BM_Compare_same_container(benchmark::State& st, Container, GenInputs gen) {
197197
auto in = gen(st.range(0));
198198
Container c1(in.begin(), in.end());
199199
Container c2 = c1;
@@ -208,7 +208,7 @@ static void BM_Compare_same_container(benchmark::State& st, Container, GenInputs
208208
}
209209

210210
template <class Container, class GenInputs>
211-
static void BM_Compare_different_containers(benchmark::State& st, Container, GenInputs gen) {
211+
void BM_Compare_different_containers(benchmark::State& st, Container, GenInputs gen) {
212212
auto in1 = gen(st.range(0));
213213
auto in2 = gen(st.range(0));
214214
Container c1(in1.begin(), in1.end());

libcxx/test/benchmarks/algorithms.partition_point.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012
#include <array>
1113
#include <cassert>

libcxx/test/benchmarks/algorithms/count.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <cstring>

libcxx/test/benchmarks/algorithms/equal.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <vector>

libcxx/test/benchmarks/algorithms/fill.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <vector>

libcxx/test/benchmarks/algorithms/find.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <cstring>

libcxx/test/benchmarks/algorithms/for_each.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <deque>

libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012
#include <numeric>
1113
#include <random>

libcxx/test/benchmarks/algorithms/make_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/min.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012
#include <cassert>
1113

libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/minmax.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012
#include <cassert>
1113

libcxx/test/benchmarks/algorithms/mismatch.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <random>

libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012
#include <execution>
1113

libcxx/test/benchmarks/algorithms/push_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <iterator>

libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
911
#include <algorithm>
1012
#include <benchmark/benchmark.h>
1113
#include <iterator>

libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/set_intersection.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012
#include <cstdlib>
1113
#include <iterator>

libcxx/test/benchmarks/algorithms/sort.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <algorithm>
1012

1113
#include "common.h"

libcxx/test/benchmarks/allocation.bench.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// REQUIRES: -fsized-deallocation
10+
// ADDITIONAL_COMPILE_FLAGS: -fsized-deallocation
11+
912
#include "benchmark/benchmark.h"
1013

1114
#include <cassert>
15+
#include <cstdlib>
1216
#include <new>
1317
#include <vector>
1418

libcxx/test/benchmarks/atomic_wait.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <atomic>
1012
#include <numeric>
1113
#include <thread>

libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
// To run this test, build libcxx and cxx-benchmarks targets
1012
// cd third-party/benchmark/tools
1113
// ./compare.py filters ../../../build/libcxx/benchmarks/atomic_wait_vs_mutex_lock.libcxx.out BM_atomic_wait BM_mutex

libcxx/test/benchmarks/deque.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
911
#include <deque>
1012

1113
#include "benchmark/benchmark.h"

libcxx/test/benchmarks/deque_iterator.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <algorithm>
1012
#include <deque>
1113

libcxx/test/benchmarks/filesystem.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14
10+
911
#include <filesystem>
1012

1113
#include "GenerateInput.h"

libcxx/test/benchmarks/format.bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
911
#include <format>
1012

1113
#include <string>

0 commit comments

Comments
 (0)