Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // These helpers allow to avoid the use of an #ifdef when the code can | |
| 6 // compile without them. Thanks to compiler optimizations, the final generated | |
| 7 // binary should look the same when using these. | |
| 8 | |
| 9 #ifndef BUILD_BUILD_CONFIG_FUNCTIONS_H_ | |
| 10 #define BUILD_BUILD_CONFIG_FUNCTIONS_H_ | |
| 11 | |
| 12 #include "build/build_config.h" | |
| 13 | |
| 14 namespace build { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 inline bool IsASANBuild() { | |
| 19 #if defined(ADDRESS_SANITIZER) | |
| 20 return true; | |
| 21 #else | |
| 22 return false; | |
| 23 #endif | |
| 24 } | |
| 25 | |
| 26 inline bool IsLinux() { | |
| 27 #if defined(OS_LINUX) | |
| 28 return true; | |
| 29 #else | |
| 30 return false; | |
| 31 #endif | |
| 32 } | |
| 33 | |
| 34 inline bool IsChromeOS() { | |
| 35 #if defined(OS_CHROMEOS) | |
| 36 return true; | |
| 37 #else | |
| 38 return false; | |
| 39 #endif | |
| 40 } | |
| 41 | |
| 42 inline bool IsAndroid() { | |
| 43 #if defined(OS_ANDROID) | |
| 44 return true; | |
| 45 #else | |
| 46 return false; | |
| 47 #endif | |
| 48 } | |
| 49 | |
| 50 inline bool IsPOSIX() { | |
| 51 #if defined(OS_POSIX) | |
| 52 return true; | |
| 53 #else | |
| 54 return false; | |
| 55 #endif | |
| 56 } | |
| 57 | |
| 58 inline bool IsWindows() { | |
| 59 #if defined(OS_WIN) | |
| 60 return true; | |
| 61 #else | |
| 62 return false; | |
| 63 #endif | |
| 64 } | |
| 65 | |
| 66 inline bool IsMac() { | |
| 67 #if defined(OS_MACOSX) | |
| 68 return true; | |
| 69 #else | |
| 70 return false; | |
| 71 #endif | |
| 72 } | |
| 73 | |
| 74 inline bool IsArchitectureX86_64() { | |
| 75 #if defined(__x86_64__) | |
| 76 return true; | |
| 77 #else | |
| 78 return false; | |
| 79 #endif | |
| 80 } | |
| 81 | |
| 82 inline bool IsArchitectureI386() { | |
| 83 #if defined(__i386__) | |
| 84 return true; | |
| 85 #else | |
| 86 return false; | |
| 87 #endif | |
| 88 } | |
| 89 | |
| 90 inline bool IsArchitectureArm() { | |
|
Robert Sesek
2013/12/05 14:51:46
Arm -> ARM
jln (very slow on Chromium)
2013/12/05 23:37:25
Done.
| |
| 91 #if defined(__arm__) | |
| 92 return true; | |
| 93 #else | |
| 94 return false; | |
| 95 #endif | |
| 96 } | |
| 97 | |
| 98 inline bool IsUsingToolKitGtk() { | |
| 99 #if defined(TOOLKIT_GTK) | |
| 100 return true; | |
| 101 #else | |
| 102 return false; | |
| 103 #endif | |
| 104 } | |
| 105 | |
| 106 } // namespace. | |
| 107 | |
| 108 } // namespace build. | |
| 109 | |
| 110 #endif // BUILD_BUILD_CONFIG_FUNCTIONS_H_ | |
| OLD | NEW |