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)
137 #ifdef V8_HAVE_TARGET_OS
140 # if !defined(V8_TARGET_OS_ANDROID)
141 && !defined(V8_TARGET_OS_FUCHSIA)
142 && !defined(V8_TARGET_OS_IOS)
143 && !defined(V8_TARGET_OS_LINUX)
144 && !defined(V8_TARGET_OS_MACOSX)
145 && !defined(V8_TARGET_OS_WIN)
146 # error No known target OS defined.
151 # if defined(V8_TARGET_OS_ANDROID)
152 || defined(V8_TARGET_OS_FUCHSIA)
153 || defined(V8_TARGET_OS_IOS)
154 || defined(V8_TARGET_OS_LINUX)
155 || defined(V8_TARGET_OS_MACOSX)
156 || defined(V8_TARGET_OS_WIN)
157 # error A target OS is defined but V8_HAVE_TARGET_OS is unset.
162 # define V8_TARGET_OS_ANDROID
166 # define V8_TARGET_OS_FUCHSIA
170 # define V8_TARGET_OS_IOS
174 # define V8_TARGET_OS_LINUX
178 # define V8_TARGET_OS_MACOSX
182 # define V8_TARGET_OS_WIN
202 #if defined (_MSC_VER)
203 # define V8_LIBC_MSVCRT 1
204 #elif defined(__BIONIC__)
205 # define V8_LIBC_BIONIC 1
206 # define V8_LIBC_BSD 1
207 #elif defined(__UCLIBC__)
209 # define V8_LIBC_UCLIBC 1
210 #elif defined(__GLIBC__
) || defined(__GNU_LIBRARY__
)
211 # define V8_LIBC_GLIBC 1
213 # define V8_LIBC_BSD V8_OS_BSD
262 #if defined(__clang__
)
264 #if defined(__GNUC__
)
268 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
269 # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
270 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
271 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
272 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
273 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
274 (__has_attribute(warn_unused_result))
276 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
277 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
278 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
279 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
280 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
281 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
282 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
283 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
284 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
285 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
286 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
287 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
291 # define V8_HAS_COMPUTED_GOTO 1
295 # define V8_HAS_CXX14_CONSTEXPR 1
297 #elif defined(__GNUC__)
300 # if defined(__INTEL_COMPILER)
301 # define V8_CC_INTEL 1
303 # if defined(__MINGW32__)
304 # define V8_CC_MINGW32 1
306 # if defined(__MINGW64__)
307 # define V8_CC_MINGW64 1
309 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
314 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
315 # define V8_HAS_ATTRIBUTE_NOINLINE 1
316 # define V8_HAS_ATTRIBUTE_UNUSED 1
317 # define V8_HAS_ATTRIBUTE_VISIBILITY 1
318 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
320 # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
321 # define V8_HAS_BUILTIN_CLZ 1
322 # define V8_HAS_BUILTIN_CTZ 1
323 # define V8_HAS_BUILTIN_EXPECT 1
324 # define V8_HAS_BUILTIN_FRAME_ADDRESS 1
325 # define V8_HAS_BUILTIN_POPCOUNT 1
328 #define V8_HAS_COMPUTED_GOTO 1
333 # define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6
, 0
, 0
))
337 #if defined(_MSC_VER)
338 # define V8_CC_MSVC 1
340 # define V8_HAS_DECLSPEC_NOINLINE 1
341 # define V8_HAS_DECLSPEC_SELECTANY 1
343 # define V8_HAS___FORCEINLINE 1
354 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
355 # define V8_INLINE inline __attribute__((always_inline))
356 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
357 # define V8_INLINE __forceinline
359 # define V8_INLINE inline
362 #if V8_HAS_BUILTIN_ASSUME_ALIGNED
363 # define V8_ASSUME_ALIGNED(ptr, alignment)
364 __builtin_assume_aligned((ptr), (alignment))
366 # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
373 #if V8_HAS_ATTRIBUTE_NONNULL
374 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
376 # define V8_NONNULL(...)
383 #if V8_HAS_ATTRIBUTE_NOINLINE
384 # define V8_NOINLINE __attribute__((noinline))
385 #elif V8_HAS_DECLSPEC_NOINLINE
386 # define V8_NOINLINE __declspec(noinline)
393 #if defined(V8_DEPRECATION_WARNINGS)
394 # define V8_DEPRECATED(message) [[deprecated(message)]]
396 # define V8_DEPRECATED(message)
401 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
402 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
404 # define V8_DEPRECATE_SOON(message)
408 #if defined(__GNUC__
) && !defined(__clang__
) && (__GNUC__
< 6
)
409 # define V8_ENUM_DEPRECATED(message)
410 # define V8_ENUM_DEPRECATE_SOON(message)
418 #if V8_HAS_BUILTIN_EXPECT
419 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0
))
420 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1
))
422 # define V8_UNLIKELY(condition) (condition)
423 # define V8_LIKELY(condition) (condition)
430 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
431 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
433 #define V8_WARN_UNUSED_RESULT
437 #if defined(__clang__
) && defined(__has_attribute
)
438 #if __has_attribute
(no_sanitize)
439 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
443 #define V8_CLANG_NO_SANITIZE(what)
446 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
447 #error Inconsistent build configuration: To build the V8 shared library set
448 BUILDING_V8_SHARED, to include its headers for linking against the V8
449 shared library set USING_V8_SHARED.
459 #ifdef BUILDING_V8_SHARED
460 # define V8_EXPORT __declspec(dllexport)
461 #elif USING_V8_SHARED
462 # define V8_EXPORT __declspec(dllimport)
470 #if V8_HAS_ATTRIBUTE_VISIBILITY
471 # ifdef BUILDING_V8_SHARED
472 # define V8_EXPORT __attribute__ ((visibility("default")))