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
parent
commit
290315ace7
No known key found for this signature in database GPG Key ID: 9C63F3A6CD2AD8F9
  1. 5
      src/async-wrap-inl.h
  2. 2
      src/backtrace_posix.cc
  3. 1
      src/env-inl.h
  4. 4
      src/env.cc
  5. 4
      src/env.h
  6. 5
      src/inspector_agent.cc
  7. 1
      src/node.cc
  8. 4
      src/node.h
  9. 2
      src/node_api.cc
  10. 3
      src/node_buffer.h
  11. 4
      src/node_constants.cc
  12. 5
      src/node_contextify.cc
  13. 2
      src/node_counters.h
  14. 5
      src/node_dtrace.cc
  15. 4
      src/node_dtrace.h
  16. 4
      src/node_file.cc
  17. 2
      src/node_i18n.h
  18. 2
      src/node_internals.h
  19. 3
      src/node_javascript.h
  20. 2
      src/node_main.cc
  21. 5
      src/node_os.cc
  22. 6
      src/node_perf.cc
  23. 6
      src/node_url.cc
  24. 5
      src/node_util.cc
  25. 2
      src/node_watchdog.cc
  26. 2
      src/string_search.h
  27. 2
      src/tls_wrap.cc
  28. 1
      src/util.cc
  29. 1
      test/cctest/node_test_fixture.h
  30. 4
      test/cctest/test_environment.cc

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

2
src/backtrace_posix.cc

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

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

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

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

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

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

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

2
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save