Commit 37a0b0dd933 for nodejs
commit 37a0b0dd9338d53d01f0e7eb0826cd983fa924e1
Author: Antoine du Hamel <duhamelantoine1995@gmail.com>
Date: Wed Sep 30 09:39:34 2026 +0200
src: remove `HAVE_QUIC` macro in favor of `OPENSSL_NO_QUIC`
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66373
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
diff --git a/node.gyp b/node.gyp
index b1504efb010..c9db6bcf28c 100644
--- a/node.gyp
+++ b/node.gyp
@@ -1413,11 +1413,7 @@
}, {
'sources!': [ '<@(node_cctest_openssl_sources)' ],
}],
- [ 'node_use_quic=="true"', {
- 'defines': [
- 'HAVE_QUIC=1',
- ],
- }, {
+ [ 'node_use_quic!="true"', {
'sources!': [ '<@(node_cctest_quic_sources)' ],
}],
[ 'v8_use_perfetto==1 and node_shared_perfetto=="false"', {
diff --git a/node.gypi b/node.gypi
index b382784e610..9eb972adc47 100644
--- a/node.gypi
+++ b/node.gypi
@@ -471,7 +471,6 @@
'defines': [ 'NODE_SHARED_FFI=0' ]
}],
[ 'node_use_quic=="true"', {
- 'defines': [ 'HAVE_QUIC=1' ],
'conditions': [
[ 'node_shared_openssl=="false"', {
'dependencies': [
@@ -484,8 +483,6 @@
],
}],
],
- }, {
- 'defines': [ 'HAVE_QUIC=0' ]
}],
],
}
diff --git a/src/node_metadata.cc b/src/node_metadata.cc
index b117481da48..0f3a76105a1 100644
--- a/src/node_metadata.cc
+++ b/src/node_metadata.cc
@@ -42,7 +42,7 @@
#ifndef OPENSSL_NO_QUIC
#include <ngtcp2/version.h>
#include <nghttp3/version.h>
-#endif
+#endif // OPENSSL_NO_QUIC
#ifdef NODE_HAVE_I18N_SUPPORT
#include <unicode/timezone.h>
@@ -165,7 +165,7 @@ Metadata::Versions::Versions() {
#ifndef OPENSSL_NO_QUIC
ngtcp2 = NGTCP2_VERSION;
nghttp3 = NGHTTP3_VERSION;
-#endif
+#endif // OPENSSL_NO_QUIC
simdjson = SIMDJSON_VERSION;
simdutf = SIMDUTF_VERSION;
diff --git a/src/quic/application.cc b/src/quic/application.cc
index 6f25c3771a7..212a9984d1a 100644
--- a/src/quic/application.cc
+++ b/src/quic/application.cc
@@ -1,5 +1,3 @@
-#include "util.h"
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <async_wrap-inl.h>
@@ -16,6 +14,7 @@
#include "http3.h"
#include "packet.h"
#include "session.h"
+#include "util.h"
namespace node {
@@ -460,4 +459,3 @@ std::unique_ptr<Session::Application> CreateDefaultApplication(
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/bindingdata.cc b/src/quic/bindingdata.cc
index e73ae82e980..391172c5979 100644
--- a/src/quic/bindingdata.cc
+++ b/src/quic/bindingdata.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <async_wrap-inl.h>
@@ -571,4 +570,3 @@ JS_METHOD_IMPL(IllegalConstructor) {
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/cid.cc b/src/quic/cid.cc
index 2238ab17f83..64c8d18a42f 100644
--- a/src/quic/cid.cc
+++ b/src/quic/cid.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <crypto/crypto_util.h>
@@ -147,4 +146,3 @@ const CID::Factory& CID::Factory::random() {
} // namespace node::quic
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/data.cc b/src/quic/data.cc
index 9599adec62f..fd4c3253432 100644
--- a/src/quic/data.cc
+++ b/src/quic/data.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -554,4 +553,3 @@ const QuicError QuicError::INTERNAL_ERROR = ForNgtcp2Error(NGTCP2_ERR_INTERNAL);
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/endpoint.cc b/src/quic/endpoint.cc
index 8a92986c5a9..13ca955fa2a 100644
--- a/src/quic/endpoint.cc
+++ b/src/quic/endpoint.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <aliased_struct-inl.h>
@@ -2200,4 +2199,3 @@ JS_METHOD_IMPL(Endpoint::DoSetSNIContexts) {
} // namespace quic
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/http3.cc b/src/quic/http3.cc
index fb48bd3e003..ad0d6e383fe 100644
--- a/src/quic/http3.cc
+++ b/src/quic/http3.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <async_wrap-inl.h>
@@ -1533,4 +1532,3 @@ std::unique_ptr<Session::Application> CreateHttp3Application(
} // namespace quic
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/packet.cc b/src/quic/packet.cc
index 71a817e49ed..a1ab4c7090e 100644
--- a/src/quic/packet.cc
+++ b/src/quic/packet.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <crypto/crypto_util.h>
@@ -231,4 +230,3 @@ Packet::Ptr Packet::CreateVersionNegotiationPacket(
} // namespace node::quic
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/preferredaddress.cc b/src/quic/preferredaddress.cc
index 7ce27798a63..9430ffc0fd8 100644
--- a/src/quic/preferredaddress.cc
+++ b/src/quic/preferredaddress.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -155,4 +154,3 @@ const CID PreferredAddress::cid() const {
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/quic.cc b/src/quic/quic.cc
index 36e781f1d70..9ed44cb5667 100644
--- a/src/quic/quic.cc
+++ b/src/quic/quic.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
@@ -67,4 +66,3 @@ NODE_BINDING_PER_ISOLATE_INIT(quic, node::quic::CreatePerIsolateProperties)
NODE_BINDING_EXTERNAL_REFERENCE(quic, node::quic::RegisterExternalReferences)
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/session.cc b/src/quic/session.cc
index 90d59487a2a..d83c1cbb89d 100644
--- a/src/quic/session.cc
+++ b/src/quic/session.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <aliased_struct-inl.h>
@@ -4492,4 +4491,3 @@ void Session::InitPerContext(Realm* realm, Local<Object> target) {
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/session_manager.cc b/src/quic/session_manager.cc
index 20f92bb74bb..a6977d53ba1 100644
--- a/src/quic/session_manager.cc
+++ b/src/quic/session_manager.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <base_object-inl.h>
@@ -163,4 +162,3 @@ bool SessionManager::is_empty() const {
} // namespace node::quic
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/sessionticket.cc b/src/quic/sessionticket.cc
index 5d9c4104cff..acb27251000 100644
--- a/src/quic/sessionticket.cc
+++ b/src/quic/sessionticket.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -190,4 +189,3 @@ SessionTicket::AppData::Status SessionTicket::AppData::Extract(
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/streams.cc b/src/quic/streams.cc
index aae72740f87..1354ad54c47 100644
--- a/src/quic/streams.cc
+++ b/src/quic/streams.cc
@@ -1,5 +1,3 @@
-#include "ngtcp2/ngtcp2.h"
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <aliased_struct-inl.h>
@@ -14,6 +12,7 @@
#include "application.h"
#include "bindingdata.h"
#include "defs.h"
+#include "ngtcp2/ngtcp2.h"
#include "session.h"
#include "streams.h"
@@ -1916,4 +1915,3 @@ void Stream::Unschedule() {
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/tlscontext.cc b/src/quic/tlscontext.cc
index e68380fd042..b5106d27e12 100644
--- a/src/quic/tlscontext.cc
+++ b/src/quic/tlscontext.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <async_wrap-inl.h>
@@ -1074,4 +1073,3 @@ void TLSSession::MemoryInfo(MemoryTracker* tracker) const {
} // namespace quic
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/tokens.cc b/src/quic/tokens.cc
index f9a429cef66..f04aa64489d 100644
--- a/src/quic/tokens.cc
+++ b/src/quic/tokens.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <crypto/crypto_util.h>
@@ -322,4 +321,3 @@ RegularToken::operator const char*() const {
} // namespace node::quic
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/src/quic/transportparams.cc b/src/quic/transportparams.cc
index b49e527b038..3d2e333b32c 100644
--- a/src/quic/transportparams.cc
+++ b/src/quic/transportparams.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "guard.h"
#ifndef OPENSSL_NO_QUIC
#include <async_wrap-inl.h>
@@ -529,4 +528,3 @@ void TransportParams::Initialize(Environment* env, Local<Object> target) {
} // namespace node
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/test/cctest/test_quic_arena.cc b/test/cctest/test_quic_arena.cc
index d301bc58cf2..3c45c8a8962 100644
--- a/test/cctest/test_quic_arena.cc
+++ b/test/cctest/test_quic_arena.cc
@@ -1,4 +1,5 @@
-#if HAVE_OPENSSL && HAVE_QUIC
+#include "quic/guard.h"
+#ifndef OPENSSL_NO_QUIC
#include <gtest/gtest.h>
#include <quic/arena.h>
#include <cstdint>
@@ -229,4 +230,4 @@ TEST(QuicArenaPool, MultipleAcquireReleaseChurn) {
} // namespace
} // namespace node::quic
-#endif // HAVE_OPENSSL && HAVE_QUIC
+#endif // OPENSSL_NO_QUIC
diff --git a/test/cctest/test_quic_cid.cc b/test/cctest/test_quic_cid.cc
index 8513a25db9d..91fdde8d023 100644
--- a/test/cctest/test_quic_cid.cc
+++ b/test/cctest/test_quic_cid.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "quic/guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -117,4 +116,3 @@ TEST(CID, Basic) {
}
}
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/test/cctest/test_quic_error.cc b/test/cctest/test_quic_error.cc
index 6c7e394ea5e..4ff3ca01cde 100644
--- a/test/cctest/test_quic_error.cc
+++ b/test/cctest/test_quic_error.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "quic/guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -126,4 +125,3 @@ TEST(QuicError, TlsAlert) {
}
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/test/cctest/test_quic_preferredaddress.cc b/test/cctest/test_quic_preferredaddress.cc
index a1a1ad2ed00..4627d78aac1 100644
--- a/test/cctest/test_quic_preferredaddress.cc
+++ b/test/cctest/test_quic_preferredaddress.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "quic/guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -81,4 +80,3 @@ TEST(PreferredAddress, SetTransportParams) {
CHECK_EQ(std::string(ipv4_2.host), "123.123.123.123");
}
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/test/cctest/test_quic_tokenbucket.cc b/test/cctest/test_quic_tokenbucket.cc
index 5c5ef5b3cbc..41310f67fb2 100644
--- a/test/cctest/test_quic_tokenbucket.cc
+++ b/test/cctest/test_quic_tokenbucket.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "quic/guard.h"
#ifndef OPENSSL_NO_QUIC
#include <env-inl.h>
@@ -122,4 +121,3 @@ TEST(QuicTokenBucket, GradualRefill) {
} // namespace node::quic
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC
diff --git a/test/cctest/test_quic_tokens.cc b/test/cctest/test_quic_tokens.cc
index f24e0fc50df..e2079467ee3 100644
--- a/test/cctest/test_quic_tokens.cc
+++ b/test/cctest/test_quic_tokens.cc
@@ -1,4 +1,3 @@
-#if HAVE_OPENSSL && HAVE_QUIC
#include "quic/guard.h"
#ifndef OPENSSL_NO_QUIC
#include <gtest/gtest.h>
@@ -246,4 +245,3 @@ TEST(RegularToken, Basic) {
CHECK(!token.Validate(NGTCP2_PROTO_VER_MAX, address, secret, 10000000000));
}
#endif // OPENSSL_NO_QUIC
-#endif // HAVE_OPENSSL && HAVE_QUIC