v8  10.1.124 (node 18.2.0)
V8 is Google's open source JavaScript engine
v8config.h
Go to the documentation of this file.
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8CONFIG_H_
6 #define V8CONFIG_H_
7 
8 #ifdef V8_GN_HEADER
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
12 #endif
13 #include "v8-gn.h" // NOLINT(build/include_directory)
14 #endif
15 
16 // clang-format off
17 
18 // Platform headers for feature detection below.
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>
25 #endif
26 
27 
28 // This macro allows to test for the version of the GNU C library (or
29 // a compatible C library that masquerades as glibc). It evaluates to
30 // 0 if libc is not GNU libc or compatible.
31 // Use like:
32 // #if V8_GLIBC_PREREQ(2, 3)
33 // ...
34 // #endif
35 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
36 # define V8_GLIBC_PREREQ(major, minor)
37  ((__GLIBC__ * 100 + __GLIBC_MINOR__) >= ((major) * 100 + (minor)))
38 #else
39 # define V8_GLIBC_PREREQ(major, minor) 0
40 #endif
41 
42 
43 // This macro allows to test for the version of the GNU C++ compiler.
44 // Note that this also applies to compilers that masquerade as GCC,
45 // for example clang and the Intel C++ compiler for Linux.
46 // Use like:
47 // #if V8_GNUC_PREREQ(4, 3, 1)
48 // ...
49 // #endif
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)))
58 #else
59 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
60 #endif
61 
62 
63 
64 // -----------------------------------------------------------------------------
65 // Operating system detection (host)
66 //
67 // V8_OS_ANDROID - Android
68 // V8_OS_BSD - BSDish (macOS, Net/Free/Open/DragonFlyBSD)
69 // V8_OS_CYGWIN - Cygwin
70 // V8_OS_DRAGONFLYBSD - DragonFlyBSD
71 // V8_OS_FREEBSD - FreeBSD
72 // V8_OS_FUCHSIA - Fuchsia
73 // V8_OS_LINUX - Linux (Android, ChromeOS, Linux, ...)
74 // V8_OS_DARWIN - Darwin (macOS, iOS)
75 // V8_OS_MACOS - macOS
76 // V8_OS_IOS - iOS
77 // V8_OS_NETBSD - NetBSD
78 // V8_OS_OPENBSD - OpenBSD
79 // V8_OS_POSIX - POSIX compatible (mostly everything except Windows)
80 // V8_OS_QNX - QNX Neutrino
81 // V8_OS_SOLARIS - Sun Solaris and OpenSolaris
82 // V8_OS_STARBOARD - Starboard (platform abstraction for Cobalt)
83 // V8_OS_AIX - AIX
84 // V8_OS_WIN - Microsoft Windows
85 
86 #if defined(__ANDROID__)
87 # define V8_OS_ANDROID 1
88 # define V8_OS_LINUX 1
89 # define V8_OS_POSIX 1
90 # define V8_OS_STRING "android"
91 
92 #elif defined(__APPLE__)
93 # define V8_OS_POSIX 1
94 # define V8_OS_BSD 1
95 # define V8_OS_DARWIN 1
96 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
97 # define V8_OS_IOS 1
98 # define V8_OS_STRING "ios"
99 # else
100 # define V8_OS_MACOS 1
101 # define V8_OS_STRING "macos"
102 # endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
103 
104 #elif defined(__CYGWIN__)
105 # define V8_OS_CYGWIN 1
106 # define V8_OS_POSIX 1
107 # define V8_OS_STRING "cygwin"
108 
109 #elif defined(__linux__)
110 # define V8_OS_LINUX 1
111 # define V8_OS_POSIX 1
112 # define V8_OS_STRING "linux"
113 
114 #elif defined(__sun)
115 # define V8_OS_POSIX 1
116 # define V8_OS_SOLARIS 1
117 # define V8_OS_STRING "sun"
118 
119 #elif defined(STARBOARD)
120 # define V8_OS_STARBOARD 1
121 # define V8_OS_STRING "starboard"
122 
123 #elif defined(_AIX)
124 # define V8_OS_POSIX 1
125 # define V8_OS_AIX 1
126 # define V8_OS_STRING "aix"
127 
128 #elif defined(__FreeBSD__)
129 # define V8_OS_BSD 1
130 # define V8_OS_FREEBSD 1
131 # define V8_OS_POSIX 1
132 # define V8_OS_STRING "freebsd"
133 
134 #elif defined(__Fuchsia__)
135 # define V8_OS_FUCHSIA 1
136 # define V8_OS_POSIX 1
137 # define V8_OS_STRING "fuchsia"
138 
139 #elif defined(__DragonFly__)
140 # define V8_OS_BSD 1
141 # define V8_OS_DRAGONFLYBSD 1
142 # define V8_OS_POSIX 1
143 # define V8_OS_STRING "dragonflybsd"
144 
145 #elif defined(__NetBSD__)
146 # define V8_OS_BSD 1
147 # define V8_OS_NETBSD 1
148 # define V8_OS_POSIX 1
149 # define V8_OS_STRING "netbsd"
150 
151 #elif defined(__OpenBSD__)
152 # define V8_OS_BSD 1
153 # define V8_OS_OPENBSD 1
154 # define V8_OS_POSIX 1
155 # define V8_OS_STRING "openbsd"
156 
157 #elif defined(__QNXNTO__)
158 # define V8_OS_POSIX 1
159 # define V8_OS_QNX 1
160 # define V8_OS_STRING "qnx"
161 
162 #elif defined(_WIN32)
163 # define V8_OS_WIN 1
164 # define V8_OS_STRING "windows"
165 #endif
166 
167 // -----------------------------------------------------------------------------
168 // Operating system detection (target)
169 //
170 // V8_TARGET_OS_ANDROID
171 // V8_TARGET_OS_FUCHSIA
172 // V8_TARGET_OS_IOS
173 // V8_TARGET_OS_LINUX
174 // V8_TARGET_OS_MACOS
175 // V8_TARGET_OS_WIN
176 //
177 // If not set explicitly, these fall back to corresponding V8_OS_ values.
178 
179 #ifdef V8_HAVE_TARGET_OS
180 
181 // The target OS is provided, just check that at least one known value is set.
182 # if !defined(V8_TARGET_OS_ANDROID)
183  && !defined(V8_TARGET_OS_FUCHSIA)
184  && !defined(V8_TARGET_OS_IOS)
185  && !defined(V8_TARGET_OS_LINUX)
186  && !defined(V8_TARGET_OS_MACOS)
187  && !defined(V8_TARGET_OS_WIN)
188 # error No known target OS defined.
189 # endif
190 
191 #else // V8_HAVE_TARGET_OS
192 
193 # if defined(V8_TARGET_OS_ANDROID)
194  || defined(V8_TARGET_OS_FUCHSIA)
195  || defined(V8_TARGET_OS_IOS)
196  || defined(V8_TARGET_OS_LINUX)
197  || defined(V8_TARGET_OS_MACOS)
198  || defined(V8_TARGET_OS_WIN)
199 # error A target OS is defined but V8_HAVE_TARGET_OS is unset.
200 # endif
201 
202 // Fall back to the detected host OS.
203 #ifdef V8_OS_ANDROID
204 # define V8_TARGET_OS_ANDROID
205 #endif
206 
207 #ifdef V8_OS_FUCHSIA
208 # define V8_TARGET_OS_FUCHSIA
209 #endif
210 
211 #ifdef V8_OS_IOS
212 # define V8_TARGET_OS_IOS
213 #endif
214 
215 #ifdef V8_OS_LINUX
216 # define V8_TARGET_OS_LINUX
217 #endif
218 
219 #ifdef V8_OS_MACOS
220 # define V8_TARGET_OS_MACOS
221 #endif
222 
223 #ifdef V8_OS_WIN
224 # define V8_TARGET_OS_WIN
225 #endif
226 
227 #endif // V8_HAVE_TARGET_OS
228 
229 #if defined(V8_TARGET_OS_ANDROID)
230 # define V8_TARGET_OS_STRING "android"
231 #elif defined(V8_TARGET_OS_FUCHSIA)
232 # define V8_TARGET_OS_STRING "fuchsia"
233 #elif defined(V8_TARGET_OS_IOS)
234 # define V8_TARGET_OS_STRING "ios"
235 #elif defined(V8_TARGET_OS_LINUX)
236 # define V8_TARGET_OS_STRING "linux"
237 #elif defined(V8_TARGET_OS_MACOS)
238 # define V8_TARGET_OS_STRING "macos"
239 #elif defined(V8_TARGET_OS_WINDOWS)
240 # define V8_TARGET_OS_STRING "windows"
241 #else
242 # define V8_TARGET_OS_STRING "unknown"
243 #endif
244 
245 // -----------------------------------------------------------------------------
246 // C library detection
247 //
248 // V8_LIBC_MSVCRT - MSVC libc
249 // V8_LIBC_BIONIC - Bionic libc
250 // V8_LIBC_BSD - BSD libc derivate
251 // V8_LIBC_GLIBC - GNU C library
252 // V8_LIBC_UCLIBC - uClibc
253 //
254 // Note that testing for libc must be done using #if not #ifdef. For example,
255 // to test for the GNU C library, use:
256 // #if V8_LIBC_GLIBC
257 // ...
258 // #endif
259 
260 #if defined (_MSC_VER)
261 # define V8_LIBC_MSVCRT 1
262 #elif defined(__BIONIC__)
263 # define V8_LIBC_BIONIC 1
264 # define V8_LIBC_BSD 1
265 #elif defined(__UCLIBC__)
266 // Must test for UCLIBC before GLIBC, as UCLIBC pretends to be GLIBC.
267 # define V8_LIBC_UCLIBC 1
268 #elif defined(__GLIBC__) || defined(__GNU_LIBRARY__)
269 # define V8_LIBC_GLIBC 1
270 #else
271 # define V8_LIBC_BSD V8_OS_BSD
272 #endif
273 
274 
275 // -----------------------------------------------------------------------------
276 // Compiler detection
277 //
278 // V8_CC_GNU - GCC, or clang in gcc mode
279 // V8_CC_INTEL - Intel C++
280 // V8_CC_MINGW - Minimalist GNU for Windows
281 // V8_CC_MINGW32 - Minimalist GNU for Windows (mingw32)
282 // V8_CC_MINGW64 - Minimalist GNU for Windows (mingw-w64)
283 // V8_CC_MSVC - Microsoft Visual C/C++, or clang in cl.exe mode
284 //
285 // C++11 feature detection
286 //
287 // Compiler-specific feature detection
288 //
289 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
290 // supported
291 // V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
292 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
293 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
294 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
295 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
296 // supported
297 // V8_HAS_CPP_ATTRIBUTE_NODISCARD - [[nodiscard]] supported
298 // V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
299 // - [[no_unique_address]] supported
300 // V8_HAS_BUILTIN_BSWAP16 - __builtin_bswap16() supported
301 // V8_HAS_BUILTIN_BSWAP32 - __builtin_bswap32() supported
302 // V8_HAS_BUILTIN_BSWAP64 - __builtin_bswap64() supported
303 // V8_HAS_BUILTIN_CLZ - __builtin_clz() supported
304 // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
305 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
306 // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported
307 // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
308 // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
309 // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
310 // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
311 // V8_HAS_COMPUTED_GOTO - computed goto/labels as values
312 // supported
313 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
314 // V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
315 // V8_HAS___FORCEINLINE - __forceinline supported
316 //
317 // Note that testing for compilers and/or features must be done using #if
318 // not #ifdef. For example, to test for Intel C++ Compiler, use:
319 // #if V8_CC_INTEL
320 // ...
321 // #endif
322 
323 #if defined(__has_cpp_attribute)
324 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
325 #else
326 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
327 #endif
328 
329 #if defined(__clang__)
330 
331 #if defined(__GNUC__) // Clang in gcc mode.
332 # define V8_CC_GNU 1
333 #endif
334 
335 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
336 # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
337 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
338 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
339 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
340 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
341  (__has_attribute(warn_unused_result))
342 
343 # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
344 # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
345  (V8_HAS_CPP_ATTRIBUTE(no_unique_address))
346 
347 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
348 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
349 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
350 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
351 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
352 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
353 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
354 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
355 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
356 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
357 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
358 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
359 
360 // Clang has no __has_feature for computed gotos.
361 // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
362 # define V8_HAS_COMPUTED_GOTO 1
363 
364 #elif defined(__GNUC__)
365 
366 # define V8_CC_GNU 1
367 # if defined(__INTEL_COMPILER) // Intel C++ also masquerades as GCC 3.2.0
368 # define V8_CC_INTEL 1
369 # endif
370 # if defined(__MINGW32__)
371 # define V8_CC_MINGW32 1
372 # endif
373 # if defined(__MINGW64__)
374 # define V8_CC_MINGW64 1
375 # endif
376 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
377 
378 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
379 // Works around "sorry, unimplemented: inlining failed" build errors with
380 // older compilers.
381 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
382 # define V8_HAS_ATTRIBUTE_NOINLINE 1
383 # define V8_HAS_ATTRIBUTE_UNUSED 1
384 # define V8_HAS_ATTRIBUTE_VISIBILITY 1
385 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
386 
387 // [[nodiscard]] does not work together with with
388 // __attribute__((visibility(""))) on GCC 7.4 which is why there is no define
389 // for V8_HAS_CPP_ATTRIBUTE_NODISCARD. See https://crbug.com/v8/11707.
390 
391 # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
392 # define V8_HAS_BUILTIN_CLZ 1
393 # define V8_HAS_BUILTIN_CTZ 1
394 # define V8_HAS_BUILTIN_EXPECT 1
395 # define V8_HAS_BUILTIN_FRAME_ADDRESS 1
396 # define V8_HAS_BUILTIN_POPCOUNT 1
397 
398 // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
399 #define V8_HAS_COMPUTED_GOTO 1
400 
401 #endif
402 
403 #if defined(_MSC_VER)
404 # define V8_CC_MSVC 1
405 
406 # define V8_HAS_DECLSPEC_NOINLINE 1
407 # define V8_HAS_DECLSPEC_SELECTANY 1
408 
409 # define V8_HAS___FORCEINLINE 1
410 
411 #endif
412 
413 
414 // -----------------------------------------------------------------------------
415 // Helper macros
416 
417 // A macro used to make better inlining. Don't bother for debug builds.
418 // Use like:
419 // V8_INLINE int GetZero() { return 0; }
420 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
421 # define V8_INLINE inline __attribute__((always_inline))
422 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
423 # define V8_INLINE __forceinline
424 #else
425 # define V8_INLINE inline
426 #endif
427 
428 #if V8_HAS_BUILTIN_ASSUME_ALIGNED
429 # define V8_ASSUME_ALIGNED(ptr, alignment)
430  __builtin_assume_aligned((ptr), (alignment))
431 #else
432 # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
433 #endif
434 
435 
436 // A macro to mark specific arguments as non-null.
437 // Use like:
438 // int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
439 #if V8_HAS_ATTRIBUTE_NONNULL
440 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
441 #else
442 # define V8_NONNULL(...) /* NOT SUPPORTED */
443 #endif
444 
445 
446 // A macro used to tell the compiler to never inline a particular function.
447 // Use like:
448 // V8_NOINLINE int GetMinusOne() { return -1; }
449 #if V8_HAS_ATTRIBUTE_NOINLINE
450 # define V8_NOINLINE __attribute__((noinline))
451 #elif V8_HAS_DECLSPEC_NOINLINE
452 # define V8_NOINLINE __declspec(noinline)
453 #else
454 # define V8_NOINLINE /* NOT SUPPORTED */
455 #endif
456 
457 
458 // A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
459 #if defined(V8_DEPRECATION_WARNINGS)
460 # define V8_DEPRECATED(message) [[deprecated(message)]]
461 #else
462 # define V8_DEPRECATED(message)
463 #endif
464 
465 
466 // A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
467 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
468 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
469 #else
470 # define V8_DEPRECATE_SOON(message)
471 #endif
472 
473 
474 #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
475 # define V8_ENUM_DEPRECATED(message)
476 # define V8_ENUM_DEPRECATE_SOON(message)
477 #else
478 # define V8_ENUM_DEPRECATED(message) V8_DEPRECATED(message)
479 # define V8_ENUM_DEPRECATE_SOON(message) V8_DEPRECATE_SOON(message)
480 #endif
481 
482 
483 // A macro to provide the compiler with branch prediction information.
484 #if V8_HAS_BUILTIN_EXPECT
485 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
486 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
487 #else
488 # define V8_UNLIKELY(condition) (condition)
489 # define V8_LIKELY(condition) (condition)
490 #endif
491 
492 
493 // Annotate a function indicating the caller must examine the return value.
494 // Use like:
495 // int foo() V8_WARN_UNUSED_RESULT;
496 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
497 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
498 #else
499 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
500 #endif
501 
502 
503 // Annotate a class or constructor indicating the caller must assign the
504 // constructed instances.
505 // Apply to the whole class like:
506 // class V8_NODISCARD Foo() { ... };
507 // or apply to just one constructor like:
508 // V8_NODISCARD Foo() { ... };
509 // [[nodiscard]] comes in C++17 but supported in clang with -std >= c++11.
510 #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
511 #define V8_NODISCARD [[nodiscard]]
512 #else
513 #define V8_NODISCARD /* NOT SUPPORTED */
514 #endif
515 
516 // The no_unique_address attribute allows tail padding in a non-static data
517 // member to overlap other members of the enclosing class (and in the special
518 // case when the type is empty, permits it to fully overlap other members). The
519 // field is laid out as if a base class were encountered at the corresponding
520 // point within the class (except that it does not share a vptr with the
521 // enclosing object).
522 //
523 // Apply to a data member like:
524 //
525 // class Foo {
526 // V8_NO_UNIQUE_ADDRESS Bar bar_;
527 // };
528 //
529 // [[no_unique_address]] comes in C++20 but supported in clang with
530 // -std >= c++11.
531 #if V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
532 #define V8_NO_UNIQUE_ADDRESS [[no_unique_address]]
533 #else
534 #define V8_NO_UNIQUE_ADDRESS /* NOT SUPPORTED */
535 #endif
536 
537 // Helper macro to define no_sanitize attributes only with clang.
538 #if defined(__clang__) && defined(__has_attribute)
539 #if __has_attribute(no_sanitize)
540 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
541 #endif
542 #endif
543 #if !defined(V8_CLANG_NO_SANITIZE)
544 #define V8_CLANG_NO_SANITIZE(what)
545 #endif
546 
547 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
548 #error Inconsistent build configuration: To build the V8 shared library set
549  BUILDING_V8_SHARED, to include its headers for linking against the V8
550  shared library set USING_V8_SHARED.
551 #endif
552 
553 #ifdef V8_OS_WIN
554 
555 // Setup for Windows DLL export/import. When building the V8 DLL the
556 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
557 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
558 // static library or building a program which uses the V8 static library neither
559 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
560 #ifdef BUILDING_V8_SHARED
561 # define V8_EXPORT __declspec(dllexport)
562 #elif USING_V8_SHARED
563 # define V8_EXPORT __declspec(dllimport)
564 #else
565 # define V8_EXPORT
566 #endif // BUILDING_V8_SHARED
567 
568 #else // V8_OS_WIN
569 
570 // Setup for Linux shared library export.
571 #if V8_HAS_ATTRIBUTE_VISIBILITY
572 # ifdef BUILDING_V8_SHARED
573 # define V8_EXPORT __attribute__ ((visibility("default")))
574 # else
575 # define V8_EXPORT
576 # endif
577 #else
578 # define V8_EXPORT
579 #endif
580 
581 #endif // V8_OS_WIN
582 
583 // The sandbox is available (i.e. defined) when pointer compression
584 // is enabled, but it is only used when V8_SANDBOX is enabled as
585 // well. This allows better test coverage of the sandbox.
586 #if defined(V8_COMPRESS_POINTERS)
587 #define V8_SANDBOX_IS_AVAILABLE
588 #endif
589 
590 #if defined(V8_SANDBOX) && !defined(V8_SANDBOX_IS_AVAILABLE)
591 #error Inconsistent configuration: sandbox is enabled but not available
592 #endif
593 
594 // From C++17 onwards, static constexpr member variables are defined to be
595 // "inline", and adding a separate definition for them can trigger deprecation
596 // warnings. For C++14 and below, however, these definitions are required.
597 #if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)
598 #define V8_STATIC_CONSTEXPR_VARIABLES_NEED_DEFINITIONS
599 #endif
600 
601 // clang-format on
602 
603 #undef V8_HAS_CPP_ATTRIBUTE
604 
605 #endif // V8CONFIG_H_