| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef BASE_COMPILER_SPECIFIC_H_ |
| 6 #define BASE_COMPILER_SPECIFIC_H_ | 6 #define BASE_COMPILER_SPECIFIC_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(COMPILER_MSVC) | 10 #if defined(COMPILER_MSVC) |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // If any bits are uninitialized, crash with an MSan report. | 162 // If any bits are uninitialized, crash with an MSan report. |
| 163 // Use this to sanitize data which MSan won't be able to track, e.g. before | 163 // Use this to sanitize data which MSan won't be able to track, e.g. before |
| 164 // passing data to another process via shared memory. | 164 // passing data to another process via shared memory. |
| 165 #define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) \ | 165 #define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) \ |
| 166 __msan_check_mem_is_initialized(p, size) | 166 __msan_check_mem_is_initialized(p, size) |
| 167 #else // MEMORY_SANITIZER | 167 #else // MEMORY_SANITIZER |
| 168 #define MSAN_UNPOISON(p, size) | 168 #define MSAN_UNPOISON(p, size) |
| 169 #define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) | 169 #define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) |
| 170 #endif // MEMORY_SANITIZER | 170 #endif // MEMORY_SANITIZER |
| 171 | 171 |
| 172 // DISABLE_CFI_PERF -- Disable Control Flow Integrity for perf reasons. |
| 173 #if !defined(DISABLE_CFI_PERF) |
| 174 #if defined(__clang__) |
| 175 #define DISABLE_CFI_PERF __attribute__((no_sanitize("cfi"))) |
| 176 #else |
| 177 #define DISABLE_CFI_PERF |
| 178 #endif |
| 179 #endif |
| 180 |
| 172 // Macro useful for writing cross-platform function pointers. | 181 // Macro useful for writing cross-platform function pointers. |
| 173 #if !defined(CDECL) | 182 #if !defined(CDECL) |
| 174 #if defined(OS_WIN) | 183 #if defined(OS_WIN) |
| 175 #define CDECL __cdecl | 184 #define CDECL __cdecl |
| 176 #else // defined(OS_WIN) | 185 #else // defined(OS_WIN) |
| 177 #define CDECL | 186 #define CDECL |
| 178 #endif // defined(OS_WIN) | 187 #endif // defined(OS_WIN) |
| 179 #endif // !defined(CDECL) | 188 #endif // !defined(CDECL) |
| 180 | 189 |
| 181 // Macro for hinting that an expression is likely to be false. | 190 // Macro for hinting that an expression is likely to be false. |
| 182 #if !defined(UNLIKELY) | 191 #if !defined(UNLIKELY) |
| 183 #if defined(COMPILER_GCC) | 192 #if defined(COMPILER_GCC) |
| 184 #define UNLIKELY(x) __builtin_expect(!!(x), 0) | 193 #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
| 185 #else | 194 #else |
| 186 #define UNLIKELY(x) (x) | 195 #define UNLIKELY(x) (x) |
| 187 #endif // defined(COMPILER_GCC) | 196 #endif // defined(COMPILER_GCC) |
| 188 #endif // !defined(UNLIKELY) | 197 #endif // !defined(UNLIKELY) |
| 189 | 198 |
| 190 // Compiler feature-detection. | 199 // Compiler feature-detection. |
| 191 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension | 200 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension |
| 192 #if defined(__has_feature) | 201 #if defined(__has_feature) |
| 193 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) | 202 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) |
| 194 #else | 203 #else |
| 195 #define HAS_FEATURE(FEATURE) 0 | 204 #define HAS_FEATURE(FEATURE) 0 |
| 196 #endif | 205 #endif |
| 197 | 206 |
| 198 #endif // BASE_COMPILER_SPECIFIC_H_ | 207 #endif // BASE_COMPILER_SPECIFIC_H_ |
| OLD | NEW |