Files
MINGW-packages/mingw-w64-nodejs/0201-v8-buildflags-fixes.patch
2024-01-13 14:51:57 +08:00

107 lines
3.2 KiB
Diff

diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index 7e1e4b83..5607512d 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -1381,18 +1381,22 @@ config("toolchain") {
if (v8_current_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
- if (is_win) {
+ if (is_msvc) {
# Ensure no surprising artifacts from 80bit double math with x86.
cflags += [ "/arch:SSE2" ]
+ } else {
+ cflags += [ "-msse2" ]
}
}
if (v8_current_cpu == "x64") {
defines += [ "V8_TARGET_ARCH_X64" ]
- if (is_win) {
+ if (is_msvc) {
# Increase the initial stack size. The default is 1MB, this is 2MB. This
# applies only to executables and shared libraries produced by V8 since
# ldflags are not pushed to dependants.
ldflags += [ "/STACK:2097152" ]
+ } else {
+ ldflags += [ "-Wl,--stack,2097152" ]
}
}
if (is_android && v8_android_log_stdout) {
@@ -1450,7 +1454,7 @@ config("toolchain") {
}
if (v8_no_inline) {
- if (is_win) {
+ if (is_msvc) {
cflags += [ "/Ob0" ]
} else {
cflags += [
@@ -1483,7 +1487,7 @@ config("toolchain") {
}
}
- if (is_clang || !is_win) {
+ if (is_clang || !is_msvc) {
cflags += [
# On clang and gcc, disable warnings about offsetof being used on
# non-standard-layout types. offsetof is only specified for
@@ -1491,10 +1495,13 @@ config("toolchain") {
# implementation defined (rather than UB), and our supported compilers
# have the expected reasonable behaviour.
"-Wno-invalid-offsetof",
+
+ # Disable warnings on unused variables
+ "-Wno-unused-variable",
]
}
- if (is_win) {
+ if (is_msvc) {
cflags += [
"/wd4245", # Conversion with signed/unsigned mismatch.
"/wd4267", # Conversion with possible loss of data.
@@ -1516,7 +1523,7 @@ config("toolchain") {
]
}
- if (!is_clang && is_win) {
+ if (!is_clang && is_msvc) {
cflags += [
"/wd4506", # Benign "no definition for inline function"
@@ -1657,7 +1664,7 @@ config("toolchain") {
]
}
- if (!is_clang && !is_win) {
+ if (!is_clang && !is_msvc) {
cflags += [
# Disable gcc warnings for optimizations based on the assumption that
# signed overflow does not occur. Generates false positives (see
@@ -1676,6 +1683,10 @@ config("toolchain") {
# of `this` in capture-by-value lambdas and preventing a build roll which
# enables C++20 (see https://crbug.com/1374227).
"-Wno-deprecated",
+
+ # Disable gcc warnings for calls to string manipulation functions that are
+ # determined to overflow the destination buffer.
+ "-Wno-stringop-overflow",
]
}
diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi
index b311c04d..1a7f3bb4 100644
--- a/tools/v8_gypfiles/toolchain.gypi
+++ b/tools/v8_gypfiles/toolchain.gypi
@@ -140,8 +140,8 @@
'cflags!': [ '-Wall', '-Wextra' ],
'cflags': [ '-Wno-return-type' ],
}],
- ['clang or OS!="win"', {
- 'cflags': [ '-Wno-invalid-offsetof' ],
+ ['clang or OS!="msvc"', {
+ 'cflags_cc': [ '-Wno-invalid-offsetof' ],
'xcode_settings': {
'WARNING_CFLAGS': ['-Wno-invalid-offsetof']
},