Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
danbev committed Apr 17, 2020
commit b9fa8f3cade7c45fd8091142b8e55711a369c89d
6 changes: 4 additions & 2 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'uv_library%': 'static_library',

'clang%': 0,
'error_on_warn%': '0',

'openssl_fips%': '',
'openssl_no_asm%': 0,
Expand Down Expand Up @@ -219,8 +220,9 @@
# simply not feasible to squelch all warnings, never mind that the
# libraries in deps/ are not under our control.
'conditions': [
['_target_name!="<(node_lib_target_name)" or '
'_target_name!="<(node_core_target_name)"', {
[ 'error_on_warn=="true" and '
'(_target_name!="<(node_lib_target_name)" or '
'_target_name!="<(node_core_target_name)")', {
'cflags!': ['-Werror'],
}],
],
Comment thread
danbev marked this conversation as resolved.
Expand Down
6 changes: 6 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
choices=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.')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to have this in the Windows vcbuild.bat also.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree. The problem for me is that I don't have a windows testing environment anymore. At least if this got merged we could enable this for pull requests.


parser.add_option('--gdb',
action='store_true',
dest='gdb',
Expand Down Expand Up @@ -1018,6 +1023,7 @@ def configure_node(o):
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['debug_node'] = b(options.debug_node)
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()
target_arch = options.dest_cpu or host_arch
Expand Down
10 changes: 6 additions & 4 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@
'node.gypi'
],

'cflags': [ '-Werror', ],

'include_dirs': [
'src',
'deps/v8/include'
Expand Down Expand Up @@ -377,6 +375,9 @@
'msvs_disabled_warnings!': [4244],

'conditions': [
[ 'error_on_warn=="true"', {
Comment thread
danbev marked this conversation as resolved.
'cflags': ['-Werror'],
}],
[ 'node_intermediate_lib_type=="static_library" and '
'node_shared=="true" and OS=="aix"', {
# For AIX, shared lib is linked by static lib and .exp. In the
Expand Down Expand Up @@ -530,8 +531,6 @@
'node.gypi',
],

'cflags': [ '-Werror', ],

'include_dirs': [
'src',
'<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
Expand Down Expand Up @@ -753,6 +752,9 @@
'msvs_disabled_warnings!': [4244],

'conditions': [
[ 'error_on_warn=="true"', {
'cflags': ['-Werror'],
}],
[ 'node_builtin_modules_path!=""', {
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
}],
Expand Down