From 6e85c37405e602d114d1931770fb290a23b096ba Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 31 May 2021 16:17:23 +0200 Subject: [PATCH] test: suppress warning in test_environment.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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. --- test/cctest/test_environment.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index e2931337bf6a40..cdd4d470fd67d5 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -331,8 +331,8 @@ static void at_exit_js(void* arg) { v8::Isolate* isolate = static_cast(arg); v8::HandleScope handle_scope(isolate); v8::Local 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; }