11 #if defined(__ANDROID__)
12 # include <sys/cdefs.h>
13 #elif defined(__APPLE__)
14 # include <TargetConditionals.h>
15 #elif defined(__linux__
)
16 # include <features.h>
27 #if defined(__GLIBC__
) && defined(__GLIBC_MINOR__
)
28 # define V8_GLIBC_PREREQ(major, minor)
29 ((__GLIBC__
* 100
+ __GLIBC_MINOR__
) >= ((major) * 100
+ (minor)))
31 # define V8_GLIBC_PREREQ(major, minor) 0
42 #if defined(__GNUC__
) && defined(__GNUC_MINOR__
) && defined(__GNUC_PATCHLEVEL__
)
43 # define V8_GNUC_PREREQ(major, minor, patchlevel)
44 ((__GNUC__
* 10000
+ __GNUC_MINOR__
* 100
+ __GNUC_PATCHLEVEL__
) >=
45 ((major) * 10000
+ (minor) * 100
+ (patchlevel)))
46 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
47 # define V8_GNUC_PREREQ(major, minor, patchlevel)
48 ((__GNUC__ * 10000
+ __GNUC_MINOR__ * 100
) >=
49 ((major) * 10000
+ (minor) * 100
+ (patchlevel)))
51 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
76 #if defined(__ANDROID__)
77 # define V8_OS_ANDROID 1
78 # define V8_OS_LINUX 1
79 # define V8_OS_POSIX 1
80 #elif defined(__APPLE__)
82 # define V8_OS_MACOSX 1
83 # define V8_OS_POSIX 1
84 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
87 #elif defined(__CYGWIN__)
88 # define V8_OS_CYGWIN 1
89 # define V8_OS_POSIX 1
90 #elif defined(__linux__
)
91 # define V8_OS_LINUX 1
92 # define V8_OS_POSIX 1
94 # define V8_OS_POSIX 1
95 # define V8_OS_SOLARIS 1
99 #elif defined(__FreeBSD__)
101 # define V8_OS_FREEBSD 1
102 # define V8_OS_POSIX 1
103 #elif defined(__Fuchsia__)
104 # define V8_OS_FUCHSIA 1
105 # define V8_OS_POSIX 1
106 #elif defined(__DragonFly__)
108 # define V8_OS_DRAGONFLYBSD 1
109 # define V8_OS_POSIX 1
110 #elif defined(__NetBSD__)
112 # define V8_OS_NETBSD 1
113 # define V8_OS_POSIX 1
114 #elif defined(__OpenBSD__)
116 # define V8_OS_OPENBSD 1
117 # define V8_OS_POSIX 1
118 #elif defined(__QNXNTO__)
119 # define V8_OS_POSIX 1
121 #elif defined(_WIN32)
141 #if defined (_MSC_VER)
142 # define V8_LIBC_MSVCRT 1
143 #elif defined(__BIONIC__)
144 # define V8_LIBC_BIONIC 1
145 # define V8_LIBC_BSD 1
146 #elif defined(__UCLIBC__)
148 # define V8_LIBC_UCLIBC 1
149 #elif defined(__GLIBC__
) || defined(__GNU_LIBRARY__
)
150 # define V8_LIBC_GLIBC 1
152 # define V8_LIBC_BSD V8_OS_BSD
203 #if defined(__clang__
)
205 #if defined(__GNUC__
)
209 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
210 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
211 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
212 (__has_extension(attribute_deprecated_with_message))
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_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
220 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
221 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
222 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
223 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
224 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
225 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
226 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
227 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
228 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
229 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
230 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
234 # define V8_HAS_COMPUTED_GOTO 1
236 # if __cplusplus
>= 201402L
237 # define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
240 #elif defined(__GNUC__)
243 # if defined(__INTEL_COMPILER)
244 # define V8_CC_INTEL 1
246 # if defined(__MINGW32__)
247 # define V8_CC_MINGW32 1
249 # if defined(__MINGW64__)
250 # define V8_CC_MINGW64 1
252 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
257 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4
, 4
, 0
))
258 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3
, 4
, 0
))
259 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4
, 5
, 0
))
260 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3
, 4
, 0
))
261 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2
, 95
, 0
))
262 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4
, 3
, 0
))
263 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
264 (!V8_CC_INTEL && V8_GNUC_PREREQ(4
, 1
, 0
))
266 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (V8_GNUC_PREREQ(4
, 7
, 0
))
267 # define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3
, 4
, 0
))
268 # define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3
, 4
, 0
))
269 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2
, 96
, 0
))
270 # define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2
, 96
, 0
))
271 # define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3
, 4
, 0
))
274 #define V8_HAS_COMPUTED_GOTO (V8_GNUC_PREREQ(2
, 0
, 0
))
278 #if defined(_MSC_VER)
279 # define V8_CC_MSVC 1
281 # define V8_HAS_DECLSPEC_DEPRECATED 1
282 # define V8_HAS_DECLSPEC_NOINLINE 1
283 # define V8_HAS_DECLSPEC_SELECTANY 1
284 # define V8_HAS_DECLSPEC_NORETURN 1
286 # define V8_HAS___FORCEINLINE 1
297 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
298 # define V8_INLINE inline __attribute__((always_inline))
299 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
300 # define V8_INLINE __forceinline
302 # define V8_INLINE inline
305 #if V8_HAS_BUILTIN_ASSUME_ALIGNED
306 # define V8_ASSUME_ALIGNED(ptr, alignment)
307 __builtin_assume_aligned((ptr), (alignment))
309 # define V8_ASSUME_ALIGNED(ptr) (ptr)
316 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE
317 # define V8_NOINLINE __attribute__((noinline))
318 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE
319 # define V8_NOINLINE __declspec(noinline)
326 #if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
327 #define V8_DEPRECATED(message, declarator)
328 declarator __attribute__((deprecated(message)))
329 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
330 #define V8_DEPRECATED(message, declarator)
331 declarator __attribute__((deprecated))
332 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
333 #define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
335 #define V8_DEPRECATED(message, declarator) declarator
340 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS) &&
341 V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
342 #define V8_DEPRECATE_SOON(message, declarator)
343 declarator __attribute__((deprecated(message)))
344 #elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
345 #define V8_DEPRECATE_SOON(message, declarator)
346 declarator __attribute__((deprecated))
347 #elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
348 #define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
350 #define V8_DEPRECATE_SOON(message, declarator) declarator
355 #if V8_HAS_BUILTIN_EXPECT
356 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0
))
357 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1
))
359 # define V8_UNLIKELY(condition) (condition)
360 # define V8_LIKELY(condition) (condition)
367 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
368 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
370 #define V8_WARN_UNUSED_RESULT
373 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
374 #error Inconsistent build configuration: To build the V8 shared library set
375 BUILDING_V8_SHARED, to include its headers for linking against the V8
376 shared library set USING_V8_SHARED.
386 #ifdef BUILDING_V8_SHARED
387 # define V8_EXPORT __declspec(dllexport)
388 #elif USING_V8_SHARED
389 # define V8_EXPORT __declspec(dllimport)
397 #if V8_HAS_ATTRIBUTE_VISIBILITY
398 # ifdef BUILDING_V8_SHARED
399 # define V8_EXPORT __attribute__ ((visibility("default")))