Skip to content

Commit

Permalink
test: suppress warning in test_environment.cc
Browse files Browse the repository at this point in the history
Currently there is a compiler warning generated if a build defines
NDEBUG:

$ env CXXFLAGS='-DNDEBUG' make -j8 cctest
../test/cctest/test_environment.cc:
In function ‘void at_exit_js(void*)’:
../test/cctest/test_environment.cc:333:25: warning:
variable ‘obj’ set but not used [-Wunused-but-set-variable]
  333 |   v8::Local<v8::Object> obj = v8::Object::New(isolate);
      |                         ^~~

NDEBUG is currently not defined using the main branch but this
discovered when working on replacing OpenSSL 1.1.1 with OpenSSL 3.0.

This commit uses EXPECT statements instead of asserts to avoid the
warning.

PR-URL: #38868
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
danbev authored and richardlau committed Jul 20, 2021
1 parent cd3305a commit 660a97b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ static void at_exit_js(void* arg) {
v8::Isolate* isolate = static_cast<v8::Isolate*>(arg);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> obj = v8::Object::New(isolate);
assert(!obj.IsEmpty()); // Assert VM is still alive.
assert(obj->IsObject());
EXPECT_FALSE(obj.IsEmpty()); // Assert VM is still alive.
EXPECT_TRUE(obj->IsObject());
called_at_exit_js = true;
}

Expand Down

0 comments on commit 660a97b

Please sign in to comment.