◐ Shell
clean mode source ↗

quic: fixup NO_ERROR macro conflict on windows · nodejs/node@6553202

Original file line numberDiff line numberDiff line change

@@ -386,6 +386,8 @@ const QuicError QuicError::FromConnectionClose(ngtcp2_conn* session) {

386386

QUIC_TRANSPORT_ERRORS(V)

387387

#undef V

388388
389+

const QuicError QuicError::TRANSPORT_NO_ERROR =

390+

ForTransport(TransportError::NO_ERROR_);

389391

const QuicError QuicError::HTTP3_NO_ERROR = ForApplication(NGHTTP3_H3_NO_ERROR);

390392

const QuicError QuicError::VERSION_NEGOTIATION = ForVersionNegotiation();

391393

const QuicError QuicError::IDLE_CLOSE = ForIdleClose();

Original file line numberDiff line numberDiff line change

@@ -108,7 +108,6 @@ class Store final : public MemoryRetainer {

108108
109109

// Periodically, these need to be updated to match the latest ngtcp2 defs.

110110

#define QUIC_TRANSPORT_ERRORS(V) \

111-

V(NO_ERROR) \

112111

V(INTERNAL_ERROR) \

113112

V(CONNECTION_REFUSED) \

114113

V(FLOW_CONTROL_ERROR) \

@@ -155,6 +154,10 @@ class QuicError final : public MemoryRetainer {

155154

public:

156155

// The known error codes for the transport namespace.

157156

enum class TransportError : error_code {

157+

// NO_ERROR has to be treated specially since it is a macro on

158+

// some Windows cases and results in a compile error if we leave

159+

// it as is.

160+

NO_ERROR_ = NGTCP2_NO_ERROR,

158161

#define V(name) name = NGTCP2_##name,

159162

QUIC_TRANSPORT_ERRORS(V)

160163

#undef V

@@ -273,6 +276,7 @@ class QuicError final : public MemoryRetainer {

273276
274277

static const QuicError FromConnectionClose(ngtcp2_conn* session);

275278
279+

static const QuicError TRANSPORT_NO_ERROR;

276280

#define V(name) static const QuicError TRANSPORT_##name;

277281

QUIC_TRANSPORT_ERRORS(V)

278282

#undef V

Original file line numberDiff line numberDiff line change

@@ -16,7 +16,7 @@ TEST(QuicError, NoError) {

1616

CHECK_EQ(err.reason(), "");

1717

CHECK_EQ(err, QuicError::TRANSPORT_NO_ERROR);

1818
19-

CHECK_EQ(QuicError::TransportError::NO_ERROR, QuicError::QUIC_NO_ERROR);

19+

CHECK_EQ(QuicError::TransportError::NO_ERROR_, QuicError::QUIC_NO_ERROR);

2020

CHECK_EQ(QuicError::Http3Error::H3_NO_ERROR, QuicError::HTTP3_NO_ERROR_CODE);

2121
2222

QuicError err2("a reason");