diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-08-08 20:56:02 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-09-14 18:38:38 +0300 |
commit | 290315ace7eed6eeeb300754dd68fc1af4d80c9b (patch) | |
tree | db8e56c9709d43c202c58a0576091e77eb2c44c9 | |
parent | 4ae0afb12b6d29c8bb743c4fd560a91fd626b558 (diff) |
src: refactor `#include` handling
`node_internals.h` already includes the most common headers,
so double includes can be avoided in a lot of cases. Also don’t include
`node_internals.h` from `node.h` implicitly anymore, as that is mostly
unnecessary.
PR-URL: https://github.com/nodejs/node/pull/14697
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r-- | src/async-wrap-inl.h | 5 | ||||
-rw-r--r-- | src/backtrace_posix.cc | 2 | ||||
-rw-r--r-- | src/env-inl.h | 1 | ||||
-rw-r--r-- | src/env.cc | 4 | ||||
-rw-r--r-- | src/env.h | 4 | ||||
-rw-r--r-- | src/inspector_agent.cc | 5 | ||||
-rw-r--r-- | src/node.cc | 1 | ||||
-rw-r--r-- | src/node.h | 4 | ||||
-rw-r--r-- | src/node_api.cc | 2 | ||||
-rw-r--r-- | src/node_buffer.h | 3 | ||||
-rw-r--r-- | src/node_constants.cc | 4 | ||||
-rw-r--r-- | src/node_contextify.cc | 5 | ||||
-rw-r--r-- | src/node_counters.h | 2 | ||||
-rw-r--r-- | src/node_dtrace.cc | 5 | ||||
-rw-r--r-- | src/node_dtrace.h | 4 | ||||
-rw-r--r-- | src/node_file.cc | 4 | ||||
-rw-r--r-- | src/node_i18n.h | 2 | ||||
-rw-r--r-- | src/node_internals.h | 2 | ||||
-rw-r--r-- | src/node_javascript.h | 3 | ||||
-rw-r--r-- | src/node_main.cc | 2 | ||||
-rw-r--r-- | src/node_os.cc | 5 | ||||
-rw-r--r-- | src/node_perf.cc | 6 | ||||
-rw-r--r-- | src/node_url.cc | 6 | ||||
-rw-r--r-- | src/node_util.cc | 5 | ||||
-rw-r--r-- | src/node_watchdog.cc | 2 | ||||
-rw-r--r-- | src/string_search.h | 2 | ||||
-rw-r--r-- | src/tls_wrap.cc | 2 | ||||
-rw-r--r-- | src/util.cc | 1 | ||||
-rw-r--r-- | test/cctest/node_test_fixture.h | 1 | ||||
-rw-r--r-- | test/cctest/test_environment.cc | 4 |
30 files changed, 25 insertions, 73 deletions
diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index 4f8b7c3f8dd..ed5a0c0d279 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -27,12 +27,7 @@ #include "async-wrap.h" #include "base-object.h" #include "base-object-inl.h" -#include "env.h" -#include "env-inl.h" #include "node_internals.h" -#include "util.h" -#include "util-inl.h" -#include "v8.h" namespace node { diff --git a/src/backtrace_posix.cc b/src/backtrace_posix.cc index 8fd798757a5..0c69d820e72 100644 --- a/src/backtrace_posix.cc +++ b/src/backtrace_posix.cc @@ -1,4 +1,4 @@ -#include "node.h" +#include "node_internals.h" #if defined(__linux__) #include <features.h> diff --git a/src/env-inl.h b/src/env-inl.h index 404c06c6f45..ddfb5fd93ff 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -31,6 +31,7 @@ #include "util-inl.h" #include "uv.h" #include "v8.h" +#include "node_perf_common.h" #include <stddef.h> #include <stdint.h> diff --git a/src/env.cc b/src/env.cc index 076198cd626..ba5caa1ec3a 100644 --- a/src/env.cc +++ b/src/env.cc @@ -1,7 +1,5 @@ -#include "env.h" -#include "env-inl.h" +#include "node_internals.h" #include "async-wrap.h" -#include "v8.h" #include "v8-profiler.h" #if defined(_MSC_VER) diff --git a/src/env.h b/src/env.h index 13b1f4cb137..4af87192df8 100644 --- a/src/env.h +++ b/src/env.h @@ -48,6 +48,10 @@ struct nghttp2_rcbuf; namespace node { +namespace performance { +struct performance_state; +} + // Pick an index that's hopefully out of the way when we're embedded inside // another application. Performance-wise or memory-wise it doesn't matter: // Context::SetAlignedPointerInEmbedderData() is backed by a FixedArray, diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 828006ecf2f..9f33b3d31e6 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -1,12 +1,9 @@ #include "inspector_agent.h" #include "inspector_io.h" -#include "env.h" -#include "env-inl.h" -#include "node.h" +#include "node_internals.h" #include "v8-inspector.h" #include "v8-platform.h" -#include "util.h" #include "zlib.h" #include "libplatform/libplatform.h" diff --git a/src/node.cc b/src/node.cc index 664ae22a9ae..30cbb11efa9 100644 --- a/src/node.cc +++ b/src/node.cc @@ -19,7 +19,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "node.h" #include "node_buffer.h" #include "node_constants.h" #include "node_javascript.h" diff --git a/src/node.h b/src/node.h index fbd17d2ca09..5fe7bde4289 100644 --- a/src/node.h +++ b/src/node.h @@ -169,10 +169,6 @@ NODE_EXTERN v8::Local<v8::Value> MakeCallback( } // namespace node -#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "node_internals.h" -#endif - #include <assert.h> #include <stdint.h> diff --git a/src/node_api.cc b/src/node_api.cc index 7bb97c8076f..8c55e64b7cd 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -14,10 +14,8 @@ #include <algorithm> #include <cmath> #include <vector> -#include "uv.h" #include "node_api.h" #include "node_internals.h" -#include "util.h" #define NAPI_VERSION 1 diff --git a/src/node_buffer.h b/src/node_buffer.h index acf9b23c3b3..d680eb90eb1 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -22,8 +22,7 @@ #ifndef SRC_NODE_BUFFER_H_ #define SRC_NODE_BUFFER_H_ -#include "node.h" -#include "v8.h" +#include "node_internals.h" namespace node { diff --git a/src/node_constants.cc b/src/node_constants.cc index b8b97b21f9e..7fd303dd32f 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -20,10 +20,8 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node_constants.h" -#include "env.h" -#include "env-inl.h" +#include "node_internals.h" -#include "uv.h" #include "zlib.h" #include <errno.h> diff --git a/src/node_contextify.cc b/src/node_contextify.cc index b04bd6253e9..c73db420f18 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -19,15 +19,10 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "node.h" #include "node_internals.h" #include "node_watchdog.h" #include "base-object.h" #include "base-object-inl.h" -#include "env.h" -#include "env-inl.h" -#include "util.h" -#include "util-inl.h" #include "v8-debug.h" namespace node { diff --git a/src/node_counters.h b/src/node_counters.h index 5d866aedb57..c8a1a88f0b2 100644 --- a/src/node_counters.h +++ b/src/node_counters.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "node.h" +#include "node_internals.h" #ifdef HAVE_PERFCTR #include "node_win32_perfctr_provider.h" diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index 94d06a7404e..4ff2f22d8e8 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -43,10 +43,7 @@ #define NODE_GC_DONE(arg0, arg1, arg2) #endif -#include "env.h" -#include "env-inl.h" - -#include "util.h" +#include "node_internals.h" #include <string.h> diff --git a/src/node_dtrace.h b/src/node_dtrace.h index c22bf4e7fc0..d16e23ddb38 100644 --- a/src/node_dtrace.h +++ b/src/node_dtrace.h @@ -24,9 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "node.h" -#include "v8.h" -#include "env.h" +#include "node_internals.h" extern "C" { /* diff --git a/src/node_file.cc b/src/node_file.cc index cf7f1df5eb9..b9b3d34f346 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -19,17 +19,13 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "node.h" #include "node_buffer.h" #include "node_internals.h" #include "node_stat_watcher.h" -#include "env.h" -#include "env-inl.h" #include "req-wrap.h" #include "req-wrap-inl.h" #include "string_bytes.h" -#include "util.h" #include <fcntl.h> #include <sys/types.h> diff --git a/src/node_i18n.h b/src/node_i18n.h index adf9feb414d..70a0c79f76c 100644 --- a/src/node_i18n.h +++ b/src/node_i18n.h @@ -24,7 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "node.h" +#include "node_internals.h" #include <string> #if defined(NODE_HAVE_I18N_SUPPORT) diff --git a/src/node_internals.h b/src/node_internals.h index 6faf2750d4d..9b6fae9d6a9 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -27,6 +27,8 @@ #include "node.h" #include "util.h" #include "util-inl.h" +#include "env.h" +#include "env-inl.h" #include "uv.h" #include "v8.h" #include "tracing/trace_event.h" diff --git a/src/node_javascript.h b/src/node_javascript.h index 3e8528fd211..664778091ff 100644 --- a/src/node_javascript.h +++ b/src/node_javascript.h @@ -24,8 +24,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "v8.h" -#include "env.h" +#include "node_internals.h" namespace node { diff --git a/src/node_main.cc b/src/node_main.cc index 7d6d9b1a01b..2a511b92996 100644 --- a/src/node_main.cc +++ b/src/node_main.cc @@ -20,8 +20,10 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node.h" +#include <stdio.h> #ifdef _WIN32 +#include <windows.h> #include <VersionHelpers.h> #include <WinError.h> diff --git a/src/node_os.cc b/src/node_os.cc index c71ca401ed6..f09cd6fa5a0 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -19,10 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "node.h" -#include "v8.h" -#include "env.h" -#include "env-inl.h" +#include "node_internals.h" #include "string_bytes.h" #include <errno.h> diff --git a/src/node_perf.cc b/src/node_perf.cc index 48917d5d4ea..098cf35220a 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -1,9 +1,5 @@ -#include "node.h" -#include "v8.h" -#include "env.h" -#include "env-inl.h" +#include "node_internals.h" #include "node_perf.h" -#include "uv.h" #include <vector> diff --git a/src/node_url.cc b/src/node_url.cc index f8adc7d7af5..20a869ad7af 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -1,11 +1,5 @@ #include "node_url.h" -#include "node.h" #include "node_internals.h" -#include "env.h" -#include "env-inl.h" -#include "util.h" -#include "util-inl.h" -#include "v8.h" #include "base-object.h" #include "base-object-inl.h" #include "node_i18n.h" diff --git a/src/node_util.cc b/src/node_util.cc index bbbea9ea225..ab1f3c9f912 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -1,8 +1,5 @@ -#include "node.h" +#include "node_internals.h" #include "node_watchdog.h" -#include "v8.h" -#include "env.h" -#include "env-inl.h" namespace node { namespace util { diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index f4020e56f7f..af4e9f6fcfe 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -21,8 +21,6 @@ #include "node_watchdog.h" #include "node_internals.h" -#include "util.h" -#include "util-inl.h" #include <algorithm> namespace node { diff --git a/src/string_search.h b/src/string_search.h index dfdb8e9a160..73e90f5873f 100644 --- a/src/string_search.h +++ b/src/string_search.h @@ -7,7 +7,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "node.h" +#include "node_internals.h" #include <string.h> namespace node { diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index b5829cf5b82..dce05fabd62 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -31,8 +31,6 @@ #include "node_internals.h" #include "stream_base.h" #include "stream_base-inl.h" -#include "util.h" -#include "util-inl.h" namespace node { diff --git a/src/util.cc b/src/util.cc index 4a89b3a42f2..ef93d16968e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -19,7 +19,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "util.h" #include "string_bytes.h" #include "node_buffer.h" #include "node_internals.h" diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index 79027d25ad8..263f7b96f9d 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -4,6 +4,7 @@ #include <stdlib.h> #include "gtest/gtest.h" #include "node.h" +#include "node_platform.h" #include "env.h" #include "v8.h" #include "libplatform/libplatform.h" diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index 4651e865a99..8beacfa95ec 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -1,6 +1,4 @@ -#include "node.h" -#include "env.h" -#include "v8.h" +#include "node_internals.h" #include "libplatform/libplatform.h" #include <string> |