Skip to content

Commit f113d73

Browse files
danbevMylesBorins
authored andcommitted
src: fix compiler warnings in node_perf.cc
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]>
1 parent aaf55db commit f113d73

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/node_perf.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void PerformanceEntry::NotifyObservers(Environment* env,
5757
Local<Value> argv = entry->object();
5858
env->performance_entry_callback()->Call(context,
5959
v8::Undefined(isolate),
60-
1, &argv);
60+
1, &argv).ToLocalChecked();
6161
}
6262

6363
void Mark(const FunctionCallbackInfo<Value>& args) {
@@ -290,7 +290,7 @@ void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
290290
v8::MaybeLocal<Object> instance = ctor->NewInstance(context);
291291
Local<Object> obj = instance.ToLocalChecked();
292292
for (idx = 0; idx < count; idx++) {
293-
obj->Set(context, idx, args[idx]);
293+
obj->Set(context, idx, args[idx]).ToChecked();
294294
}
295295
new PerformanceEntry(env, obj, *name, "function", start, end);
296296
}
@@ -373,12 +373,12 @@ void Init(Local<Object> target,
373373
target->DefineOwnProperty(context,
374374
FIXED_ONE_BYTE_STRING(isolate, "timeOrigin"),
375375
v8::Number::New(isolate, timeOrigin / 1e6),
376-
attr);
376+
attr).ToChecked();
377377

378378
target->DefineOwnProperty(context,
379379
env->constants_string(),
380380
constants,
381-
attr);
381+
attr).ToChecked();
382382

383383
SetupGarbageCollectionTracking(isolate);
384384
}

0 commit comments

Comments
 (0)