OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 V8CONFIG_H_ | 5 #ifndef V8CONFIG_H_ |
6 #define V8CONFIG_H_ | 6 #define V8CONFIG_H_ |
7 | 7 |
8 // Platform headers for feature detection below. | 8 // Platform headers for feature detection below. |
9 #if defined(__ANDROID__) | 9 #if defined(__ANDROID__) |
10 # include <sys/cdefs.h> | 10 # include <sys/cdefs.h> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported | 168 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported |
169 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported | 169 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported |
170 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) | 170 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) |
171 // supported | 171 // supported |
172 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported | 172 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported |
173 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported | 173 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported |
174 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported | 174 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported |
175 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported | 175 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported |
176 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result)) | 176 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result)) |
177 // supported | 177 // supported |
| 178 // V8_HAS_BUILTIN_CLZ - __builtin_clz() supported |
| 179 // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported |
178 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported | 180 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported |
| 181 // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported |
179 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported | 182 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported |
180 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported | 183 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported |
181 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported | 184 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported |
182 // V8_HAS___FINAL - __final supported in non-C++11 mode | 185 // V8_HAS___FINAL - __final supported in non-C++11 mode |
183 // V8_HAS___FORCEINLINE - __forceinline supported | 186 // V8_HAS___FORCEINLINE - __forceinline supported |
184 // V8_HAS_SEALED - MSVC style sealed marker supported | 187 // V8_HAS_SEALED - MSVC style sealed marker supported |
185 // | 188 // |
186 // Note that testing for compilers and/or features must be done using #if | 189 // Note that testing for compilers and/or features must be done using #if |
187 // not #ifdef. For example, to test for Intel C++ Compiler, use: | 190 // not #ifdef. For example, to test for Intel C++ Compiler, use: |
188 // #if V8_CC_INTEL | 191 // #if V8_CC_INTEL |
(...skipping 10 matching lines...) Expand all Loading... |
199 | 202 |
200 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) | 203 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) |
201 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) | 204 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) |
202 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) | 205 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) |
203 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) | 206 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) |
204 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused)) | 207 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused)) |
205 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) | 208 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) |
206 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ | 209 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ |
207 (__has_attribute(warn_unused_result)) | 210 (__has_attribute(warn_unused_result)) |
208 | 211 |
| 212 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz)) |
| 213 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz)) |
209 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) | 214 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) |
| 215 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount)) |
210 | 216 |
211 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) | 217 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) |
212 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) | 218 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) |
213 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) | 219 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) |
214 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control)) | 220 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control)) |
215 # define V8_HAS_CXX11_OVERRIDE (__has_feature(cxx_override_control)) | 221 # define V8_HAS_CXX11_OVERRIDE (__has_feature(cxx_override_control)) |
216 | 222 |
217 #elif defined(__GNUC__) | 223 #elif defined(__GNUC__) |
218 | 224 |
219 # define V8_CC_GNU 1 | 225 # define V8_CC_GNU 1 |
(...skipping 11 matching lines...) Expand all Loading... |
231 // older compilers. | 237 // older compilers. |
232 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) | 238 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) |
233 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) | 239 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) |
234 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0)) | 240 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0)) |
235 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0)) | 241 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0)) |
236 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0)) | 242 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0)) |
237 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) | 243 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) |
238 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ | 244 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ |
239 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0)) | 245 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0)) |
240 | 246 |
| 247 # define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0)) |
| 248 # define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0)) |
241 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) | 249 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) |
| 250 # define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0)) |
242 | 251 |
243 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality | 252 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality |
244 // without warnings (functionality used by the macros below). These modes | 253 // without warnings (functionality used by the macros below). These modes |
245 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, | 254 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, |
246 // more standardly, by checking whether __cplusplus has a C++11 or greater | 255 // more standardly, by checking whether __cplusplus has a C++11 or greater |
247 // value. Current versions of g++ do not correctly set __cplusplus, so we check | 256 // value. Current versions of g++ do not correctly set __cplusplus, so we check |
248 // both for forward compatibility. | 257 // both for forward compatibility. |
249 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | 258 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L |
250 # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) | 259 # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) |
251 # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0)) | 260 # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0)) |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 # define V8_ALIGNOF(type) __alignof__(type) | 451 # define V8_ALIGNOF(type) __alignof__(type) |
443 #else | 452 #else |
444 // Note that alignment of a type within a struct can be less than the | 453 // Note that alignment of a type within a struct can be less than the |
445 // alignment of the type stand-alone (because of ancient ABIs), so this | 454 // alignment of the type stand-alone (because of ancient ABIs), so this |
446 // should only be used as a last resort. | 455 // should only be used as a last resort. |
447 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } | 456 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } |
448 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) | 457 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) |
449 #endif | 458 #endif |
450 | 459 |
451 #endif // V8CONFIG_H_ | 460 #endif // V8CONFIG_H_ |
OLD | NEW |