diff --git a/common.gypi b/common.gypi index a6a79adcc2fb4f..ad69e7151b3eb1 100644 --- a/common.gypi +++ b/common.gypi @@ -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, diff --git a/configure.py b/configure.py index 618117370238f7..0ac04c914fe83b 100755 --- a/configure.py +++ b/configure.py @@ -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', @@ -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() diff --git a/node.gyp b/node.gyp index 1633ed2d832fc5..7dcde96cacc473 100644 --- a/node.gyp +++ b/node.gyp @@ -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': {