v8  9.4.146 (node 16.13.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 (Mac OS X, 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
74 // V8_OS_MACOSX - Mac OS X
75 // V8_OS_IOS - iOS
76 // V8_OS_NETBSD - NetBSD
77 // V8_OS_OPENBSD - OpenBSD
78 // V8_OS_POSIX - POSIX compatible (mostly everything except Windows)
79 // V8_OS_QNX - QNX Neutrino
80 // V8_OS_SOLARIS - Sun Solaris and OpenSolaris
81 // V8_OS_STARBOARD - Starboard (platform abstraction for Cobalt)
82 // V8_OS_AIX - AIX
83 // V8_OS_WIN - Microsoft Windows
84 
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"
90 
91 #elif defined(__APPLE__)
92 # define V8_OS_BSD 1
93 # define V8_OS_MACOSX 1
94 # define V8_OS_POSIX 1
95 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
96 # define V8_OS_IOS 1
97 # define V8_OS_STRING "ios"
98 # else
99 # define V8_OS_STRING "macos"
100 # endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
101 
102 #elif defined(__CYGWIN__)
103 # define V8_OS_CYGWIN 1
104 # define V8_OS_POSIX 1
105 # define V8_OS_STRING "cygwin"
106 
107 #elif defined(__linux__)
108 # define V8_OS_LINUX 1
109 # define V8_OS_POSIX 1
110 # define V8_OS_STRING "linux"
111 
112 #elif defined(__sun)
113 # define V8_OS_POSIX 1
114 # define V8_OS_SOLARIS 1
115 # define V8_OS_STRING "sun"
116 
117 #elif defined(STARBOARD)
118 # define V8_OS_STARBOARD 1
119 # define V8_OS_STRING "starboard"
120 
121 #elif defined(_AIX)
122 # define V8_OS_POSIX 1
123 # define V8_OS_AIX 1
124 # define V8_OS_STRING "aix"
125 
126 #elif defined(__FreeBSD__)
127 # define V8_OS_BSD 1
128 # define V8_OS_FREEBSD 1
129 # define V8_OS_POSIX 1
130 # define V8_OS_STRING "freebsd"
131 
132 #elif defined(__Fuchsia__)
133 # define V8_OS_FUCHSIA 1
134 # define V8_OS_POSIX 1
135 # define V8_OS_STRING "fuchsia"
136 
137 #elif defined(__DragonFly__)
138 # define V8_OS_BSD 1
139 # define V8_OS_DRAGONFLYBSD 1
140 # define V8_OS_POSIX 1
141 # define V8_OS_STRING "dragonflybsd"
142 
143 #elif defined(__NetBSD__)
144 # define V8_OS_BSD 1
145 # define V8_OS_NETBSD 1
146 # define V8_OS_POSIX 1
147 # define V8_OS_STRING "netbsd"
148 
149 #elif defined(__OpenBSD__)
150 # define V8_OS_BSD 1
151 # define V8_OS_OPENBSD 1
152 # define V8_OS_POSIX 1
153 # define V8_OS_STRING "openbsd"
154 
155 #elif defined(__QNXNTO__)
156 # define V8_OS_POSIX 1
157 # define V8_OS_QNX 1
158 # define V8_OS_STRING "qnx"
159 
160 #elif defined(_WIN32)
161 # define V8_OS_WIN 1
162 # define V8_OS_STRING "windows"
163 #endif
164 
165 // -----------------------------------------------------------------------------
166 // Operating system detection (target)
167 //
168 // V8_TARGET_OS_ANDROID
169 // V8_TARGET_OS_FUCHSIA
170 // V8_TARGET_OS_IOS
171 // V8_TARGET_OS_LINUX
172 // V8_TARGET_OS_MACOSX
173 // V8_TARGET_OS_WIN
174 //
175 // If not set explicitly, these fall back to corresponding V8_OS_ values.
176 
177 #ifdef V8_HAVE_TARGET_OS
178 
179 // The target OS is provided, just check that at least one known value is set.
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.
187 # endif
188 
189 #else // V8_HAVE_TARGET_OS
190 
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.
198 # endif
199 
200 // Fall back to the detected host OS.
201 #ifdef V8_OS_ANDROID
202 # define V8_TARGET_OS_ANDROID
203 #endif
204 
205 #ifdef V8_OS_FUCHSIA
206 # define V8_TARGET_OS_FUCHSIA
207 #endif
208 
209 #ifdef V8_OS_IOS
210 # define V8_TARGET_OS_IOS
211 #endif
212 
213 #ifdef V8_OS_LINUX
214 # define V8_TARGET_OS_LINUX
215 #endif
216 
217 #ifdef V8_OS_MACOSX
218 # define V8_TARGET_OS_MACOSX
219 #endif
220 
221 #ifdef V8_OS_WIN
222 # define V8_TARGET_OS_WIN
223 #endif
224 
225 #endif // V8_HAVE_TARGET_OS
226 
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"
239 #else
240 # define V8_TARGET_OS_STRING "unknown"
241 #endif
242 
243 // -----------------------------------------------------------------------------
244 // C library detection
245 //
246 // V8_LIBC_MSVCRT - MSVC libc
247 // V8_LIBC_BIONIC - Bionic libc
248 // V8_LIBC_BSD - BSD libc derivate
249 // V8_LIBC_GLIBC - GNU C library
250 // V8_LIBC_UCLIBC - uClibc
251 //
252 // Note that testing for libc must be done using #if not #ifdef. For example,
253 // to test for the GNU C library, use:
254 // #if V8_LIBC_GLIBC
255 // ...
256 // #endif
257 
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__)
264 // Must test for UCLIBC before GLIBC, as UCLIBC pretends to be GLIBC.
265 # define V8_LIBC_UCLIBC 1
266 #elif defined(__GLIBC__) || defined(__GNU_LIBRARY__)
267 # define V8_LIBC_GLIBC 1
268 #else
269 # define V8_LIBC_BSD V8_OS_BSD
270 #endif
271 
272 
273 // -----------------------------------------------------------------------------
274 // Compiler detection
275 //
276 // V8_CC_GNU - GCC, or clang in gcc mode
277 // V8_CC_INTEL - Intel C++
278 // V8_CC_MINGW - Minimalist GNU for Windows
279 // V8_CC_MINGW32 - Minimalist GNU for Windows (mingw32)
280 // V8_CC_MINGW64 - Minimalist GNU for Windows (mingw-w64)
281 // V8_CC_MSVC - Microsoft Visual C/C++, or clang in cl.exe mode
282 //
283 // C++11 feature detection
284 //
285 // Compiler-specific feature detection
286 //
287 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
288 // supported
289 // V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
290 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
291 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
292 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
293 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
294 // supported
295 // V8_HAS_CPP_ATTRIBUTE_NODISCARD - [[nodiscard]] supported
296 // V8_HAS_BUILTIN_BSWAP16 - __builtin_bswap16() supported
297 // V8_HAS_BUILTIN_BSWAP32 - __builtin_bswap32() supported
298 // V8_HAS_BUILTIN_BSWAP64 - __builtin_bswap64() supported
299 // V8_HAS_BUILTIN_CLZ - __builtin_clz() supported
300 // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
301 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
302 // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported
303 // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
304 // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
305 // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
306 // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
307 // V8_HAS_COMPUTED_GOTO - computed goto/labels as values
308 // supported
309 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
310 // V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
311 // V8_HAS___FORCEINLINE - __forceinline supported
312 //
313 // Note that testing for compilers and/or features must be done using #if
314 // not #ifdef. For example, to test for Intel C++ Compiler, use:
315 // #if V8_CC_INTEL
316 // ...
317 // #endif
318 
319 #if defined(__has_cpp_attribute)
320 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
321 #else
322 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
323 #endif
324 
325 #if defined(__clang__)
326 
327 #if defined(__GNUC__) // Clang in gcc mode.
328 # define V8_CC_GNU 1
329 #endif
330 
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))
338 
339 # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
340 
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))
353 
354 // Clang has no __has_feature for computed gotos.
355 // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
356 # define V8_HAS_COMPUTED_GOTO 1
357 
358 #elif defined(__GNUC__)
359 
360 # define V8_CC_GNU 1
361 # if defined(__INTEL_COMPILER) // Intel C++ also masquerades as GCC 3.2.0
362 # define V8_CC_INTEL 1
363 # endif
364 # if defined(__MINGW32__)
365 # define V8_CC_MINGW32 1
366 # endif
367 # if defined(__MINGW64__)
368 # define V8_CC_MINGW64 1
369 # endif
370 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
371 
372 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
373 // Works around "sorry, unimplemented: inlining failed" build errors with
374 // older compilers.
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)
380 
381 // [[nodiscard]] does not work together with with
382 // __attribute__((visibility(""))) on GCC 7.4 which is why there is no define
383 // for V8_HAS_CPP_ATTRIBUTE_NODISCARD. See https://crbug.com/v8/11707.
384 
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
391 
392 // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
393 #define V8_HAS_COMPUTED_GOTO 1
394 
395 #endif
396 
397 #if defined(_MSC_VER)
398 # define V8_CC_MSVC 1
399 
400 # define V8_HAS_DECLSPEC_NOINLINE 1
401 # define V8_HAS_DECLSPEC_SELECTANY 1
402 
403 # define V8_HAS___FORCEINLINE 1
404 
405 #endif
406 
407 
408 // -----------------------------------------------------------------------------
409 // Helper macros
410 
411 // A macro used to make better inlining. Don't bother for debug builds.
412 // Use like:
413 // V8_INLINE int GetZero() { return 0; }
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
418 #else
419 # define V8_INLINE inline
420 #endif
421 
422 #if V8_HAS_BUILTIN_ASSUME_ALIGNED
423 # define V8_ASSUME_ALIGNED(ptr, alignment)
424  __builtin_assume_aligned((ptr), (alignment))
425 #else
426 # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
427 #endif
428 
429 
430 // A macro to mark specific arguments as non-null.
431 // Use like:
432 // int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
433 #if V8_HAS_ATTRIBUTE_NONNULL
434 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
435 #else
436 # define V8_NONNULL(...) /* NOT SUPPORTED */
437 #endif
438 
439 
440 // A macro used to tell the compiler to never inline a particular function.
441 // Use like:
442 // V8_NOINLINE int GetMinusOne() { return -1; }
443 #if V8_HAS_ATTRIBUTE_NOINLINE
444 # define V8_NOINLINE __attribute__((noinline))
445 #elif V8_HAS_DECLSPEC_NOINLINE
446 # define V8_NOINLINE __declspec(noinline)
447 #else
448 # define V8_NOINLINE /* NOT SUPPORTED */
449 #endif
450 
451 
452 // A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
453 #if defined(V8_DEPRECATION_WARNINGS)
454 # define V8_DEPRECATED(message) [[deprecated(message)]]
455 #else
456 # define V8_DEPRECATED(message)
457 #endif
458 
459 
460 // A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
461 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
462 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
463 #else
464 # define V8_DEPRECATE_SOON(message)
465 #endif
466 
467 
468 #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
469 # define V8_ENUM_DEPRECATED(message)
470 # define V8_ENUM_DEPRECATE_SOON(message)
471 #else
472 # define V8_ENUM_DEPRECATED(message) V8_DEPRECATED(message)
473 # define V8_ENUM_DEPRECATE_SOON(message) V8_DEPRECATE_SOON(message)
474 #endif
475 
476 
477 // A macro to provide the compiler with branch prediction information.
478 #if V8_HAS_BUILTIN_EXPECT
479 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
480 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
481 #else
482 # define V8_UNLIKELY(condition) (condition)
483 # define V8_LIKELY(condition) (condition)
484 #endif
485 
486 
487 // Annotate a function indicating the caller must examine the return value.
488 // Use like:
489 // int foo() V8_WARN_UNUSED_RESULT;
490 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
491 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
492 #else
493 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
494 #endif
495 
496 
497 // Annotate a class or constructor indicating the caller must assign the
498 // constructed instances.
499 // Apply to the whole class like:
500 // class V8_NODISCARD Foo() { ... };
501 // or apply to just one constructor like:
502 // V8_NODISCARD Foo() { ... };
503 // [[nodiscard]] comes in C++17 but supported in clang with -std >= c++11.
504 #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
505 #define V8_NODISCARD [[nodiscard]]
506 #else
507 #define V8_NODISCARD /* NOT SUPPORTED */
508 #endif
509 
510 // Helper macro to define no_sanitize attributes only with clang.
511 #if defined(__clang__) && defined(__has_attribute)
512 #if __has_attribute(no_sanitize)
513 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
514 #endif
515 #endif
516 #if !defined(V8_CLANG_NO_SANITIZE)
517 #define V8_CLANG_NO_SANITIZE(what)
518 #endif
519 
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.
524 #endif
525 
526 #ifdef V8_OS_WIN
527 
528 // Setup for Windows DLL export/import. When building the V8 DLL the
529 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
530 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
531 // static library or building a program which uses the V8 static library neither
532 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
533 #ifdef BUILDING_V8_SHARED
534 # define V8_EXPORT __declspec(dllexport)
535 #elif USING_V8_SHARED
536 # define V8_EXPORT __declspec(dllimport)
537 #else
538 # define V8_EXPORT
539 #endif // BUILDING_V8_SHARED
540 
541 #else // V8_OS_WIN
542 
543 // Setup for Linux shared library export.
544 #if V8_HAS_ATTRIBUTE_VISIBILITY
545 # ifdef BUILDING_V8_SHARED
546 # define V8_EXPORT __attribute__ ((visibility("default")))
547 # else
548 # define V8_EXPORT
549 # endif
550 #else
551 # define V8_EXPORT
552 #endif
553 
554 #endif // V8_OS_WIN
555 
556 // clang-format on
557 
558 #undef V8_HAS_CPP_ATTRIBUTE
559 
560 #endif // V8CONFIG_H_