From 6634dc4d0cd062a9e9b40c75ff2a5f82dc0990c9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 13 Dec 2017 14:51:33 +0100 Subject: [PATCH] src: fix -Wundefined-inline warnings Fix compiler warnings introduced in commit 47edfd9c3c ("crypto: move node_crypto_clienthello-inl.h to cc") by moving constructors around. They were defined inline but depended on definitions from `node_crypto_clienthello-inl.h`. PR-URL: https://github.com/nodejs/node/pull/17649 Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell Reviewed-By: Timothy Gu Reviewed-By: Eugene Ostroukhov Reviewed-By: Michael Dawson --- src/node_crypto.cc | 18 ++++++++++++++++++ src/node_crypto.h | 14 +------------- src/node_crypto_clienthello-inl.h | 15 +++++++++++++++ src/node_crypto_clienthello.h | 14 +------------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 80e8d4a81628a5..f6d4409fc80e97 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2856,6 +2856,24 @@ int SSLWrap::SetCACerts(SecureContext* sc) { } +Connection::Connection(Environment* env, + v8::Local wrap, + SecureContext* sc, + SSLWrap::Kind kind) + : AsyncWrap(env, wrap, AsyncWrap::PROVIDER_SSLCONNECTION), + SSLWrap(env, sc, kind), + bio_read_(nullptr), + bio_write_(nullptr), + hello_offset_(0) { + MakeWeak(this); + Wrap(wrap, this); + hello_parser_.Start(SSLWrap::OnClientHello, + OnClientHelloParseEnd, + this); + enable_session_callbacks(); +} + + void Connection::OnClientHelloParseEnd(void* arg) { Connection* conn = static_cast(arg); diff --git a/src/node_crypto.h b/src/node_crypto.h index 636cbb99d4dde6..463be5f0727000 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -432,19 +432,7 @@ class Connection : public AsyncWrap, public SSLWrap { Connection(Environment* env, v8::Local wrap, SecureContext* sc, - SSLWrap::Kind kind) - : AsyncWrap(env, wrap, AsyncWrap::PROVIDER_SSLCONNECTION), - SSLWrap(env, sc, kind), - bio_read_(nullptr), - bio_write_(nullptr), - hello_offset_(0) { - MakeWeak(this); - Wrap(wrap, this); - hello_parser_.Start(SSLWrap::OnClientHello, - OnClientHelloParseEnd, - this); - enable_session_callbacks(); - } + SSLWrap::Kind kind); private: static void SSLInfoCallback(const SSL *ssl, int where, int ret); diff --git a/src/node_crypto_clienthello-inl.h b/src/node_crypto_clienthello-inl.h index 019d7188de6cf3..5aff1816b2f73e 100644 --- a/src/node_crypto_clienthello-inl.h +++ b/src/node_crypto_clienthello-inl.h @@ -30,6 +30,21 @@ namespace node { namespace crypto { +inline ClientHelloParser::ClientHelloParser() + : state_(kEnded), + onhello_cb_(nullptr), + onend_cb_(nullptr), + cb_arg_(nullptr), + session_size_(0), + session_id_(nullptr), + servername_size_(0), + servername_(nullptr), + ocsp_request_(0), + tls_ticket_size_(0), + tls_ticket_(nullptr) { + Reset(); +} + inline void ClientHelloParser::Reset() { frame_len_ = 0; body_offset_ = 0; diff --git a/src/node_crypto_clienthello.h b/src/node_crypto_clienthello.h index 70f082b2c2a038..32c470677d04c0 100644 --- a/src/node_crypto_clienthello.h +++ b/src/node_crypto_clienthello.h @@ -33,19 +33,7 @@ namespace crypto { class ClientHelloParser { public: - ClientHelloParser() : state_(kEnded), - onhello_cb_(nullptr), - onend_cb_(nullptr), - cb_arg_(nullptr), - session_size_(0), - session_id_(nullptr), - servername_size_(0), - servername_(nullptr), - ocsp_request_(0), - tls_ticket_size_(0), - tls_ticket_(nullptr) { - Reset(); - } + inline ClientHelloParser(); class ClientHello { public: