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 # define V8_OS_STRING "android"
91 #elif defined(__APPLE__)
93 # define V8_OS_MACOSX 1
94 # define V8_OS_POSIX 1
95 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
97 # define V8_OS_STRING "ios"
99 # define V8_OS_STRING "macos"
102 #elif defined(__CYGWIN__)
103 # define V8_OS_CYGWIN 1
104 # define V8_OS_POSIX 1
105 # define V8_OS_STRING "cygwin"
107 #elif defined(__linux__
)
108 # define V8_OS_LINUX 1
109 # define V8_OS_POSIX 1
110 # define V8_OS_STRING "linux"
113 # define V8_OS_POSIX 1
114 # define V8_OS_SOLARIS 1
115 # define V8_OS_STRING "sun"
117 #elif defined(STARBOARD)
118 # define V8_OS_STARBOARD 1
119 # define V8_OS_STRING "starboard"
122 # define V8_OS_POSIX 1
124 # define V8_OS_STRING "aix"
126 #elif defined(__FreeBSD__)
128 # define V8_OS_FREEBSD 1
129 # define V8_OS_POSIX 1
130 # define V8_OS_STRING "freebsd"
132 #elif defined(__Fuchsia__)
133 # define V8_OS_FUCHSIA 1
134 # define V8_OS_POSIX 1
135 # define V8_OS_STRING "fuchsia"
137 #elif defined(__DragonFly__)
139 # define V8_OS_DRAGONFLYBSD 1
140 # define V8_OS_POSIX 1
141 # define V8_OS_STRING "dragonflybsd"
143 #elif defined(__NetBSD__)
145 # define V8_OS_NETBSD 1
146 # define V8_OS_POSIX 1
147 # define V8_OS_STRING "netbsd"
149 #elif defined(__OpenBSD__)
151 # define V8_OS_OPENBSD 1
152 # define V8_OS_POSIX 1
153 # define V8_OS_STRING "openbsd"
155 #elif defined(__QNXNTO__)
156 # define V8_OS_POSIX 1
158 # define V8_OS_STRING "qnx"
160 #elif defined(_WIN32)
162 # define V8_OS_STRING "windows"
177 #ifdef V8_HAVE_TARGET_OS
180 # if !defined(V8_TARGET_OS_ANDROID)
181 && !defined(V8_TARGET_OS_FUCHSIA)
182 && !defined(V8_TARGET_OS_IOS)
183 && !defined(V8_TARGET_OS_LINUX)
184 && !defined(V8_TARGET_OS_MACOSX)
185 && !defined(V8_TARGET_OS_WIN)
186 # error No known target OS defined.
191 # if defined(V8_TARGET_OS_ANDROID)
192 || defined(V8_TARGET_OS_FUCHSIA)
193 || defined(V8_TARGET_OS_IOS)
194 || defined(V8_TARGET_OS_LINUX)
195 || defined(V8_TARGET_OS_MACOSX)
196 || defined(V8_TARGET_OS_WIN)
197 # error A target OS is defined but V8_HAVE_TARGET_OS is unset.
202 # define V8_TARGET_OS_ANDROID
206 # define V8_TARGET_OS_FUCHSIA
210 # define V8_TARGET_OS_IOS
214 # define V8_TARGET_OS_LINUX
218 # define V8_TARGET_OS_MACOSX
222 # define V8_TARGET_OS_WIN
227 #if defined(V8_TARGET_OS_ANDROID)
228 # define V8_TARGET_OS_STRING "android"
229 #elif defined(V8_TARGET_OS_FUCHSIA)
230 # define V8_TARGET_OS_STRING "fuchsia"
231 #elif defined(V8_TARGET_OS_IOS)
232 # define V8_TARGET_OS_STRING "ios"
233 #elif defined(V8_TARGET_OS_LINUX
)
234 # define V8_TARGET_OS_STRING "linux"
235 #elif defined(V8_TARGET_OS_MACOSX)
236 # define V8_TARGET_OS_STRING "macos"
237 #elif defined(V8_TARGET_OS_WINDOWS)
238 # define V8_TARGET_OS_STRING "windows"
240 # define V8_TARGET_OS_STRING "unknown"
258 #if defined (_MSC_VER)
259 # define V8_LIBC_MSVCRT 1
260 #elif defined(__BIONIC__)
261 # define V8_LIBC_BIONIC 1
262 # define V8_LIBC_BSD 1
263 #elif defined(__UCLIBC__)
265 # define V8_LIBC_UCLIBC 1
266 #elif defined(__GLIBC__
) || defined(__GNU_LIBRARY__
)
267 # define V8_LIBC_GLIBC 1
269 # define V8_LIBC_BSD V8_OS_BSD
319 #if defined(__has_cpp_attribute
)
320 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
322 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
325 #if defined(__clang__
)
327 #if defined(__GNUC__
)
331 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
332 # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
333 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
334 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
335 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
336 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
337 (__has_attribute(warn_unused_result))
339 # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
341 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
342 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
343 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
344 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
345 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
346 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
347 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
348 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
349 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
350 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
351 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
352 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
356 # define V8_HAS_COMPUTED_GOTO 1
358 #elif defined(__GNUC__)
361 # if defined(__INTEL_COMPILER)
362 # define V8_CC_INTEL 1
364 # if defined(__MINGW32__)
365 # define V8_CC_MINGW32 1
367 # if defined(__MINGW64__)
368 # define V8_CC_MINGW64 1
370 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
375 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
376 # define V8_HAS_ATTRIBUTE_NOINLINE 1
377 # define V8_HAS_ATTRIBUTE_UNUSED 1
378 # define V8_HAS_ATTRIBUTE_VISIBILITY 1
379 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
385 # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
386 # define V8_HAS_BUILTIN_CLZ 1
387 # define V8_HAS_BUILTIN_CTZ 1
388 # define V8_HAS_BUILTIN_EXPECT 1
389 # define V8_HAS_BUILTIN_FRAME_ADDRESS 1
390 # define V8_HAS_BUILTIN_POPCOUNT 1
393 #define V8_HAS_COMPUTED_GOTO 1
397 #if defined(_MSC_VER)
398 # define V8_CC_MSVC 1
400 # define V8_HAS_DECLSPEC_NOINLINE 1
401 # define V8_HAS_DECLSPEC_SELECTANY 1
403 # define V8_HAS___FORCEINLINE 1
414 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
415 # define V8_INLINE inline __attribute__((always_inline))
416 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
417 # define V8_INLINE __forceinline
419 # define V8_INLINE inline
422 #if V8_HAS_BUILTIN_ASSUME_ALIGNED
423 # define V8_ASSUME_ALIGNED(ptr, alignment)
424 __builtin_assume_aligned((ptr), (alignment))
426 # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
433 #if V8_HAS_ATTRIBUTE_NONNULL
434 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
436 # define V8_NONNULL(...)
443 #if V8_HAS_ATTRIBUTE_NOINLINE
444 # define V8_NOINLINE __attribute__((noinline))
445 #elif V8_HAS_DECLSPEC_NOINLINE
446 # define V8_NOINLINE __declspec(noinline)
453 #if defined(V8_DEPRECATION_WARNINGS)
454 # define V8_DEPRECATED(message) [[deprecated(message)]]
456 # define V8_DEPRECATED(message)
461 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
462 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
464 # define V8_DEPRECATE_SOON(message)
468 #if defined(__GNUC__
) && !defined(__clang__
) && (__GNUC__
< 6
)
469 # define V8_ENUM_DEPRECATED(message)
470 # define V8_ENUM_DEPRECATE_SOON(message)
478 #if V8_HAS_BUILTIN_EXPECT
479 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0
))
480 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1
))
482 # define V8_UNLIKELY(condition) (condition)
483 # define V8_LIKELY(condition) (condition)
490 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
491 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
493 #define V8_WARN_UNUSED_RESULT
504 #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
505 #define V8_NODISCARD [[nodiscard]]
511 #if defined(__clang__
) && defined(__has_attribute
)
512 #if __has_attribute
(no_sanitize)
513 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
517 #define V8_CLANG_NO_SANITIZE(what)
520 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
521 #error Inconsistent build configuration: To build the V8 shared library set
522 BUILDING_V8_SHARED, to include its headers for linking against the V8
523 shared library set USING_V8_SHARED.
533 #ifdef BUILDING_V8_SHARED
534 # define V8_EXPORT __declspec(dllexport)
535 #elif USING_V8_SHARED
536 # define V8_EXPORT __declspec(dllimport)
544 #if V8_HAS_ATTRIBUTE_VISIBILITY
545 # ifdef BUILDING_V8_SHARED
546 # define V8_EXPORT __attribute__ ((visibility("default")))
558 #undef V8_HAS_CPP_ATTRIBUTE