build: add build option suppress_all_error_on_warn
Some checks are pending
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` that lacks metadata (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run

Add an option to suppress cases where warnings are on by
default

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/56647
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Michael Dawson 2025-01-17 19:54:00 +00:00
parent f2d274753a
commit e6f1ddf33f
3 changed files with 13 additions and 2 deletions

View File

@ -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,

View File

@ -149,6 +149,12 @@ parser.add_argument('--error-on-warn',
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',
@ -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()

View File

@ -871,8 +871,6 @@
'openssl_default_cipher_list%': '',
},
'cflags': ['-Werror=unused-result'],
'defines': [
'NODE_ARCH="<(target_arch)"',
'NODE_PLATFORM="<(OS)"',
@ -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': {