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 SANDBOX_LINUX_SERVICES_BUILD_CONFIG_FUNCTIONS_H_ | |
10 #define SANDBOX_LINUX_SERVICES_BUILD_CONFIG_FUNCTIONS_H_ | |
11 | |
12 #include "build/build_config.h" | |
13 | |
14 namespace sandbox { | |
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 IsArchitectureX86_64() { | |
51 #if defined(ARCH_CPU_X86_64) | |
52 return true; | |
53 #else | |
54 return false; | |
55 #endif | |
56 } | |
57 | |
58 inline bool IsArchitectureI386() { | |
59 #if defined(ARCH_CPU_X86) | |
60 return true; | |
61 #else | |
62 return false; | |
63 #endif | |
64 } | |
65 | |
66 inline bool IsArchitectureARM() { | |
67 #if defined(ARCH_CPU_ARM_FAMILY) | |
68 return true; | |
69 #else | |
70 return false; | |
71 #endif | |
72 } | |
73 | |
74 inline bool IsUsingToolKitGtk() { | |
75 #if defined(TOOLKIT_GTK) | |
76 return true; | |
77 #else | |
78 return false; | |
79 #endif | |
80 } | |
81 | |
82 } // namespace. | |
83 | |
84 } // namespace sandbox. | |
85 | |
86 #endif // SANDBOX_LINUX_SERVICES_BUILD_CONFIG_FUNCTIONS_H_ | |
OLD | NEW |