6daf2dff6f
* Split the benchmark monolithic header * src uses modular headers * updated tests to use split headers * clang-format * clang-format mistake * fix exports * suppress warnings on msvc * fixing double pops and some more missing exports
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#include "benchmark/macros.h"
|
|
#include "benchmark/registration.h"
|
|
#include "benchmark/state.h"
|
|
|
|
namespace {
|
|
// Simulate an overloaded function name.
|
|
// This version does nothing and is just here to create ambiguity for
|
|
// MyOverloadedBenchmark.
|
|
BENCHMARK_UNUSED void MyOverloadedBenchmark() {}
|
|
|
|
// This is the actual benchmark function we want to register.
|
|
// It has the signature void(benchmark::State&) required by the library.
|
|
void MyOverloadedBenchmark(benchmark::State& state) {
|
|
for (auto _ : state) {
|
|
}
|
|
}
|
|
|
|
// This macro invocation should compile correctly if benchmark.h
|
|
// contains the fix (using static_cast), but would fail to compile
|
|
// if the benchmark name were ambiguous (e.g., when using + or no cast
|
|
// with an overloaded function).
|
|
BENCHMARK(MyOverloadedBenchmark);
|
|
|
|
// Also test BENCHMARK_TEMPLATE with an overloaded name.
|
|
template <int N>
|
|
void MyTemplatedOverloadedBenchmark() {}
|
|
|
|
template <int N>
|
|
void MyTemplatedOverloadedBenchmark(benchmark::State& state) {
|
|
for (auto _ : state) {
|
|
}
|
|
}
|
|
|
|
BENCHMARK_TEMPLATE(MyTemplatedOverloadedBenchmark, 1);
|
|
} // end namespace
|
|
|
|
BENCHMARK_MAIN();
|