9 #if defined(__ANDROID__)
10 # include <sys/cdefs.h>
11 #elif defined(__APPLE__)
12 # include <TargetConditionals.h>
13 #elif defined(__linux__
)
14 # include <features.h>
25 #if defined(__GLIBC__
) && defined(__GLIBC_MINOR__
)
26 # define V8_GLIBC_PREREQ(major, minor)
27 ((__GLIBC__
* 100
+ __GLIBC_MINOR__
) >= ((major) * 100
+ (minor)))
29 # define V8_GLIBC_PREREQ(major, minor) 0
40 #if defined(__GNUC__
) && defined(__GNUC_MINOR__
) && defined(__GNUC_PATCHLEVEL__
)
41 # define V8_GNUC_PREREQ(major, minor, patchlevel)
42 ((__GNUC__
* 10000
+ __GNUC_MINOR__
* 100
+ __GNUC_PATCHLEVEL__
) >=
43 ((major) * 10000
+ (minor) * 100
+ (patchlevel)))
44 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
45 # define V8_GNUC_PREREQ(major, minor, patchlevel)
46 ((__GNUC__ * 10000
+ __GNUC_MINOR__) >=
47 ((major) * 10000
+ (minor) * 100
+ (patchlevel)))
49 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
72 #if defined(__ANDROID__)
73 # define V8_OS_ANDROID 1
74 # define V8_OS_LINUX 1
75 # define V8_OS_POSIX 1
76 #elif defined(__APPLE__)
78 # define V8_OS_MACOSX 1
79 # define V8_OS_POSIX 1
80 #elif defined(__native_client__)
82 # define V8_OS_POSIX 1
83 #elif defined(__CYGWIN__)
84 # define V8_OS_CYGWIN 1
85 # define V8_OS_POSIX 1
86 #elif defined(__linux__
)
87 # define V8_OS_LINUX 1
88 # define V8_OS_POSIX 1
90 # define V8_OS_POSIX 1
91 # define V8_OS_SOLARIS 1
92 #elif defined(__FreeBSD__)
94 # define V8_OS_FREEBSD 1
95 # define V8_OS_POSIX 1
96 #elif defined(__DragonFly__)
98 # define V8_OS_DRAGONFLYBSD 1
99 # define V8_OS_POSIX 1
100 #elif defined(__NetBSD__)
102 # define V8_OS_NETBSD 1
103 # define V8_OS_POSIX 1
104 #elif defined(__OpenBSD__)
106 # define V8_OS_OPENBSD 1
107 # define V8_OS_POSIX 1
108 #elif defined(__QNXNTO__)
109 # define V8_OS_POSIX 1
111 #elif defined(_WIN32)
131 #if defined (_MSC_VER)
132 # define V8_LIBC_MSVCRT 1
133 #elif defined(__BIONIC__)
134 # define V8_LIBC_BIONIC 1
135 # define V8_LIBC_BSD 1
136 #elif defined(__UCLIBC__)
137 # define V8_LIBC_UCLIBC 1
138 #elif defined(__GLIBC__
) || defined(__GNU_LIBRARY__
)
139 # define V8_LIBC_GLIBC 1
141 # define V8_LIBC_BSD V8_OS_BSD
192 #if defined(__clang__
)
194 # define V8_CC_CLANG 1
197 # define V8_HAS___ALIGNOF 1
198 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF
200 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
201 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
202 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
203 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
204 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
205 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
206 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
207 (__has_attribute(warn_unused_result))
209 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
211 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas))
212 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert))
213 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions))
214 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control))
215 # define V8_HAS_CXX11_OVERRIDE (__has_feature(cxx_override_control))
217 #elif defined(__GNUC__)
221 # define V8_CC_INTEL (defined(__INTEL_COMPILER))
222 # define V8_CC_MINGW32 (defined(__MINGW32__))
223 # define V8_CC_MINGW64 (defined(__MINGW64__))
224 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
226 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4
, 3
, 0
))
228 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2
, 95
, 0
))
232 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4
, 4
, 0
))
233 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3
, 4
, 0
))
234 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4
, 5
, 0
))
235 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3
, 4
, 0
))
236 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2
, 95
, 0
))
237 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4
, 3
, 0
))
238 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
239 (!V8_CC_INTEL && V8_GNUC_PREREQ(4
, 1
, 0
))
241 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2
, 96
, 0
))
249 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
250 # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4
, 8
, 0
))
251 # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4
, 8
, 0
))
252 # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4
, 3
, 0
))
253 # define V8_HAS_CXX11_DELETE (V8_GNUC_PREREQ(4
, 4
, 0
))
254 # define V8_HAS_CXX11_OVERRIDE (V8_GNUC_PREREQ(4
, 7
, 0
))
255 # define V8_HAS_CXX11_FINAL (V8_GNUC_PREREQ(4
, 7
, 0
))
258 # define V8_HAS___FINAL (V8_GNUC_PREREQ(4
, 7
, 0
))
261 #elif defined(_MSC_VER)
263 # define V8_CC_MSVC 1
265 # define V8_HAS___ALIGNOF 1
269 # define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700
)
270 # define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400
)
271 # define V8_HAS_SEALED (_MSC_VER >= 1400
)
273 # define V8_HAS_DECLSPEC_ALIGN 1
274 # define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300
)
275 # define V8_HAS_DECLSPEC_NOINLINE 1
277 # define V8_HAS___FORCEINLINE 1
288 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
289 # define V8_INLINE inline __attribute__((always_inline))
290 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
291 # define V8_INLINE __forceinline
293 # define V8_INLINE inline
301 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE
302 # define V8_NOINLINE __attribute__((noinline))
303 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE
304 # define V8_NOINLINE __declspec(noinline)
311 #if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
312 # define V8_DEPRECATED(message, declarator) declarator
313 __attribute__((deprecated(message)))
314 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
315 # define V8_DEPRECATED(message, declarator) declarator
316 __attribute__((deprecated))
317 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
318 # define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
320 # define V8_DEPRECATED(message, declarator) declarator
325 #if V8_HAS_ATTRIBUTE_UNUSED
326 # define V8_UNUSED __attribute__((unused))
335 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
336 # define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
338 # define V8_WARN_UNUSED_RESULT
343 #if V8_HAS_BUILTIN_EXPECT
344 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0
))
345 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1
))
347 # define V8_UNLIKELY(condition) (condition)
348 # define V8_LIKELY(condition) (condition)
365 #if V8_HAS_CXX11_DELETE
366 # define V8_DELETE = delete
376 #if V8_HAS_CXX11_OVERRIDE
377 # define V8_OVERRIDE override
388 #if V8_HAS_CXX11_FINAL
389 # define V8_FINAL final
391 # define V8_FINAL __final
393 # define V8_FINAL sealed
403 #if V8_HAS_CXX11_ALIGNAS
404 # define V8_ALIGNED(n) alignas(n)
405 #elif V8_HAS_ATTRIBUTE_ALIGNED
406 # define V8_ALIGNED(n) __attribute__((aligned(n)))
407 #elif V8_HAS_DECLSPEC_ALIGN
408 # define V8_ALIGNED(n) __declspec(align(n))
410 # define V8_ALIGNED(n)
423 #if V8_HAS_CXX11_ALIGNAS
424 # define V8_ALIGNAS(type, alignment) alignas(type)
425 #elif V8_HAS___ALIGNOF__ && V8_HAS_ATTRIBUTE_ALIGNED
426 # define V8_ALIGNAS(type, alignment) __attribute__((aligned(__alignof__(type))))
428 # define V8_ALIGNAS(type, alignment) V8_ALIGNED(alignment)
437 #if V8_HAS_CXX11_ALIGNOF
438 # define V8_ALIGNOF(type) alignof(type)
439 #elif V8_HAS___ALIGNOF
440 # define V8_ALIGNOF(type) __alignof(type)
441 #elif V8_HAS___ALIGNOF__
442 # define V8_ALIGNOF(type) __alignof__(type)
447 namespace v8 {
template <
typename T>
class AlignOfHelper {
char c; T t; }; }
448 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type))