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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 #define PRINTF_FORMAT(format_param, dots_param) | 150 #define PRINTF_FORMAT(format_param, dots_param) |
151 #endif | 151 #endif |
152 | 152 |
153 // WPRINTF_FORMAT is the same, but for wide format strings. | 153 // WPRINTF_FORMAT is the same, but for wide format strings. |
154 // This doesn't appear to yet be implemented in any compiler. | 154 // This doesn't appear to yet be implemented in any compiler. |
155 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 . | 155 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 . |
156 #define WPRINTF_FORMAT(format_param, dots_param) | 156 #define WPRINTF_FORMAT(format_param, dots_param) |
157 // If available, it would look like: | 157 // If available, it would look like: |
158 // __attribute__((format(wprintf, format_param, dots_param))) | 158 // __attribute__((format(wprintf, format_param, dots_param))) |
159 | 159 |
| 160 // Sanitizers annotations. |
| 161 #if defined(__has_attribute) |
| 162 #if __has_attribute(no_sanitize) |
| 163 #define NO_SANITIZE(what) __attribute__((no_sanitize(what))) |
| 164 #endif |
| 165 #endif |
| 166 #if !defined(NO_SANITIZE) |
| 167 #define NO_SANITIZE(what) |
| 168 #endif |
| 169 |
160 // MemorySanitizer annotations. | 170 // MemorySanitizer annotations. |
161 #if defined(MEMORY_SANITIZER) && !defined(OS_NACL) | 171 #if defined(MEMORY_SANITIZER) && !defined(OS_NACL) |
162 #include <sanitizer/msan_interface.h> | 172 #include <sanitizer/msan_interface.h> |
163 | 173 |
164 // Mark a memory region fully initialized. | 174 // Mark a memory region fully initialized. |
165 // Use this to annotate code that deliberately reads uninitialized data, for | 175 // Use this to annotate code that deliberately reads uninitialized data, for |
166 // example a GC scavenging root set pointers from the stack. | 176 // example a GC scavenging root set pointers from the stack. |
167 #define MSAN_UNPOISON(p, size) __msan_unpoison(p, size) | 177 #define MSAN_UNPOISON(p, size) __msan_unpoison(p, size) |
168 | 178 |
169 // Check a memory region for initializedness, as if it was being used here. | 179 // Check a memory region for initializedness, as if it was being used here. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 224 |
215 // Compiler feature-detection. | 225 // Compiler feature-detection. |
216 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension | 226 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension |
217 #if defined(__has_feature) | 227 #if defined(__has_feature) |
218 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) | 228 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) |
219 #else | 229 #else |
220 #define HAS_FEATURE(FEATURE) 0 | 230 #define HAS_FEATURE(FEATURE) 0 |
221 #endif | 231 #endif |
222 | 232 |
223 #endif // BASE_COMPILER_SPECIFIC_H_ | 233 #endif // BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |