diff --git a/common.gypi b/common.gypi index fb364b55f5e63e..0997ccb2783410 100644 --- a/common.gypi +++ b/common.gypi @@ -26,6 +26,7 @@ 'uv_library%': 'static_library', 'clang%': 0, + 'error_on_warn%': 'false', 'openssl_fips%': '', 'openssl_no_asm%': 0, @@ -218,7 +219,14 @@ # Forcibly disable -Werror. We support a wide range of compilers, it's # simply not feasible to squelch all warnings, never mind that the # libraries in deps/ are not under our control. - 'cflags!': ['-Werror'], + 'conditions': [ + [ 'error_on_warn=="false"', { + 'cflags!': ['-Werror'], + }, '(_target_name!="<(node_lib_target_name)" or ' + '_target_name!="<(node_core_target_name)")', { + 'cflags!': ['-Werror'], + }], + ], 'msvs_settings': { 'VCCLCompilerTool': { 'BufferSecurityCheck': 'true', diff --git a/configure.py b/configure.py index 2e7deb5a15ef11..ac26f62916cd06 100755 --- a/configure.py +++ b/configure.py @@ -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.') + parser.add_option('--gdb', action='store_true', dest='gdb', @@ -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 diff --git a/node.gyp b/node.gyp index c3ffd2ff2147e2..3da3044c7bdc64 100644 --- a/node.gyp +++ b/node.gyp @@ -375,6 +375,9 @@ 'msvs_disabled_warnings!': [4244], 'conditions': [ + [ 'error_on_warn=="true"', { + '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 @@ -749,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)"' ] }], diff --git a/tools/inspector_protocol/lib/Values_cpp.template b/tools/inspector_protocol/lib/Values_cpp.template index 764b4d37d9a7d5..be3149d50356f2 100644 --- a/tools/inspector_protocol/lib/Values_cpp.template +++ b/tools/inspector_protocol/lib/Values_cpp.template @@ -606,7 +606,7 @@ std::unique_ptr DictionaryValue::clone() const DCHECK(value != m_data.cend() && value->second); result->setValue(key, value->second->clone()); } - return std::move(result); + return result; } DictionaryValue::DictionaryValue() @@ -647,7 +647,7 @@ std::unique_ptr ListValue::clone() const std::unique_ptr result = ListValue::create(); for (const std::unique_ptr& value : m_data) result->pushValue(value->clone()); - return std::move(result); + return result; } ListValue::ListValue()