9 #if __cplusplus >= 201703L
&& !__has_include("v8-gn.h")
10 #error Missing v8-gn.h. The configuration for v8 is missing from the include path
11 . Add it with -I<path> to the command line
19 #if defined(__ANDROID__)
20 # include <sys/cdefs.h>
21 #elif defined(__APPLE__)
22 # include <TargetConditionals.h>
23 #elif defined(__linux__
)
24 # include <features.h>
35 #if defined(__GLIBC__
) && defined(__GLIBC_MINOR__
)
36 # define V8_GLIBC_PREREQ(major, minor)
37 ((__GLIBC__
* 100
+ __GLIBC_MINOR__
) >= ((major) * 100
+ (minor)))
39 # define V8_GLIBC_PREREQ(major, minor) 0
50 #if defined(__GNUC__
) && defined(__GNUC_MINOR__
) && defined(__GNUC_PATCHLEVEL__
)
51 # define V8_GNUC_PREREQ(major, minor, patchlevel)
52 ((__GNUC__
* 10000
+ __GNUC_MINOR__
* 100
+ __GNUC_PATCHLEVEL__
) >=
53 ((major) * 10000
+ (minor) * 100
+ (patchlevel)))
54 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
55 # define V8_GNUC_PREREQ(major, minor, patchlevel)
56 ((__GNUC__ * 10000
+ __GNUC_MINOR__ * 100
) >=
57 ((major) * 10000
+ (minor) * 100
+ (patchlevel)))
59 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
85 #if defined(__ANDROID__)
86 # define V8_OS_ANDROID 1
87 # define V8_OS_LINUX 1
88 # define V8_OS_POSIX 1
89 #elif defined(__APPLE__)
91 # define V8_OS_MACOSX 1
92 # define V8_OS_POSIX 1
93 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
96 #elif defined(__CYGWIN__)
97 # define V8_OS_CYGWIN 1
98 # define V8_OS_POSIX 1
99 #elif defined(__linux__
)
100 # define V8_OS_LINUX 1
101 # define V8_OS_POSIX 1
103 # define V8_OS_POSIX 1
104 # define V8_OS_SOLARIS 1
105 #elif defined(STARBOARD)
106 # define V8_OS_STARBOARD 1
108 #define V8_OS_POSIX 1
110 #elif defined(__FreeBSD__)
112 # define V8_OS_FREEBSD 1
113 # define V8_OS_POSIX 1
114 #elif defined(__Fuchsia__)
115 # define V8_OS_FUCHSIA 1
116 # define V8_OS_POSIX 1
117 #elif defined(__DragonFly__)
119 # define V8_OS_DRAGONFLYBSD 1
120 # define V8_OS_POSIX 1
121 #elif defined(__NetBSD__)
123 # define V8_OS_NETBSD 1
124 # define V8_OS_POSIX 1
125 #elif defined(__OpenBSD__)
127 # define V8_OS_OPENBSD 1
128 # define V8_OS_POSIX 1
129 #elif defined(__QNXNTO__)
130 # define V8_OS_POSIX 1
132 #elif defined(_WIN32)
148 #ifdef V8_HAVE_TARGET_OS
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 No known target OS defined.
162 # if defined(V8_TARGET_OS_ANDROID)
163 || defined(V8_TARGET_OS_FUCHSIA)
164 || defined(V8_TARGET_OS_IOS)
165 || defined(V8_TARGET_OS_LINUX)
166 || defined(V8_TARGET_OS_MACOSX)
167 || defined(V8_TARGET_OS_WIN)
168 # error A target OS is defined but V8_HAVE_TARGET_OS is unset.
173 # define V8_TARGET_OS_ANDROID
177 # define V8_TARGET_OS_FUCHSIA
181 # define V8_TARGET_OS_IOS
185 # define V8_TARGET_OS_LINUX
189 # define V8_TARGET_OS_MACOSX
193 # define V8_TARGET_OS_WIN
213 #if defined (_MSC_VER)
214 # define V8_LIBC_MSVCRT 1
215 #elif defined(__BIONIC__)
216 # define V8_LIBC_BIONIC 1
217 # define V8_LIBC_BSD 1
218 #elif defined(__UCLIBC__)
220 # define V8_LIBC_UCLIBC 1
221 #elif defined(__GLIBC__
) || defined(__GNU_LIBRARY__
)
222 # define V8_LIBC_GLIBC 1
224 # define V8_LIBC_BSD V8_OS_BSD
274 #if defined(__has_cpp_attribute
)
275 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
277 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
280 #if defined(__clang__
)
282 #if defined(__GNUC__
)
286 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
287 # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
288 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
289 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
290 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
291 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
292 (__has_attribute(warn_unused_result))
294 # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
296 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
297 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
298 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
299 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
300 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
301 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
302 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
303 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
304 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
305 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
306 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
307 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
311 # define V8_HAS_COMPUTED_GOTO 1
315 # define V8_HAS_CXX14_CONSTEXPR 1
317 #elif defined(__GNUC__)
320 # if defined(__INTEL_COMPILER)
321 # define V8_CC_INTEL 1
323 # if defined(__MINGW32__)
324 # define V8_CC_MINGW32 1
326 # if defined(__MINGW64__)
327 # define V8_CC_MINGW64 1
329 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
334 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
335 # define V8_HAS_ATTRIBUTE_NOINLINE 1
336 # define V8_HAS_ATTRIBUTE_UNUSED 1
337 # define V8_HAS_ATTRIBUTE_VISIBILITY 1
338 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
339 # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
341 # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
342 # define V8_HAS_BUILTIN_CLZ 1
343 # define V8_HAS_BUILTIN_CTZ 1
344 # define V8_HAS_BUILTIN_EXPECT 1
345 # define V8_HAS_BUILTIN_FRAME_ADDRESS 1
346 # define V8_HAS_BUILTIN_POPCOUNT 1
349 #define V8_HAS_COMPUTED_GOTO 1
354 # define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6
, 0
, 0
))
358 #if defined(_MSC_VER)
359 # define V8_CC_MSVC 1
361 # define V8_HAS_DECLSPEC_NOINLINE 1
362 # define V8_HAS_DECLSPEC_SELECTANY 1
364 # define V8_HAS___FORCEINLINE 1
375 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
376 # define V8_INLINE inline __attribute__((always_inline))
377 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
378 # define V8_INLINE __forceinline
380 # define V8_INLINE inline
383 #if V8_HAS_BUILTIN_ASSUME_ALIGNED
384 # define V8_ASSUME_ALIGNED(ptr, alignment)
385 __builtin_assume_aligned((ptr), (alignment))
387 # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
394 #if V8_HAS_ATTRIBUTE_NONNULL
395 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
397 # define V8_NONNULL(...)
404 #if V8_HAS_ATTRIBUTE_NOINLINE
405 # define V8_NOINLINE __attribute__((noinline))
406 #elif V8_HAS_DECLSPEC_NOINLINE
407 # define V8_NOINLINE __declspec(noinline)
414 #if defined(V8_DEPRECATION_WARNINGS)
415 # define V8_DEPRECATED(message) [[deprecated(message)]]
417 # define V8_DEPRECATED(message)
422 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
423 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
425 # define V8_DEPRECATE_SOON(message)
429 #if defined(__GNUC__
) && !defined(__clang__
) && (__GNUC__
< 6
)
430 # define V8_ENUM_DEPRECATED(message)
431 # define V8_ENUM_DEPRECATE_SOON(message)
439 #if V8_HAS_BUILTIN_EXPECT
440 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0
))
441 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1
))
443 # define V8_UNLIKELY(condition) (condition)
444 # define V8_LIKELY(condition) (condition)
451 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
452 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
454 #define V8_WARN_UNUSED_RESULT
465 #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
466 #define V8_NODISCARD [[nodiscard]]
472 #if defined(__clang__
) && defined(__has_attribute
)
473 #if __has_attribute
(no_sanitize)
474 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
478 #define V8_CLANG_NO_SANITIZE(what)
481 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
482 #error Inconsistent build configuration: To build the V8 shared library set
483 BUILDING_V8_SHARED, to include its headers for linking against the V8
484 shared library set USING_V8_SHARED.
494 #ifdef BUILDING_V8_SHARED
495 # define V8_EXPORT __declspec(dllexport)
496 #elif USING_V8_SHARED
497 # define V8_EXPORT __declspec(dllimport)
505 #if V8_HAS_ATTRIBUTE_VISIBILITY
506 # ifdef BUILDING_V8_SHARED
507 # define V8_EXPORT __attribute__ ((visibility("default")))
519 #undef V8_HAS_CPP_ATTRIBUTE