build: add --error-on-warn configure flag
This commit adds a configuration time flag named error-on-warn: $ ./configure --help | grep -A1 error-on-warn --error-on-warn Turn compiler warnings into errors for node core sources. The motivation for this is that CI jobs can use this flag to turn warnings into errors. PR-URL: https://github.com/nodejs/node/pull/32685 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
This commit is contained in:
parent
8698dd98bb
commit
a7ae7aab59
@ -26,6 +26,7 @@
|
|||||||
'uv_library%': 'static_library',
|
'uv_library%': 'static_library',
|
||||||
|
|
||||||
'clang%': 0,
|
'clang%': 0,
|
||||||
|
'error_on_warn%': 'false',
|
||||||
|
|
||||||
'openssl_fips%': '',
|
'openssl_fips%': '',
|
||||||
'openssl_no_asm%': 0,
|
'openssl_no_asm%': 0,
|
||||||
@ -218,7 +219,14 @@
|
|||||||
# Forcibly disable -Werror. We support a wide range of compilers, it's
|
# Forcibly disable -Werror. We support a wide range of compilers, it's
|
||||||
# simply not feasible to squelch all warnings, never mind that the
|
# simply not feasible to squelch all warnings, never mind that the
|
||||||
# libraries in deps/ are not under our control.
|
# libraries in deps/ are not under our control.
|
||||||
|
'conditions': [
|
||||||
|
[ 'error_on_warn=="false"', {
|
||||||
'cflags!': ['-Werror'],
|
'cflags!': ['-Werror'],
|
||||||
|
}, '(_target_name!="<(node_lib_target_name)" or '
|
||||||
|
'_target_name!="<(node_core_target_name)")', {
|
||||||
|
'cflags!': ['-Werror'],
|
||||||
|
}],
|
||||||
|
],
|
||||||
'msvs_settings': {
|
'msvs_settings': {
|
||||||
'VCCLCompilerTool': {
|
'VCCLCompilerTool': {
|
||||||
'BufferSecurityCheck': 'true',
|
'BufferSecurityCheck': 'true',
|
||||||
|
@ -117,6 +117,11 @@ parser.add_option('--dest-os',
|
|||||||
choices=valid_os,
|
choices=valid_os,
|
||||||
help='operating system to build for ({0})'.format(', '.join(valid_os)))
|
help='operating system to build for ({0})'.format(', '.join(valid_os)))
|
||||||
|
|
||||||
|
parser.add_option('--error-on-warn',
|
||||||
|
action='store_true',
|
||||||
|
dest='error_on_warn',
|
||||||
|
help='Turn compiler warnings into errors for node core sources.')
|
||||||
|
|
||||||
parser.add_option('--gdb',
|
parser.add_option('--gdb',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
dest='gdb',
|
dest='gdb',
|
||||||
@ -1018,6 +1023,7 @@ def configure_node(o):
|
|||||||
o['variables']['node_install_npm'] = b(not options.without_npm)
|
o['variables']['node_install_npm'] = b(not options.without_npm)
|
||||||
o['variables']['debug_node'] = b(options.debug_node)
|
o['variables']['debug_node'] = b(options.debug_node)
|
||||||
o['default_configuration'] = 'Debug' if options.debug else 'Release'
|
o['default_configuration'] = 'Debug' if options.debug else 'Release'
|
||||||
|
o['variables']['error_on_warn'] = b(options.error_on_warn)
|
||||||
|
|
||||||
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
|
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
|
||||||
target_arch = options.dest_cpu or host_arch
|
target_arch = options.dest_cpu or host_arch
|
||||||
|
6
node.gyp
6
node.gyp
@ -376,6 +376,9 @@
|
|||||||
'msvs_disabled_warnings!': [4244],
|
'msvs_disabled_warnings!': [4244],
|
||||||
|
|
||||||
'conditions': [
|
'conditions': [
|
||||||
|
[ 'error_on_warn=="true"', {
|
||||||
|
'cflags': ['-Werror'],
|
||||||
|
}],
|
||||||
[ 'node_intermediate_lib_type=="static_library" and '
|
[ 'node_intermediate_lib_type=="static_library" and '
|
||||||
'node_shared=="true" and OS=="aix"', {
|
'node_shared=="true" and OS=="aix"', {
|
||||||
# For AIX, shared lib is linked by static lib and .exp. In the
|
# For AIX, shared lib is linked by static lib and .exp. In the
|
||||||
@ -750,6 +753,9 @@
|
|||||||
'msvs_disabled_warnings!': [4244],
|
'msvs_disabled_warnings!': [4244],
|
||||||
|
|
||||||
'conditions': [
|
'conditions': [
|
||||||
|
[ 'error_on_warn=="true"', {
|
||||||
|
'cflags': ['-Werror'],
|
||||||
|
}],
|
||||||
[ 'node_builtin_modules_path!=""', {
|
[ 'node_builtin_modules_path!=""', {
|
||||||
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
|
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
|
||||||
}],
|
}],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user