From 3e26be98fc15a80fb6af745d0288065b731a40aa Mon Sep 17 00:00:00 2001 From: Nick Kreeger Date: Sun, 15 Mar 2020 20:22:33 -0700 Subject: [PATCH 1/2] src: fix extra includes of "env.h" and "env-inl.h" Due to how the Environment class is used throughout the codebase, there are a log of includes referencing eitehr env.h or env-inl.h. This commit cleans up the remaining extra includes of 'env.h' or 'env-inl.h' and adds forward declarations of the Environment class. PR-URL: https://github.com/nodejs/node/pull/32293 Refs: https://github.com/nodejs/node/issues/27531 --- src/node_crypto_common.h | 4 +++- src/node_http_common-inl.h | 1 - src/node_sockaddr.h | 3 ++- src/stream_base-inl.h | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node_crypto_common.h b/src/node_crypto_common.h index e42e249ef2ba2e..f1299d84b632c0 100644 --- a/src/node_crypto_common.h +++ b/src/node_crypto_common.h @@ -3,7 +3,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "env.h" #include "node_crypto.h" #include "v8.h" #include @@ -13,6 +12,9 @@ #include namespace node { + +class Environment; + namespace crypto { // OPENSSL_free is a macro, so we need a wrapper function. diff --git a/src/node_http_common-inl.h b/src/node_http_common-inl.h index d63cdf79a4b468..2dcb643cce439c 100644 --- a/src/node_http_common-inl.h +++ b/src/node_http_common-inl.h @@ -4,7 +4,6 @@ #include "node_http_common.h" #include "node.h" #include "node_mem-inl.h" -#include "env-inl.h" #include "v8.h" #include diff --git a/src/node_sockaddr.h b/src/node_sockaddr.h index 2e3ae09ce3bb8d..c0d006a4d6e681 100644 --- a/src/node_sockaddr.h +++ b/src/node_sockaddr.h @@ -3,7 +3,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "env.h" #include "memory_tracker.h" #include "node.h" #include "uv.h" @@ -14,6 +13,8 @@ namespace node { +class Environment; + class SocketAddress : public MemoryRetainer { public: struct Hash { diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 27a9a01c7c2170..d217ababbceab3 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -6,7 +6,6 @@ #include "stream_base.h" #include "node.h" -#include "env-inl.h" #include "v8.h" namespace node { From 0805001def2234031c2d73d92752f6957689f6fd Mon Sep 17 00:00:00 2001 From: Nick Kreeger Date: Mon, 16 Mar 2020 20:12:44 -0700 Subject: [PATCH 2/2] Review comments. --- src/node_crypto_common.h | 3 --- src/node_http_common-inl.h | 1 + src/stream_base-inl.h | 4 ++-- src/stream_base.h | 3 ++- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/node_crypto_common.h b/src/node_crypto_common.h index f1299d84b632c0..8d40052bcca2f9 100644 --- a/src/node_crypto_common.h +++ b/src/node_crypto_common.h @@ -12,9 +12,6 @@ #include namespace node { - -class Environment; - namespace crypto { // OPENSSL_free is a macro, so we need a wrapper function. diff --git a/src/node_http_common-inl.h b/src/node_http_common-inl.h index 2dcb643cce439c..d63cdf79a4b468 100644 --- a/src/node_http_common-inl.h +++ b/src/node_http_common-inl.h @@ -4,6 +4,7 @@ #include "node_http_common.h" #include "node.h" #include "node_mem-inl.h" +#include "env-inl.h" #include "v8.h" #include diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index d217ababbceab3..41eeb1e0ef5710 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -3,9 +3,9 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "stream_base.h" - +#include "async_wrap-inl.h" #include "node.h" +#include "stream_base.h" #include "v8.h" namespace node { diff --git a/src/stream_base.h b/src/stream_base.h index 15b83ec91f6387..eb75fdc8339ab8 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -3,7 +3,8 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "async_wrap-inl.h" +#include "env.h" +#include "async_wrap.h" #include "node.h" #include "util.h"