[PATCH] D115434: [benchmark] Reapply fix for -Wcovered-switch-default warning

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 01:19:25 PST 2021


mstorsjo created this revision.
mstorsjo added reviewers: mtrofin, lebedev.ri.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

This reapplies a fix from 948ce4e6edec6ad3cdf1911fc3e8e9569140d4ff
(which never was submitted upstream). I have now submitted
this fix upstream in https://github.com/google/benchmark/pull/1302.

When benchmarks were unified in
5dda2efde574d3a200d04c371f561a77ee9f4aff <https://reviews.llvm.org/rG5dda2efde574d3a200d04c371f561a77ee9f4aff>, it lost this change,
but it also lost another local modification, where benchmark's
CMakeLists.txt was modified to comment out adding -Werror.
(This change was part of the original import in
0addd170ab0880941fa4089c2717f3f3a0e4e25a.)

As the benchmark library is built automatically by default, when
building all of LLVM (contrary to the copy in libcxx, which wasn't
built by default), building it with -Werror by default is very brittle.

This fixes building LLVM with MinGW. (It wasn't broken in MSVC
mode, as the benchmark library doesn't add -Werror or anything
equivalent in MSVC mode, and it's unclear if this warning is
enabled in that mode at all.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115434

Files:
  third-party/benchmark/src/sysinfo.cc


Index: third-party/benchmark/src/sysinfo.cc
===================================================================
--- third-party/benchmark/src/sysinfo.cc
+++ third-party/benchmark/src/sysinfo.cc
@@ -344,6 +344,7 @@
     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";
@@ -357,9 +358,6 @@
       case CacheTrace:
         C.type = "Trace";
         break;
-      default:
-        C.type = "Unknown";
-        break;
     }
     res.push_back(C);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115434.393066.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211209/d4e96f96/attachment.bin>


More information about the llvm-commits mailing list