-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Finish cxx version bump #1948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish cxx version bump #1948
Conversation
835365f stopped defining it, but didn't un-conditionalize the code guarded under it...
We no longer support such an old gcc version
05f6cc8
to
ef1d99d
Compare
#elif defined(__GNUC__) || defined(__clang__) | ||
#define BENCHMARK_UNUSED __attribute__((unused)) | ||
#else | ||
#define BENCHMARK_UNUSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this mean we only need C++11 to use the library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No:
FAILED: test/CMakeFiles/cxx14_test.dir/cxx14_test.cc.o
/usr/bin/c++ -DBENCHMARK_STATIC_DEFINE -DHAVE_POSIX_REGEX -DHAVE_PTHREAD_AFFINITY -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -DTEST_BENCHMARK_LIBRARY_HAS_NO_ASSERTIONS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/tmp/benchmark/include -pipe -Wall -Wextra -Wshadow -Wfloat-equal -Wold-style-cast -Wconversion -Werror -pedantic -pedantic-errors -fstrict-aliasing -Wno-deprecated-declarations -Wno-deprecated -Wstrict-aliasing -Wno-unused-variable -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -UNDEBUG -MD -MT test/CMakeFiles/cxx14_test.dir/cxx14_test.cc.o -MF test/CMakeFiles/cxx14_test.dir/cxx14_test.cc.o.d -o test/CMakeFiles/cxx14_test.dir/cxx14_test.cc.o -c /tmp/benchmark/test/cxx14_test.cc
In file included from /tmp/benchmark/test/cxx14_test.cc:1:
/tmp/benchmark/include/benchmark/benchmark.h: In function ‘benchmark::internal::Benchmark* benchmark::RegisterBenchmark(const std::string&, void (*)(State&))’:
/tmp/benchmark/include/benchmark/benchmark.h:1382:12: error: ‘make_unique’ is not a member of ‘std’
1382 | std::make_unique<internal::FunctionBenchmark>(name, fn));
| ^~~~~~~~~~~
/tmp/benchmark/include/benchmark/benchmark.h:1382:12: note: ‘std::make_unique’ is only available from C++14 onwards
/tmp/benchmark/include/benchmark/benchmark.h:1382:51: error: expected primary-expression before ‘>’ token
1382 | std::make_unique<internal::FunctionBenchmark>(name, fn));
| ^
/tmp/benchmark/include/benchmark/benchmark.h:1382:53: error: left operand of comma operator has no effect [-Werror=unused-value]
1382 | std::make_unique<internal::FunctionBenchmark>(name, fn));
| ^~~~
/tmp/benchmark/include/benchmark/benchmark.h: In function ‘benchmark::internal::Benchmark* benchmark::RegisterBenchmark(const std::string&, Lambda&&)’:
/tmp/benchmark/include/benchmark/benchmark.h:1390:12: error: ‘make_unique’ is not a member of ‘std’
1390 | std::make_unique<BenchType>(name, std::forward<Lambda>(fn)));
| ^~~~~~~~~~~
/tmp/benchmark/include/benchmark/benchmark.h:1390:12: note: ‘std::make_unique’ is only available from C++14 onwards
/tmp/benchmark/include/benchmark/benchmark.h:1390:33: error: expected primary-expression before ‘>’ token
1390 | std::make_unique<BenchType>(name, std::forward<Lambda>(fn)));
| ^
Do we want to keep C++11 support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we don't need C++11 support any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you so much for finishing this off!
ef1d99d
to
e68c05e
Compare
213749b
to
2ab99c8
Compare
I don't think we want to support C++03 though, but i suppose C++11 is palatable, at least right now.
2ab99c8
to
80673cc
Compare
@dmah42 thank you! |
Hello, The We have benchmark functions with the same name as functions in our public API. For example: static void ExportType(benchmark::State& state) { // NOLINT non-const reference
struct ArrowSchema c_export;
auto type = utf8();
for (auto _ : state) {
ABORT_NOT_OK(ExportType(*type, &c_export));
ArrowSchemaRelease(&c_export);
}
state.SetItemsProcessed(state.iterations());
} With these changes, it appears that the
(see full error log at https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-amd64-c6a-4xlarge-linux/builds/932#0195d16c-04e9-4bb2-9cfd-4ec078cf7570/95-1582) |
if you rename the benchmark function to something like |
Yes, it does, but we don't want to do that: it would break benchmark history. Instead I've opted to put the benchmark functions in a dedicated namespace. |
ah ok .. so it wouldn't help if we prepended something to the benchmark name within the library. adding them to a namespace, even an unnamed one, works i guess because of name resolution rules. i'm a bit surprised it didn't work anyway, given the locality of the benchmark function, but there is ambiguity. |
#define BENCHMARK(...) \ | ||
BENCHMARK_PRIVATE_DECLARE(_benchmark_) = \ | ||
(::benchmark::internal::RegisterBenchmarkInternal( \ | ||
std::make_unique<::benchmark::internal::FunctionBenchmark>( \ | ||
#__VA_ARGS__, __VA_ARGS__))) | ||
benchmark::internal::make_unique< \ | ||
::benchmark::internal::FunctionBenchmark>(#__VA_ARGS__, \ | ||
__VA_ARGS__))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a bug here: the macros should call ::benchmark::internal::make_unique
not benchmark::internal::make_unique
.
We're now getting compilation failures because of this, example:
/var/lib/buildkite-agent/builds/amd64-c6a-4xlarge-linux-i-0a326a82268fb1cf0-1/apache-arrow/arrow-bci-benchmark-on-amd64-c6a-4xlarge-linux/arrow/cpp/src/parquet/page_index_benchmark.cc:60:1: error: 'parquet::benchmark::internal' has not been declared
60 | BENCHMARK(BM_ReadOffsetIndex)->Apply(PageIndexSetArgs);
| ^~~~~~~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed #1959 for this
Oh, and we're getting yet another build regression on macOS with this kind of benchmark declaration: template <typename InListType = ListType>
static void ListSliceInt64List(benchmark::State& state) {
ListSliceOptions opts;
opts.start = kSliceStart;
BenchmarkListSlice(state, opts, std::make_shared<InListType>(int64()));
}
BENCHMARK(ListSliceInt64List)->Apply(RegressionSetArgs); Error message:
|
### Rationale for this change Benchmarks fail compiling with Google Benchmark 1.9.2. The errors seem triggered by this change upstream: google/benchmark#1948 ### What changes are included in this PR? * Move some benchmark functions to a dedicated namespace so that there is no ambiguity with other functions * Reduce reliance on templating in benchmark functions to avoid resolution ambiguities * Other required fixes Note that we don't rename the benchmark functions, to avoid breaking continuous benchmarking history. ### Are these changes tested? By continuous benchmarking. ### Are there any user-facing changes? No. * GitHub Issue: #45939 Authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
…45942) ### Rationale for this change Benchmarks fail compiling with Google Benchmark 1.9.2. The errors seem triggered by this change upstream: google/benchmark#1948 ### What changes are included in this PR? * Move some benchmark functions to a dedicated namespace so that there is no ambiguity with other functions * Reduce reliance on templating in benchmark functions to avoid resolution ambiguities * Other required fixes Note that we don't rename the benchmark functions, to avoid breaking continuous benchmarking history. ### Are these changes tested? By continuous benchmarking. ### Are there any user-facing changes? No. * GitHub Issue: apache#45939 Authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
…45942) ### Rationale for this change Benchmarks fail compiling with Google Benchmark 1.9.2. The errors seem triggered by this change upstream: google/benchmark#1948 ### What changes are included in this PR? * Move some benchmark functions to a dedicated namespace so that there is no ambiguity with other functions * Reduce reliance on templating in benchmark functions to avoid resolution ambiguities * Other required fixes Note that we don't rename the benchmark functions, to avoid breaking continuous benchmarking history. ### Are these changes tested? By continuous benchmarking. ### Are there any user-facing changes? No. * GitHub Issue: apache#45939 Authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
Fixes #1947.