[llvm] Fix MSVC warning in benchmark (PR #147357)

Daniel Paoliello via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 10:46:05 PDT 2025


https://github.com/dpaoliello created https://github.com/llvm/llvm-project/pull/147357

Building LLVM with MSVC is raising the following warning:

```
llvm\third-party\benchmark\src\sysinfo.cc(375): warning C4062: enumerator 'CacheUnknown' in switch of enum '_PROCESSOR_CACHE_TYPE' is not handled
```

This change resolves the warning by moving the `Unknown` type into a case block for `CacheUnknown`.

Not sure how this code flows back into the original source.

>From f2c4cd82c445e9619c2a2af6145cdff11b7852fc Mon Sep 17 00:00:00 2001
From: Daniel Paoliello <danpao at microsoft.com>
Date: Mon, 7 Jul 2025 10:43:43 -0700
Subject: [PATCH] Fix MSVC warning in benchmark

---
 third-party/benchmark/src/sysinfo.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/third-party/benchmark/src/sysinfo.cc b/third-party/benchmark/src/sysinfo.cc
index 3993ae17f7fc4..837be8f9cf891 100644
--- a/third-party/benchmark/src/sysinfo.cc
+++ b/third-party/benchmark/src/sysinfo.cc
@@ -358,7 +358,6 @@ std::vector<CPUInfo::CacheInfo> GetCacheSizesWindows() {
     C.num_sharing = static_cast<int>(b.count());
     C.level = cache.Level;
     C.size = cache.Size;
-    C.type = "Unknown";
     switch (cache.Type) {
       case CacheUnified:
         C.type = "Unified";
@@ -372,6 +371,9 @@ std::vector<CPUInfo::CacheInfo> GetCacheSizesWindows() {
       case CacheTrace:
         C.type = "Trace";
         break;
+      case CacheUnknown:
+        C.type = "Unknown";
+        break;
     }
     res.push_back(C);
   }



More information about the llvm-commits mailing list