Browse Source
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>
canary-base
Anna Henningsen
7 years ago
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
30 changed files with
25 additions and
73 deletions
src/async-wrap-inl.h
src/backtrace_posix.cc
src/env-inl.h
src/env.cc
src/env.h
src/inspector_agent.cc
src/node.cc
src/node.h
src/node_api.cc
src/node_buffer.h
src/node_constants.cc
src/node_contextify.cc
src/node_counters.h
src/node_dtrace.cc
src/node_dtrace.h
src/node_file.cc
src/node_i18n.h
src/node_internals.h
src/node_javascript.h
src/node_main.cc
src/node_os.cc
src/node_perf.cc
src/node_url.cc
src/node_util.cc
src/node_watchdog.cc
src/string_search.h
src/tls_wrap.cc
src/util.cc
test/cctest/node_test_fixture.h
test/cctest/test_environment.cc
@ -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 {
@ -1,4 +1,4 @@
# include "node.h"
# include "node_internals .h"
# if defined(__linux__)
# include <features.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>
@ -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)
@ -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,
@ -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"
@ -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"
@ -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>
@ -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
@ -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 {
@ -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>
@ -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 {
@ -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"
@ -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>
@ -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 " {
/*
@ -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>
@ -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)
@ -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"
@ -24,8 +24,7 @@
# if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
# include "v8.h"
# include "env.h"
# include "node_internals.h"
namespace node {
@ -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>
@ -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>
@ -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>
@ -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"
@ -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 {
@ -21,8 +21,6 @@
# include "node_watchdog.h"
# include "node_internals.h"
# include "util.h"
# include "util-inl.h"
# include <algorithm>
namespace node {
@ -7,7 +7,7 @@
# if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
# include "node.h"
# include "node_internals .h"
# include <string.h>
namespace node {
@ -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 {
@ -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"
@ -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"
@ -1,6 +1,4 @@
# include "node.h"
# include "env.h"
# include "v8.h"
# include "node_internals.h"
# include "libplatform/libplatform.h"
# include <string>