From c931944c8326f108985d125665efc65289c69c19 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 30 Jun 2025 11:15:36 +0200 Subject: [PATCH 1/4] src: fix -Wunreachable-code in src/node_api.cc --- src/node_api.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_api.cc b/src/node_api.cc index fbe3d84fc20d12..d9b17780f6143f 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1058,8 +1058,7 @@ napi_create_external_buffer(napi_env env, #ifdef V8_ENABLE_SANDBOX return napi_set_last_error(env, napi_no_external_buffers_allowed); -#endif // V8_ENABLE_SANDBOX - +#else v8::Isolate* isolate = env->isolate; // The finalizer object will delete itself after invoking the callback. @@ -1081,6 +1080,7 @@ napi_create_external_buffer(napi_env env, // as it will be deleted when the buffer to which it is associated // is finalized. // coverity[leaked_storage] +#endif // V8_ENABLE_SANDBOX } napi_status NAPI_CDECL napi_create_buffer_copy(napi_env env, From 8a3c0b2d3a149233a0f92e11857523d5b227c804 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 30 Jun 2025 11:21:21 +0200 Subject: [PATCH 2/4] src: fix -Wunreachable-code-return in src/node_contextify.cc --- src/node_contextify.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index c4db3eb076d49b..4e10afeb28598e 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -733,7 +733,6 @@ Intercepted ContextifyContext::PropertyDefinerCallback( // kYes to behave according to the expected semantics. return Intercepted::kNo; } - return Intercepted::kNo; } // static From 22f7cc909aeec2f15e3fd3c89cd96f3c122fe700 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 30 Jun 2025 11:40:40 +0200 Subject: [PATCH 3/4] src: -Wunreachable-code error in crypto_context.cc --- src/crypto/crypto_context.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 1ffce89df5f760..798b4ffb52b1bc 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -77,8 +77,6 @@ static const char* const root_certs[] = { #include "node_root_certs.h" // NOLINT(build/include_order) }; -static const char system_cert_path[] = NODE_OPENSSL_SYSTEM_CERT_PATH; - static std::string extra_root_certs_file; // NOLINT(runtime/string) static std::atomic has_cached_bundled_root_certs{false}; @@ -838,11 +836,13 @@ X509_STORE* NewRootCertStore() { X509_STORE* store = X509_STORE_new(); CHECK_NOT_NULL(store); - if (*system_cert_path != '\0') { +#ifdef NODE_OPENSSL_SYSTEM_CERT_PATH + if constexpr (sizeof(NODE_OPENSSL_SYSTEM_CERT_PATH) > 1) { ERR_set_mark(); - X509_STORE_load_locations(store, system_cert_path, nullptr); + X509_STORE_load_locations(store, NODE_OPENSSL_SYSTEM_CERT_PATH, nullptr); ERR_pop_to_mark(); } +#endif Mutex::ScopedLock cli_lock(node::per_process::cli_options_mutex); if (per_process::cli_options->ssl_openssl_cert_store) { From c6a8fa3b051d21aa086b30df6820d9a2b15dd925 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 30 Jun 2025 11:43:53 +0200 Subject: [PATCH 4/4] src: -Wunreachable-code-break in node_config_file.cc --- src/node_config_file.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node_config_file.cc b/src/node_config_file.cc index 00451cafc5951a..1a19465c728ebc 100644 --- a/src/node_config_file.cc +++ b/src/node_config_file.cc @@ -131,7 +131,6 @@ ParseResult ConfigReader::ProcessOptionValue( "No-op flag %s is currently not supported\n", option_name.c_str()); return ParseResult::InvalidContent; - break; } case options_parser::OptionType::kV8Option: { FPrintF(stderr,