Skip to content

Commit

Permalink
src: fix compiler warnings in node_perf.cc
Browse files Browse the repository at this point in the history
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: #15112
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
danbev authored and MylesBorins committed Sep 12, 2017
1 parent aaf55db commit f113d73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void PerformanceEntry::NotifyObservers(Environment* env,
Local<Value> argv = entry->object();
env->performance_entry_callback()->Call(context,
v8::Undefined(isolate),
1, &argv);
1, &argv).ToLocalChecked();
}

void Mark(const FunctionCallbackInfo<Value>& args) {
Expand Down Expand Up @@ -290,7 +290,7 @@ void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
v8::MaybeLocal<Object> instance = ctor->NewInstance(context);
Local<Object> 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);
}
Expand Down Expand Up @@ -373,12 +373,12 @@ void Init(Local<Object> 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);
}
Expand Down

0 comments on commit f113d73

Please sign in to comment.