commit | 6b77771127eb923f49159b6daec603548e5fa0b2 | [log] [tgz] |
---|---|---|
author | Vladimir Levin <[email protected]> | Sat Sep 09 00:12:05 2017 |
committer | Commit Bot <[email protected]> | Sat Sep 09 00:12:05 2017 |
tree | 4d93727b6839a901886cade709d3d3fe7b1c1ba6 | |
parent | 3f4935b98ff638e8f3332c70bf476d3e8d1b5102 [diff] [blame] |
base: Ensure that (UN)LIKELY macros use builtin on clang. Currently, the LIKELY macros are guarded by COMPILER_GCC, which works with clang except on windows. This patch ensures that all clang platforms hit this. [email protected], [email protected] Change-Id: I1850b0d91dd552b468c9c84a4c072571dd811cb2 Reviewed-on: https://chromium-review.googlesource.com/658328 Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Vladimir Levin <[email protected]> Cr-Commit-Position: refs/heads/master@{#500750}
diff --git a/base/compiler_specific.h b/base/compiler_specific.h index c817ca4..2b9cd02e 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h
@@ -198,7 +198,7 @@ // Macro for hinting that an expression is likely to be false. #if !defined(UNLIKELY) -#if defined(COMPILER_GCC) +#if defined(COMPILER_GCC) || defined(__clang__) #define UNLIKELY(x) __builtin_expect(!!(x), 0) #else #define UNLIKELY(x) (x) @@ -206,7 +206,7 @@ #endif // !defined(UNLIKELY) #if !defined(LIKELY) -#if defined(COMPILER_GCC) +#if defined(COMPILER_GCC) || defined(__clang__) #define LIKELY(x) __builtin_expect(!!(x), 1) #else #define LIKELY(x) (x)