From 660a97b1d599d75783cbce4a087e5ce78b425f36 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. PR-URL: /~https://github.com/nodejs/node/pull/38868 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Darshan Sen --- 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 fd4adf17c83ac9..13316ceccb4d8a 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -341,8 +341,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; }