[PATCH] D51342: [benchmark] Silence warning by applying upstream patch

Kirill Bobyrev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 28 03:30:20 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL340811: [benchmark] Silence warning by applying upstream patch (authored by omtcyfz, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51342?vs=162815&id=162818#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51342

Files:
  llvm/trunk/utils/benchmark/README.LLVM
  llvm/trunk/utils/benchmark/include/benchmark/benchmark.h
  llvm/trunk/utils/benchmark/src/internal_macros.h


Index: llvm/trunk/utils/benchmark/include/benchmark/benchmark.h
===================================================================
--- llvm/trunk/utils/benchmark/include/benchmark/benchmark.h
+++ llvm/trunk/utils/benchmark/include/benchmark/benchmark.h
@@ -240,6 +240,18 @@
 #define BENCHMARK_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
 #endif
 
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#endif
+
+#if defined(__GNUC__) || __has_builtin(__builtin_unreachable)
+  #define BENCHMARK_UNREACHABLE() __builtin_unreachable()
+#elif defined(_MSC_VER)
+  #define BENCHMARK_UNREACHABLE() __assume(false)
+#else
+  #define BENCHMARK_UNREACHABLE() ((void)0)
+#endif
+
 namespace benchmark {
 class BenchmarkReporter;
 
@@ -1434,9 +1446,9 @@
     case kMicrosecond:
       return "us";
     case kNanosecond:
-    default:
       return "ns";
   }
+  BENCHMARK_UNREACHABLE();
 }
 
 inline double GetTimeUnitMultiplier(TimeUnit unit) {
@@ -1446,9 +1458,9 @@
     case kMicrosecond:
       return 1e6;
     case kNanosecond:
-    default:
       return 1e9;
   }
+  BENCHMARK_UNREACHABLE();
 }
 
 } // namespace benchmark
Index: llvm/trunk/utils/benchmark/README.LLVM
===================================================================
--- llvm/trunk/utils/benchmark/README.LLVM
+++ llvm/trunk/utils/benchmark/README.LLVM
@@ -1,9 +1,13 @@
 LLVM notes
 ----------
 
-This directory contains the Google Benchmark source code. This directory is
-under a different license than LLVM.
+This directory contains the Google Benchmark source code. Currently, the checked
+Benchmark library version is v1.4.1.
+
+This directory is under a different license than LLVM.
 
 Changes:
 
 * Bazel BUILD files are removed from the library
+* https://github.com/google/benchmark/commit/f85304e4e3a0e4e1bf15b91720df4a19e90b589f
+  is applied on top of the v1.4.1 to silence compiler warnings
Index: llvm/trunk/utils/benchmark/src/internal_macros.h
===================================================================
--- llvm/trunk/utils/benchmark/src/internal_macros.h
+++ llvm/trunk/utils/benchmark/src/internal_macros.h
@@ -6,9 +6,6 @@
 #ifndef __has_feature
 #define __has_feature(x) 0
 #endif
-#ifndef __has_builtin
-#define __has_builtin(x) 0
-#endif
 
 #if defined(__clang__)
   #if !defined(COMPILER_CLANG)
@@ -78,12 +75,4 @@
   #define BENCHMARK_MAYBE_UNUSED
 #endif
 
-#if defined(COMPILER_GCC) || __has_builtin(__builtin_unreachable)
-  #define BENCHMARK_UNREACHABLE() __builtin_unreachable()
-#elif defined(COMPILER_MSVC)
-  #define BENCHMARK_UNREACHABLE() __assume(false)
-#else
-  #define BENCHMARK_UNREACHABLE() ((void)0)
-#endif
-
 #endif  // BENCHMARK_INTERNAL_MACROS_H_


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51342.162818.patch
Type: text/x-patch
Size: 2668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180828/40d35c57/attachment-0001.bin>


More information about the llvm-commits mailing list