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>
This commit is contained in:
Anna Henningsen 2017-08-08 19:56:02 +02:00
parent 4ae0afb12b
commit 290315ace7
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
30 changed files with 25 additions and 73 deletions

View File

@ -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 {

View File

@ -1,4 +1,4 @@
#include "node.h"
#include "node_internals.h"
#if defined(__linux__)
#include <features.h>

View File

@ -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>

View File

@ -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)

View File

@ -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,

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -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

View File

@ -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 {

View File

@ -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>

View File

@ -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 {

View File

@ -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"

View File

@ -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>

View File

@ -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" {
/*

View File

@ -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>

View File

@ -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)

View File

@ -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"

View File

@ -24,8 +24,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "v8.h"
#include "env.h"
#include "node_internals.h"
namespace node {

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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"

View File

@ -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 {

View File

@ -21,8 +21,6 @@
#include "node_watchdog.h"
#include "node_internals.h"
#include "util.h"
#include "util-inl.h"
#include <algorithm>
namespace node {

View File

@ -7,7 +7,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "node.h"
#include "node_internals.h"
#include <string.h>
namespace node {

View File

@ -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 {

View File

@ -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"

View File

@ -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"

View File

@ -1,6 +1,4 @@
#include "node.h"
#include "env.h"
#include "v8.h"
#include "node_internals.h"
#include "libplatform/libplatform.h"
#include <string>