[benchmark] Back port 2b0bff7 from upstream (#212278)

Fix compile error with clang -Werror -Wunused-template
(cherry picked from commit 2b0bff7444a8df460daab2e5af18bce45ca00657)
This commit is contained in:
aokblast 2026-07-29 21:37:13 +08:00 committed by GitHub
parent dc5f2aae75
commit 13a6fc28ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -143,7 +143,7 @@ struct ValueUnion {
}
template <class T, int N>
std::array<T, N> GetAsArray() {
BENCHMARK_MAYBE_UNUSED std::array<T, N> GetAsArray() {
const int arr_size = sizeof(T) * N;
BM_CHECK_LE(arr_size, size);
std::array<T, N> arr;
@ -204,7 +204,8 @@ bool GetSysctl(std::string const& name, Tp* out) {
}
template <class Tp, size_t N>
bool GetSysctl(std::string const& name, std::array<Tp, N>* out) {
BENCHMARK_MAYBE_UNUSED bool GetSysctl(std::string const& name,
std::array<Tp, N>* out) {
auto buff = GetSysctlImp(name);
if (!buff) return false;
*out = buff.GetAsArray<Tp, N>();