From f113d7332f1b7293ab64eea89721e61e2789f88e Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 31 Aug 2017 10:00:24 +0200 Subject: [PATCH] src: fix compiler warnings in node_perf.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, there are a few compiler warnings generated from node_perf.cc regarding unused return values: ../src/node_perf.cc:58:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] env->performance_entry_callback()->Call(context, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ ../src/node_perf.cc:293:5: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] obj->Set(context, idx, args[idx]); ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ../src/node_perf.cc:373:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] target->DefineOwnProperty(context, ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ ../src/node_perf.cc:378:3: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] target->DefineOwnProperty(context, ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ This commit add checks/casts to avoid the warnings. PR-URL: https://github.com/nodejs/node/pull/15112 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Tobias Nießen Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/node_perf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node_perf.cc b/src/node_perf.cc index a708877d5de46b..48917d5d4ea971 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -57,7 +57,7 @@ void PerformanceEntry::NotifyObservers(Environment* env, Local argv = entry->object(); env->performance_entry_callback()->Call(context, v8::Undefined(isolate), - 1, &argv); + 1, &argv).ToLocalChecked(); } void Mark(const FunctionCallbackInfo& args) { @@ -290,7 +290,7 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { v8::MaybeLocal instance = ctor->NewInstance(context); Local obj = instance.ToLocalChecked(); for (idx = 0; idx < count; idx++) { - obj->Set(context, idx, args[idx]); + obj->Set(context, idx, args[idx]).ToChecked(); } new PerformanceEntry(env, obj, *name, "function", start, end); } @@ -373,12 +373,12 @@ void Init(Local target, target->DefineOwnProperty(context, FIXED_ONE_BYTE_STRING(isolate, "timeOrigin"), v8::Number::New(isolate, timeOrigin / 1e6), - attr); + attr).ToChecked(); target->DefineOwnProperty(context, env->constants_string(), constants, - attr); + attr).ToChecked(); SetupGarbageCollectionTracking(isolate); }