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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-third-party-benchmark

Author: Brad Smith (brad0)

<details>
<summary>Changes</summary>

(cherry picked from commit f3ec7b8820ca8136c4e1dad4552608b51b47831a)

---
Full diff: https://github.com/llvm/llvm-project/pull/97269.diff


1 Files Affected:

- (modified) third-party/benchmark/src/sysinfo.cc (+2-2) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list