Skip to content

Commit 65a3b5f

Browse files
mhdawsonaduh95
authored andcommitted
build: add build option suppress_all_error_on_warn
Add an option to suppress cases where warnings are on by default Signed-off-by: Michael Dawson <midawson@redhat.com> PR-URL: #56647 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 5470cab commit 65a3b5f

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

common.gypi

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
'clang%': 0,
2929
'error_on_warn%': 'false',
30+
'suppress_all_error_on_warn%': 'false',
3031

3132
'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
3233
'openssl_no_asm%': 0,

configure.py

+9
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@
148148
default=None,
149149
help='Turn compiler warnings into errors for node core sources.')
150150

151+
parser.add_argument('--suppress-all-error-on-warn',
152+
action='store_true',
153+
dest='suppress_all_error_on_warn',
154+
default=False,
155+
help='Suppress cases where compiler warnings are turned into errors by default.')
156+
151157
parser.add_argument('--gdb',
152158
action='store_true',
153159
dest='gdb',
@@ -1395,7 +1401,10 @@ def configure_node(o):
13951401
o['variables']['node_use_amaro'] = b(not options.without_amaro)
13961402
o['variables']['debug_node'] = b(options.debug_node)
13971403
o['default_configuration'] = 'Debug' if options.debug else 'Release'
1404+
if options.error_on_warn and options.suppress_all_error_on_warn:
1405+
raise Exception('--error_on_warn is incompatible with --suppress_all_error_on_warn.')
13981406
o['variables']['error_on_warn'] = b(options.error_on_warn)
1407+
o['variables']['suppress_all_error_on_warn'] = b(options.suppress_all_error_on_warn)
13991408
o['variables']['use_prefix_to_find_headers'] = b(options.use_prefix_to_find_headers)
14001409

14011410
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()

node.gyp

+3-2
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,6 @@
880880
'openssl_default_cipher_list%': '',
881881
},
882882

883-
'cflags': ['-Werror=unused-result'],
884-
885883
'defines': [
886884
'NODE_ARCH="<(target_arch)"',
887885
'NODE_PLATFORM="<(OS)"',
@@ -902,6 +900,9 @@
902900
'NODE_OPENSSL_DEFAULT_CIPHER_LIST="<(openssl_default_cipher_list)"'
903901
]
904902
}],
903+
[ 'suppress_all_error_on_warn=="false"', {
904+
'cflags': ['-Werror=unused-result'],
905+
}],
905906
[ 'error_on_warn=="true"', {
906907
'cflags': ['-Werror'],
907908
'xcode_settings': {

0 commit comments

Comments
 (0)