From c9b6d95161e996245e424e428e5c350d4ce52948 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 3 Jul 2017 12:07:16 +0200 Subject: [PATCH 1/2] n-api: use Maybe version of Object::SetPrototype() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following deprecation warning: ../src/node_api.cc:2020:30: warning: 'bool v8::Object::SetPrototype(v8::Local)' is deprecated: Use maybe version [-Wdeprecated-declarations] wrapper->SetPrototype(proto); ../src/node_api.cc:2021:28: warning: 'bool v8::Object::SetPrototype(v8::Local)' is deprecated: Use maybe version [-Wdeprecated-declarations] obj->SetPrototype(wrapper); PR-URL: https://github.com/nodejs/node/pull/14053 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Franziska Hinkelmann Reviewed-By: Michaël Zasso --- src/node_api.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_api.cc b/src/node_api.cc index ae950bb4bfe34d..485eefa9446c43 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -2017,8 +2017,8 @@ napi_status napi_wrap(napi_env env, // Insert the wrapper into the object's prototype chain. v8::Local proto = obj->GetPrototype(); - wrapper->SetPrototype(proto); - obj->SetPrototype(wrapper); + CHECK(wrapper->SetPrototype(context, proto).FromJust()); + CHECK(obj->SetPrototype(context, wrapper).FromJust()); if (result != nullptr) { // The returned reference should be deleted via napi_delete_reference() From e36917bdc159326665d1e8d14703596780ba0c3a Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 3 Jul 2017 12:11:35 +0200 Subject: [PATCH 2/2] n-api: fix -Wmaybe-uninitialized compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not an actual bug, as far as I can tell, the compiler is simply not smart enough to figure out that the offending code path isn't reached with an uninitialized value. PR-URL: https://github.com/nodejs/node/pull/14053 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Franziska Hinkelmann Reviewed-By: Michaël Zasso --- src/node_api.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_api.cc b/src/node_api.cc index 485eefa9446c43..6c2e70adbaf71e 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -2323,7 +2323,7 @@ napi_status napi_instanceof(napi_env env, } if (env->has_instance_available) { - napi_value value, js_result, has_instance = nullptr; + napi_value value, js_result = nullptr, has_instance = nullptr; napi_status status = napi_generic_failure; napi_valuetype value_type;