Skip to content

Commit

Permalink
src: remove util-inl.h from header files
Browse files Browse the repository at this point in the history
Its intended that *-inl.h header files are only included into the src
files that call the inline methods. Explicitly include it into the files
that need it.

PR-URL: #27631
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
sam-github authored and targos committed May 14, 2019
1 parent e736e20 commit ae8b64d
Show file tree
Hide file tree
Showing 61 changed files with 67 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/aliased_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include <cinttypes>
#include "util-inl.h"
#include "util.h"
#include "v8.h"

namespace node {
Expand Down
1 change: 1 addition & 0 deletions src/api/utils.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "node.h"
#include "node_internals.h"
#include "util-inl.h"

#include <csignal>

Expand Down
2 changes: 1 addition & 1 deletion src/base_object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "base_object.h"
#include "env-inl.h"
#include "util-inl.h"
#include "util.h"
#include "v8.h"

namespace node {
Expand Down
1 change: 1 addition & 0 deletions src/debug_utils.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "debug_utils.h"
#include "util-inl.h"

#ifdef __POSIX__
#if defined(__linux__)
Expand Down
1 change: 1 addition & 0 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "node_worker.h"
#include "tracing/agent.h"
#include "tracing/traced_value.h"
#include "util-inl.h"
#include "v8-profiler.h"

#include <algorithm>
Expand Down
1 change: 1 addition & 0 deletions src/heap_utils.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "env-inl.h"
#include "stream_base-inl.h"
#include "util-inl.h"

using v8::Array;
using v8::Boolean;
Expand Down
1 change: 1 addition & 0 deletions src/inspector/tracing_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "node_v8_platform-inl.h"

#include "env-inl.h"
#include "util-inl.h"
#include "v8.h"

#include <set>
Expand Down
1 change: 1 addition & 0 deletions src/inspector/worker_inspector.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "worker_inspector.h"
#include "main_thread_interface.h"
#include "util-inl.h"

#include <memory>

Expand Down
1 change: 1 addition & 0 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "node_options-inl.h"
#include "node_process.h"
#include "node_url.h"
#include "util-inl.h"
#include "v8-inspector.h"
#include "v8-platform.h"

Expand Down
2 changes: 1 addition & 1 deletion src/inspector_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "node_internals.h"
#include "node_mutex.h"
#include "v8-inspector.h"
#include "util.h"
#include "util-inl.h"
#include "zlib.h"

#include <deque>
Expand Down
1 change: 1 addition & 0 deletions src/inspector_js_api.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "base_object-inl.h"
#include "inspector_agent.h"
#include "inspector_io.h"
#include "util-inl.h"
#include "v8.h"
#include "v8-inspector.h"

Expand Down
2 changes: 1 addition & 1 deletion src/inspector_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "node_file.h"
#include "node_internals.h"
#include "v8-inspector.h"
#include "util.h"
#include "util-inl.h"

namespace node {
namespace profiler {
Expand Down
2 changes: 1 addition & 1 deletion src/inspector_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "util-inl.h"
#include "util.h"
#include "uv.h"

#include <string>
Expand Down
1 change: 1 addition & 0 deletions src/inspector_socket_server.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "inspector_socket_server.h"

#include "node.h"
#include "util-inl.h"
#include "uv.h"
#include "zlib.h"

Expand Down
1 change: 1 addition & 0 deletions src/js_native_api_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define NAPI_EXPERIMENTAL
#include "js_native_api_v8.h"
#include "js_native_api.h"
#include "util-inl.h"

#define CHECK_MAYBE_NOTHING(env, maybe, status) \
RETURN_STATUS_IF_FALSE((env), !((maybe).IsNothing()), (status))
Expand Down
2 changes: 1 addition & 1 deletion src/js_native_api_v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ inline napi_value JsValueFromV8LocalValue(v8::Local<v8::Value> local) {

inline v8::Local<v8::Value> V8LocalValueFromJsValue(napi_value v) {
v8::Local<v8::Value> local;
memcpy(&local, &v, sizeof(v));
memcpy(static_cast<void*>(&local), &v, sizeof(v));
return local;
}

Expand Down
1 change: 1 addition & 0 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "node_buffer.h"
#include "node_errors.h"
#include "stream_base-inl.h"
#include "util-inl.h"
#include "v8.h"

namespace node {
Expand Down
1 change: 1 addition & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// ========== local headers ==========

#include "debug_utils.h"
#include "env-inl.h"
#include "node_binding.h"
#include "node_internals.h"
#include "node_main_instance.h"
Expand Down
8 changes: 8 additions & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@
# endif
#endif

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
// Internally, do not include util-inl.h into files unless they need it's
// inline definitions.
#else
// Externally, it must be included for backwards API compatibility.
# include <util-inl.h>
#endif

// Forward-declare libuv loop
struct uv_loop_s;

Expand Down
1 change: 1 addition & 0 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "node_binding.h"
#include "node_errors.h"
#include "node_internals.h"
#include "util-inl.h"

#include <memory>

Expand Down
1 change: 1 addition & 0 deletions src/node_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "node_constants.h"
#include "node_internals.h"
#include "util-inl.h"

#include "zlib.h"

Expand Down
1 change: 1 addition & 0 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "node_context_data.h"
#include "node_errors.h"
#include "module_wrap.h"
#include "util-inl.h"

namespace node {
namespace contextify {
Expand Down
1 change: 1 addition & 0 deletions src/node_credentials.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "node_internals.h"
#include "util-inl.h"

#ifdef NODE_IMPLEMENTS_POSIX_CREDENTIALS
#include <grp.h> // getgrnam()
Expand Down
4 changes: 2 additions & 2 deletions src/node_crypto_bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

#include "node_crypto.h"
#include "openssl/bio.h"
#include "env-inl.h"
#include "util-inl.h"
#include "env.h"
#include "util.h"
#include "v8.h"

namespace node {
Expand Down
2 changes: 1 addition & 1 deletion src/node_crypto_clienthello-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node_crypto_clienthello.h"
#include "util-inl.h"
#include "util.h"

namespace node {
namespace crypto {
Expand Down
1 change: 1 addition & 0 deletions src/node_dtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define NODE_GC_DONE(arg0, arg1, arg2)
#endif

#include "env-inl.h"
#include "node_errors.h"

#include <cstring>
Expand Down
2 changes: 1 addition & 1 deletion src/node_env_var.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "env-inl.h"
#include "node_errors.h"
#include "node_process.h"
#include "util.h"

#ifdef __APPLE__
#include <crt_externs.h>
Expand Down
1 change: 1 addition & 0 deletions src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#endif
#include "node_process.h"
#include "node_v8_platform-inl.h"
#include "util-inl.h"

namespace node {

Expand Down
4 changes: 2 additions & 2 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node.h"
#include "util-inl.h"
#include "env-inl.h"
#include "util.h"
#include "env.h"
#include "v8.h"

// Use ostringstream to print exact-width integer types
Expand Down
2 changes: 1 addition & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "node_buffer.h"
#include "node_process.h"
#include "node_stat_watcher.h"
#include "util.h"
#include "util-inl.h"

#include "tracing/trace_event.h"

Expand Down
2 changes: 1 addition & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "node_http2.h"
#include "node_http2_state.h"
#include "node_perf.h"
#include "util.h"
#include "util-inl.h"

#include <algorithm>

Expand Down
1 change: 1 addition & 0 deletions src/node_http_parser_llhttp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "node_http_parser_impl.h"
#include "node_metadata.h"
#include "util-inl.h"

namespace node {

Expand Down
1 change: 1 addition & 0 deletions src/node_http_parser_traditional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "node_http_parser_impl.h"
#include "node_metadata.h"
#include "util-inl.h"

namespace node {
namespace per_process {
Expand Down
2 changes: 1 addition & 1 deletion src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "node_binding.h"
#include "node_mutex.h"
#include "tracing/trace_event.h"
#include "util-inl.h"
#include "util.h"
#include "uv.h"
#include "v8.h"

Expand Down
1 change: 1 addition & 0 deletions src/node_main_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "node_internals.h"
#include "node_options-inl.h"
#include "node_v8_platform-inl.h"
#include "util-inl.h"

namespace node {

Expand Down
2 changes: 1 addition & 1 deletion src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "node_buffer.h"
#include "node_errors.h"
#include "node_process.h"
#include "util.h"
#include "util-inl.h"

using node::contextify::ContextifyContext;
using v8::Array;
Expand Down
1 change: 0 additions & 1 deletion src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "env-inl.h"
#include "string_bytes.h"
#include "util.h"

#ifdef __MINGW32__
# include <io.h>
Expand Down
1 change: 1 addition & 0 deletions src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "node_perf.h"
#include "node_buffer.h"
#include "node_process.h"
#include "util-inl.h"

#include <cinttypes>

Expand Down
1 change: 0 additions & 1 deletion src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "env-inl.h"
#include "debug_utils.h"
#include "util.h"
#include <algorithm>
#include <cmath>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion src/node_report_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "node_internals.h"
#include "node_options.h"
#include "node_report.h"
#include "util.h"
#include "util-inl.h"

#include "handle_wrap.h"
#include "node_buffer.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_report_utils.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "node_internals.h"
#include "node_report.h"
#include "util-inl.h"

namespace report {

Expand Down
1 change: 1 addition & 0 deletions src/node_serdes.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "node_internals.h"
#include "node_buffer.h"
#include "node_errors.h"
#include "util-inl.h"
#include "base_object-inl.h"

namespace node {
Expand Down
2 changes: 1 addition & 1 deletion src/node_stat_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "async_wrap-inl.h"
#include "env.h"
#include "node_file.h"
#include "util.h"
#include "util-inl.h"

#include <cstring>
#include <cstdlib>
Expand Down
1 change: 1 addition & 0 deletions src/node_symbols.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "env-inl.h"
#include "node_binding.h"
#include "util.h"

namespace node {

Expand Down
1 change: 1 addition & 0 deletions src/node_task_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "node_errors.h"
#include "node_internals.h"
#include "node_process.h"
#include "util-inl.h"
#include "v8.h"

#include <atomic>
Expand Down
1 change: 1 addition & 0 deletions src/node_trace_events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "node_internals.h"
#include "node_v8_platform-inl.h"
#include "tracing/agent.h"
#include "util-inl.h"

#include <set>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "base_object-inl.h"
#include "node_errors.h"
#include "node_i18n.h"
#include "util.h"
#include "util-inl.h"

#include <cmath>
#include <cstdio>
Expand Down
Loading

0 comments on commit ae8b64d

Please sign in to comment.