[llvm] [benchmark] Fix OpenBSD build (PR #97269)

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 02:34:33 PDT 2024


https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/97269

(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)

>From 2e99d81884fb955cfbff19b13bfc2acdbbd1170c Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Mon, 1 Jul 2024 05:32:20 -0400
Subject: [PATCH] [benchmark] Fix OpenBSD build

(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)
---
 third-party/benchmark/src/sysinfo.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/third-party/benchmark/src/sysinfo.cc b/third-party/benchmark/src/sysinfo.cc
index 46df973b069a7..2bed1663af2e9 100644
--- a/third-party/benchmark/src/sysinfo.cc
+++ b/third-party/benchmark/src/sysinfo.cc
@@ -169,7 +169,7 @@ ValueUnion GetSysctlImp(std::string const& name) {
       mib[1] = HW_CPUSPEED;
     }
 
-    if (sysctl(mib, 2, buff.data(), &buff.Size, nullptr, 0) == -1) {
+    if (sysctl(mib, 2, buff.data(), &buff.size, nullptr, 0) == -1) {
       return ValueUnion();
     }
     return buff;
@@ -742,7 +742,7 @@ double GetCPUCyclesPerSecond(CPUInfo::Scaling scaling) {
 #endif
   unsigned long long hz = 0;
 #if defined BENCHMARK_OS_OPENBSD
-  if (GetSysctl(freqStr, &hz)) return hz * 1000000;
+  if (GetSysctl(freqStr, &hz)) return static_cast<double>(hz * 1000000);
 #else
   if (GetSysctl(freqStr, &hz)) return hz;
 #endif



More information about the llvm-commits mailing list