Skip to content

Commit daeb7db

Browse files
committed
build: sync V8 warning cflags with BUILD.gn
PR-URL: #52873 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent eed9674 commit daeb7db

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

common.gypi

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
'configuring_node%': 0,
44
'asan%': 0,
55
'ubsan%': 0,
6-
'werror': '', # Turn off -Werror in V8 build.
76
'visibility%': 'hidden', # V8's visibility setting
87
'target_arch%': 'ia32', # set v8's target architecture
98
'host_arch%': 'ia32', # set v8's host architecture

tools/v8_gypfiles/toolchain.gypi

+18-10
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
'v8_toolset_for_shell%': 'target',
8383

8484
'host_os%': '<(OS)',
85-
'werror%': '-Werror',
8685
# For a shared library build, results in "libv8-<(soname_version).so".
8786
'soname_version%': '',
8887

@@ -133,21 +132,33 @@
133132
'<(V8_ROOT)',
134133
'<(V8_ROOT)/include',
135134
],
135+
'cflags!': ['-Wall', '-Wextra'],
136136
'conditions': [
137-
['clang==1', {
138-
'cflags': [ '-Werror', '-Wno-unknown-pragmas' ],
139-
},{
140-
'cflags!': [ '-Wall', '-Wextra' ],
137+
['clang==0 and OS!="win"', {
141138
'cflags': [
139+
# In deps/v8/BUILD.gn: if (!is_clang && !is_win) { cflags += [...] }
140+
'-Wno-strict-overflow',
142141
'-Wno-return-type',
142+
'-Wno-int-in-bool-context',
143+
'-Wno-deprecated',
144+
'-Wno-stringop-overflow',
145+
'-Wno-stringop-overread',
146+
'-Wno-restrict',
147+
'-Wno-array-bounds',
148+
'-Wno-nonnull',
149+
'-Wno-dangling-pointer',
143150
# On by default in Clang and V8 requires it at least for arm64.
144151
'-flax-vector-conversions',
145152
],
146153
}],
147154
['clang==1 or OS!="win"', {
148-
'cflags': [ '-Wno-invalid-offsetof' ],
155+
'cflags_cc': [
156+
# In deps/v8/BUILD.gn: if (is_clang || !is_win) { cflags += [...] }
157+
'-Wno-invalid-offsetof',
158+
],
149159
'xcode_settings': {
150-
'WARNING_CFLAGS': ['-Wno-invalid-offsetof']
160+
# -Wno-invalid-offsetof
161+
'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO',
151162
},
152163
}],
153164
['v8_target_arch=="arm"', {
@@ -434,9 +445,6 @@
434445
['_toolset=="target"', {
435446
'conditions': [
436447
['v8_target_arch==target_arch', {
437-
'cflags': [
438-
'-Wno-error=array-bounds', # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
439-
],
440448
'conditions': [
441449
['v8_target_arch=="mips64el"', {
442450
'cflags': ['-EL'],

tools/v8_gypfiles/v8.gyp

-6
Original file line numberDiff line numberDiff line change
@@ -2132,12 +2132,6 @@
21322132
]
21332133
}],
21342134
],
2135-
# -Wno-invalid-offsetof flag is not valid for C.
2136-
# The flag is initially set in `toolchain.gypi` for all targets.
2137-
'cflags!': [ '-Wno-invalid-offsetof' ],
2138-
'xcode_settings': {
2139-
'WARNING_CFLAGS!': ['-Wno-invalid-offsetof']
2140-
},
21412135
'direct_dependent_settings': {
21422136
'include_dirs': [
21432137
'<(V8_ROOT)/third_party/zlib',

0 commit comments

Comments
 (0)