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__ * 100) >= \
47 ((major) * 10000 + (minor) * 100 + (patchlevel)))
49 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
73 #if defined(__ANDROID__)
74 # define V8_OS_ANDROID 1
75 # define V8_OS_LINUX 1
76 # define V8_OS_POSIX 1
77 #elif defined(__APPLE__)
79 # define V8_OS_MACOSX 1
80 # define V8_OS_POSIX 1
81 #elif defined(__native_client__)
83 # define V8_OS_POSIX 1
84 #elif defined(__CYGWIN__)
85 # define V8_OS_CYGWIN 1
86 # define V8_OS_POSIX 1
87 #elif defined(__linux__)
88 # define V8_OS_LINUX 1
89 # define V8_OS_POSIX 1
91 # define V8_OS_POSIX 1
92 # define V8_OS_SOLARIS 1
96 #elif defined(__FreeBSD__)
98 # define V8_OS_FREEBSD 1
99 # define V8_OS_POSIX 1
100 #elif defined(__DragonFly__)
102 # define V8_OS_DRAGONFLYBSD 1
103 # define V8_OS_POSIX 1
104 #elif defined(__NetBSD__)
106 # define V8_OS_NETBSD 1
107 # define V8_OS_POSIX 1
108 #elif defined(__OpenBSD__)
110 # define V8_OS_OPENBSD 1
111 # define V8_OS_POSIX 1
112 #elif defined(__QNXNTO__)
113 # define V8_OS_POSIX 1
115 #elif defined(_WIN32)
135 #if defined (_MSC_VER)
136 # define V8_LIBC_MSVCRT 1
137 #elif defined(__BIONIC__)
138 # define V8_LIBC_BIONIC 1
139 # define V8_LIBC_BSD 1
140 #elif defined(__UCLIBC__)
142 # define V8_LIBC_UCLIBC 1
143 #elif defined(__GLIBC__) || defined(__GNU_LIBRARY__)
144 # define V8_LIBC_GLIBC 1
146 # define V8_LIBC_BSD V8_OS_BSD
198 #if defined(__clang__)
200 #if defined(__GNUC__) // Clang in gcc mode.
202 #elif defined(_MSC_VER) // Clang in cl mode.
203 # define V8_CC_MSVC 1
207 # define V8_HAS___ALIGNOF 1
208 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF
210 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
211 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
212 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
213 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
214 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
215 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
216 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
217 (__has_attribute(warn_unused_result))
219 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
220 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
221 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
222 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
223 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
224 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
225 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
227 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas))
228 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert))
230 #elif defined(__GNUC__)
234 # define V8_CC_INTEL (defined(__INTEL_COMPILER))
235 # define V8_CC_MINGW32 (defined(__MINGW32__))
236 # define V8_CC_MINGW64 (defined(__MINGW64__))
237 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
239 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
241 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
245 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
246 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
247 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
248 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
249 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
250 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
251 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
252 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
254 # define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
255 # define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
256 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
257 # define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
258 # define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
266 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
267 # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0))
268 # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0))
269 # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0))
272 #elif defined(_MSC_VER)
274 # define V8_CC_MSVC 1
276 # define V8_HAS___ALIGNOF 1
278 # define V8_HAS_DECLSPEC_ALIGN 1
279 # define V8_HAS_DECLSPEC_DEPRECATED 1
280 # define V8_HAS_DECLSPEC_NOINLINE 1
281 # define V8_HAS_DECLSPEC_SELECTANY 1
283 # define V8_HAS___FORCEINLINE 1
294 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
295 # define V8_INLINE inline __attribute__((always_inline))
296 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
297 # define V8_INLINE __forceinline
299 # define V8_INLINE inline
307 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE
308 # define V8_NOINLINE __attribute__((noinline))
309 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE
310 # define V8_NOINLINE __declspec(noinline)
317 #if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
318 # define V8_DEPRECATED(message, declarator) \
319 declarator __attribute__((deprecated(message)))
320 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
321 # define V8_DEPRECATED(message, declarator) \
322 declarator __attribute__((deprecated))
323 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
324 # define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
326 # define V8_DEPRECATED(message, declarator) declarator
331 #define V8_DEPRECATE_SOON(message, declarator) declarator
335 #if V8_HAS_BUILTIN_EXPECT
336 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
337 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
339 # define V8_UNLIKELY(condition) (condition)
340 # define V8_LIKELY(condition) (condition)
348 #if V8_HAS_CXX11_ALIGNAS
349 # define V8_ALIGNED(n) alignas(n)
350 #elif V8_HAS_ATTRIBUTE_ALIGNED
351 # define V8_ALIGNED(n) __attribute__((aligned(n)))
352 #elif V8_HAS_DECLSPEC_ALIGN
353 # define V8_ALIGNED(n) __declspec(align(n))
355 # define V8_ALIGNED(n)
368 #if V8_HAS_CXX11_ALIGNAS
369 # define V8_ALIGNAS(type, alignment) alignas(type)
370 #elif V8_HAS___ALIGNOF__ && V8_HAS_ATTRIBUTE_ALIGNED
371 # define V8_ALIGNAS(type, alignment) __attribute__((aligned(__alignof__(type))))
373 # define V8_ALIGNAS(type, alignment) V8_ALIGNED(alignment)
382 #if V8_HAS_CXX11_ALIGNOF
383 # define V8_ALIGNOF(type) alignof(type)
384 #elif V8_HAS___ALIGNOF
385 # define V8_ALIGNOF(type) __alignof(type)
386 #elif V8_HAS___ALIGNOF__
387 # define V8_ALIGNOF(type) __alignof__(type)
393 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type))
399 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
400 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
402 #define V8_WARN_UNUSED_RESULT
405 #endif // V8CONFIG_H_
Definition: v8config.h:392
Definition: libplatform.h:10