mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
deps: V8: cherry-pick 00508c374a45
Original commit message:
Add V8_HAS_WARNING for portable warning checks
GCC does not provide the function-like __has_warning macro. Invoking it
in a compound preprocessor condition causes a preprocessing error even
when __clang__ is false.
Add V8_HAS_WARNING to v8config.h, following existing feature-detection
helpers. Use it for warning guards in base/macros.h. Compilers without
__has_warning now use the fallback value of zero.
Change-Id: I41d10799fd6f73a8bacbd3648aa0bb792d6b80cd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8385383
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@google.com>
Cr-Commit-Position: refs/heads/main@{#109976}
Refs: https://github.com/v8/v8/commit/00508c374a45e53e20e48cb103d512befed8cc43
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66537
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
1 parent
801d1c7a39
commit
a9cc80dd34
3 files changed
+12
-7
No files matched your search
+1
-1
@@ -44,7 +44,7 @@
|
||||
|
||||
# Reset this number to 0 on major V8 upgrades.
|
||||
# Increment by one for each non-official patch applied to deps/v8.
|
||||
'v8_embedder_string': '-node.7',
|
||||
'v8_embedder_string': '-node.8',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
||||
Vendored
+7
@@ -354,6 +354,7 @@ path. Add it with -I<path> to the command line
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
// V8_HAS_WARNING(WARNING) - whether WARNING is supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
// not #ifdef. For example, to test for Intel C++ Compiler, use:
|
||||
@@ -367,6 +368,12 @@ path. Add it with -I<path> to the command line
|
||||
#define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
|
||||
#endif
|
||||
|
||||
#if defined(__has_warning)
|
||||
#define V8_HAS_WARNING(WARNING) __has_warning(WARNING)
|
||||
#else
|
||||
#define V8_HAS_WARNING(WARNING) 0
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if defined(__GNUC__) // Clang in gcc mode.
|
||||
|
||||
Vendored
+4
-6
@@ -668,8 +668,7 @@ static_assert(V8_ENABLE_SIMD128);
|
||||
#endif // defined(__clang__)
|
||||
|
||||
// Disable/enable -Wlifetime-safety warnings in code.
|
||||
#if defined(__clang__) && defined(__has_warning) && \
|
||||
__has_warning("-Wlifetime-safety")
|
||||
#if V8_HAS_WARNING("-Wlifetime-safety")
|
||||
#define START_IGNORE_LIFETIME_SAFETY_WARNINGS() \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wlifetime-safety\"")
|
||||
@@ -677,11 +676,10 @@ static_assert(V8_ENABLE_SIMD128);
|
||||
#else
|
||||
#define START_IGNORE_LIFETIME_SAFETY_WARNINGS()
|
||||
#define END_IGNORE_LIFETIME_SAFETY_WARNINGS()
|
||||
#endif // defined(__clang__)
|
||||
#endif // V8_HAS_WARNING("-Wlifetime-safety")
|
||||
|
||||
// Disable/enable -Wreturn-stack-address warnings in code.
|
||||
#if defined(__clang__) && defined(__has_warning) && \
|
||||
__has_warning("-Wreturn-stack-address")
|
||||
#if V8_HAS_WARNING("-Wreturn-stack-address")
|
||||
#define START_IGNORE_RETURN_STACK_ADDRESS_WARNINGS() \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"")
|
||||
@@ -690,6 +688,6 @@ static_assert(V8_ENABLE_SIMD128);
|
||||
#else
|
||||
#define START_IGNORE_RETURN_STACK_ADDRESS_WARNINGS()
|
||||
#define END_IGNORE_RETURN_STACK_ADDRESS_WARNINGS()
|
||||
#endif // defined(__clang__)
|
||||
#endif // V8_HAS_WARNING("-Wreturn-stack-address")
|
||||
|
||||
#endif // V8_BASE_MACROS_H_
|
||||
Reference in new issue
Block a user