Skip to content

Commit

Permalink
build: add build option suppress_all_error_on_warn
Browse files Browse the repository at this point in the history
Add an option to suppress cases where warnings are on by
default

Signed-off-by: Michael Dawson <[email protected]>
PR-URL: nodejs#56647
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
mhdawson committed Jan 28, 2025
1 parent f2d2747 commit e6f1ddf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

'clang%': 0,
'error_on_warn%': 'false',
'suppress_all_error_on_warn%': 'false',

'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
'openssl_no_asm%': 0,
Expand Down
9 changes: 9 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@
default=None,
help='Turn compiler warnings into errors for node core sources.')

parser.add_argument('--suppress-all-error-on-warn',
action='store_true',
dest='suppress_all_error_on_warn',
default=False,
help='Suppress cases where compiler warnings are turned into errors by default.')

parser.add_argument('--gdb',
action='store_true',
dest='gdb',
Expand Down Expand Up @@ -1397,7 +1403,10 @@ def configure_node(o):
o['variables']['node_use_amaro'] = b(not options.without_amaro)
o['variables']['debug_node'] = b(options.debug_node)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
if options.error_on_warn and options.suppress_all_error_on_warn:
raise Exception('--error_on_warn is incompatible with --suppress_all_error_on_warn.')
o['variables']['error_on_warn'] = b(options.error_on_warn)
o['variables']['suppress_all_error_on_warn'] = b(options.suppress_all_error_on_warn)
o['variables']['use_prefix_to_find_headers'] = b(options.use_prefix_to_find_headers)

host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
Expand Down
5 changes: 3 additions & 2 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,6 @@
'openssl_default_cipher_list%': '',
},

'cflags': ['-Werror=unused-result'],

'defines': [
'NODE_ARCH="<(target_arch)"',
'NODE_PLATFORM="<(OS)"',
Expand All @@ -893,6 +891,9 @@
'NODE_OPENSSL_DEFAULT_CIPHER_LIST="<(openssl_default_cipher_list)"'
]
}],
[ 'suppress_all_error_on_warn=="false"', {
'cflags': ['-Werror=unused-result'],
}],
[ 'error_on_warn=="true"', {
'cflags': ['-Werror'],
'xcode_settings': {
Expand Down

0 comments on commit e6f1ddf

Please sign in to comment.