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 <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
danbev authored and MylesBorins committed Sep 12, 2017

Unverified

The email in this signature doesn’t match the committer email.
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
@@ -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) {
@@ -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);
}
@@ -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);
}

0 comments on commit f113d73

Please sign in to comment.