llvm.org GIT mirror llvm / b2b31f2
[benchmark] Silence warning by applying upstream patch ompiling benchmark library (introduced in D50894) with the latest bootstrapped Clang produces a lot of warnings, this issue was addressed in the upstream patch I pushed earlier. Upstream patch: https://github.com/google/benchmark/commit/f85304e4e3a0e4e1bf15b91720df4a19e90b589f `README.LLVM` notes were updated to reflect the latest changes. Reviewed by: lebedev.ri Differential Revision: https://reviews.llvm.org/D51342 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340811 91177308-0d34-0410-b5e6-96231b3b80d8 Kirill Bobyrev 11 months ago
3 changed file(s) with 20 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
0 LLVM notes
11 ----------
22
3 This directory contains the Google Benchmark source code. This directory is
4 under a different license than LLVM.
3 This directory contains the Google Benchmark source code. Currently, the checked
4 Benchmark library version is v1.4.1.
5
6 This directory is under a different license than LLVM.
57
68 Changes:
79
810 * Bazel BUILD files are removed from the library
11 * https://github.com/google/benchmark/commit/f85304e4e3a0e4e1bf15b91720df4a19e90b589f
12 is applied on top of the v1.4.1 to silence compiler warnings
237237
238238 #if defined(__GNUC__) && !defined(__clang__)
239239 #define BENCHMARK_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
240 #endif
241
242 #ifndef __has_builtin
243 #define __has_builtin(x) 0
244 #endif
245
246 #if defined(__GNUC__) || __has_builtin(__builtin_unreachable)
247 #define BENCHMARK_UNREACHABLE() __builtin_unreachable()
248 #elif defined(_MSC_VER)
249 #define BENCHMARK_UNREACHABLE() __assume(false)
250 #else
251 #define BENCHMARK_UNREACHABLE() ((void)0)
240252 #endif
241253
242254 namespace benchmark {
14331445 case kMicrosecond:
14341446 return "us";
14351447 case kNanosecond:
1436 default:
14371448 return "ns";
14381449 }
1450 BENCHMARK_UNREACHABLE();
14391451 }
14401452
14411453 inline double GetTimeUnitMultiplier(TimeUnit unit) {
14451457 case kMicrosecond:
14461458 return 1e6;
14471459 case kNanosecond:
1448 default:
14491460 return 1e9;
14501461 }
1462 BENCHMARK_UNREACHABLE();
14511463 }
14521464
14531465 } // namespace benchmark
44
55 #ifndef __has_feature
66 #define __has_feature(x) 0
7 #endif
8 #ifndef __has_builtin
9 #define __has_builtin(x) 0
107 #endif
118
129 #if defined(__clang__)
7774 #define BENCHMARK_MAYBE_UNUSED
7875 #endif
7976
80 #if defined(COMPILER_GCC) || __has_builtin(__builtin_unreachable)
81 #define BENCHMARK_UNREACHABLE() __builtin_unreachable()
82 #elif defined(COMPILER_MSVC)
83 #define BENCHMARK_UNREACHABLE() __assume(false)
84 #else
85 #define BENCHMARK_UNREACHABLE() ((void)0)
86 #endif
87
8877 #endif // BENCHMARK_INTERNAL_MACROS_H_