Chromium Code Reviews| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 #endif // !defined(LIKELY) | 223 #endif // !defined(LIKELY) |
| 224 | 224 |
| 225 // Compiler feature-detection. | 225 // Compiler feature-detection. |
| 226 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension | 226 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension |
| 227 #if defined(__has_feature) | 227 #if defined(__has_feature) |
| 228 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) | 228 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) |
| 229 #else | 229 #else |
| 230 #define HAS_FEATURE(FEATURE) 0 | 230 #define HAS_FEATURE(FEATURE) 0 |
| 231 #endif | 231 #endif |
| 232 | 232 |
| 233 #if defined(COMPILER_GCC) | |
|
gab
2016/12/05 18:51:48
The last comment below makes this not compiler spe
| |
| 234 #define PRETTY_FUNCTION __PRETTY_FUNCTION__ | |
| 235 #elif defined(COMPILER_MSVC) | |
| 236 #define PRETTY_FUNCTION __FUNCSIG__ | |
| 237 #else | |
| 238 #define PRETTY_FUNCTION __func__ | |
| 239 #endif | |
| 240 | |
| 241 // Returns a string that contains the type name of |T| as a substring. | |
| 242 template <typename T> | |
| 243 inline const char* GetStringWithTypeName() { | |
|
gab
2016/12/05 18:51:48
Given this is only used in base/allocator it shoul
palmer
2016/12/06 00:58:25
Turns out I can leave it in WTF (since I moved wtf
| |
| 244 return PRETTY_FUNCTION; | |
|
gab
2016/12/05 18:51:48
I think typeid(T).name() would be cleaner here?
h
palmer
2016/12/06 00:58:25
It would be, but the compiler says: "error: cannot
gab
2016/12/06 15:43:21
Interesting, I couldn't find where this flag is se
| |
| 245 } | |
| 246 | |
| 233 #endif // BASE_COMPILER_SPECIFIC_H_ | 247 #endif // BASE_COMPILER_SPECIFIC_H_ |
| OLD | NEW |