From 64445674f0f2cf4108f7fffe69c09ac6e93a0a39 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 24 May 2016 09:54:05 +0200 Subject: [PATCH] src: add include guards to internal headers For consistency with the newly added src/base64.h header, check that NODE_WANT_INTERNALS is defined and set in internal headers. PR-URL: https://github.com/nodejs/node/pull/6948 Refs: https://github.com/nodejs/node/pull/6910 Reviewed-By: Fedor Indutny Reviewed-By: James M Snell Reviewed-By: Trevor Norris --- node.gyp | 1 + src/async-wrap-inl.h | 4 ++++ src/async-wrap.h | 3 +++ src/base-object-inl.h | 4 ++++ src/base-object.h | 4 ++++ src/debug-agent.h | 4 ++++ src/env-inl.h | 4 ++++ src/env.h | 4 ++++ src/handle_wrap.h | 3 +++ src/js_stream.h | 4 ++++ src/node_constants.h | 4 ++++ src/node_counters.h | 4 ++++ src/node_crypto.h | 4 ++++ src/node_crypto_bio.h | 4 ++++ src/node_crypto_clienthello-inl.h | 4 ++++ src/node_crypto_clienthello.h | 4 ++++ src/node_crypto_groups.h | 4 ++++ src/node_dtrace.h | 4 ++++ src/node_file.h | 4 ++++ src/node_http_parser.h | 4 ++++ src/node_i18n.h | 4 ++++ src/node_internals.h | 4 ++++ src/node_javascript.h | 4 ++++ src/node_lttng.h | 4 ++++ src/node_lttng_provider.h | 4 ++++ src/node_lttng_tp.h | 4 ++++ src/node_revert.h | 4 ++++ src/node_root_certs.h | 3 +++ src/node_stat_watcher.h | 5 +++++ src/node_watchdog.h | 4 ++++ src/node_win32_etw_provider-inl.h | 4 ++++ src/node_win32_etw_provider.h | 4 ++++ src/node_win32_perfctr_provider.h | 4 ++++ src/node_wrap.h | 4 ++++ src/pipe_wrap.h | 3 +++ src/req-wrap-inl.h | 4 ++++ src/req-wrap.h | 4 ++++ src/spawn_sync.h | 4 ++++ src/stream_base-inl.h | 4 ++++ src/stream_base.h | 4 ++++ src/stream_wrap.h | 3 +++ src/string_bytes.h | 4 ++++ src/string_search.h | 4 ++++ src/tcp_wrap.h | 3 +++ src/tls_wrap.h | 4 ++++ src/tty_wrap.h | 4 ++++ src/udp_wrap.h | 4 ++++ src/util-inl.h | 4 ++++ src/util.h | 4 ++++ test/addons/buffer-free-callback/binding.gyp | 5 ++++- test/addons/make-callback-recurse/binding.gyp | 5 ++++- test/addons/make-callback/binding.gyp | 5 ++++- test/addons/null-buffer-neuter/binding.gyp | 5 ++++- 53 files changed, 204 insertions(+), 4 deletions(-) diff --git a/node.gyp b/node.gyp index 86dffef5c6..0d32905b6c 100644 --- a/node.gyp +++ b/node.gyp @@ -706,6 +706,7 @@ 'GTEST_DONT_DEFINE_ASSERT_LE=1', 'GTEST_DONT_DEFINE_ASSERT_LT=1', 'GTEST_DONT_DEFINE_ASSERT_NE=1', + 'NODE_WANT_INTERNALS=1', ], 'sources': [ 'test/cctest/util.cc', diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index cf7024e7e3..372af07310 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_ASYNC_WRAP_INL_H_ #define SRC_ASYNC_WRAP_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "base-object.h" #include "base-object-inl.h" @@ -120,4 +122,6 @@ inline v8::Local AsyncWrap::MakeCallback( } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_ASYNC_WRAP_INL_H_ diff --git a/src/async-wrap.h b/src/async-wrap.h index cb0c9e211a..e1ea383d9f 100644 --- a/src/async-wrap.h +++ b/src/async-wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_ASYNC_WRAP_H_ #define SRC_ASYNC_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "base-object.h" #include "v8.h" @@ -86,5 +88,6 @@ void LoadAsyncWrapperInfo(Environment* env); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_ASYNC_WRAP_H_ diff --git a/src/base-object-inl.h b/src/base-object-inl.h index 86add5e3b3..b4c3730f1a 100644 --- a/src/base-object-inl.h +++ b/src/base-object-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_BASE_OBJECT_INL_H_ #define SRC_BASE_OBJECT_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "base-object.h" #include "env.h" #include "env-inl.h" @@ -68,4 +70,6 @@ inline void BaseObject::ClearWeak() { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_BASE_OBJECT_INL_H_ diff --git a/src/base-object.h b/src/base-object.h index 8cc5101782..afec3442ce 100644 --- a/src/base-object.h +++ b/src/base-object.h @@ -1,6 +1,8 @@ #ifndef SRC_BASE_OBJECT_H_ #define SRC_BASE_OBJECT_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "v8.h" namespace node { @@ -48,4 +50,6 @@ class BaseObject { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_BASE_OBJECT_H_ diff --git a/src/debug-agent.h b/src/debug-agent.h index 0c465b8e1b..6b151c4587 100644 --- a/src/debug-agent.h +++ b/src/debug-agent.h @@ -22,6 +22,8 @@ #ifndef SRC_DEBUG_AGENT_H_ #define SRC_DEBUG_AGENT_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "util.h" #include "util-inl.h" #include "uv.h" @@ -132,4 +134,6 @@ class Agent { } // namespace debugger } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_DEBUG_AGENT_H_ diff --git a/src/env-inl.h b/src/env-inl.h index 2c6248ae60..34f9bf7d72 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_ENV_INL_H_ #define SRC_ENV_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "env.h" #include "node.h" #include "util.h" @@ -576,4 +578,6 @@ inline v8::Local Environment::NewInternalFieldObject() { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_ENV_INL_H_ diff --git a/src/env.h b/src/env.h index afbade5dd8..0c95abd56c 100644 --- a/src/env.h +++ b/src/env.h @@ -1,6 +1,8 @@ #ifndef SRC_ENV_H_ #define SRC_ENV_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "ares.h" #include "debug-agent.h" #include "handle_wrap.h" @@ -647,4 +649,6 @@ class Environment { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_ENV_H_ diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 49b36f80f9..eaf0faef20 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_HANDLE_WRAP_H_ #define SRC_HANDLE_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "util.h" #include "uv.h" @@ -69,5 +71,6 @@ class HandleWrap : public AsyncWrap { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_HANDLE_WRAP_H_ diff --git a/src/js_stream.h b/src/js_stream.h index 08d1604ac5..5a1244bc46 100644 --- a/src/js_stream.h +++ b/src/js_stream.h @@ -1,6 +1,8 @@ #ifndef SRC_JS_STREAM_H_ #define SRC_JS_STREAM_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "env.h" #include "stream_base.h" @@ -48,4 +50,6 @@ class JSStream : public AsyncWrap, public StreamBase { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_JS_STREAM_H_ diff --git a/src/node_constants.h b/src/node_constants.h index a7c75c4eb2..85fa83a585 100644 --- a/src/node_constants.h +++ b/src/node_constants.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_CONSTANTS_H_ #define SRC_NODE_CONSTANTS_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "v8.h" @@ -37,4 +39,6 @@ extern const char* default_cipher_list; void DefineConstants(v8::Local target); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_CONSTANTS_H_ diff --git a/src/node_counters.h b/src/node_counters.h index 8c93b34f1f..117db1079e 100644 --- a/src/node_counters.h +++ b/src/node_counters.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_COUNTERS_H_ #define SRC_NODE_COUNTERS_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #ifdef HAVE_PERFCTR @@ -31,4 +33,6 @@ void TermPerfCounters(v8::Local target); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_COUNTERS_H_ diff --git a/src/node_crypto.h b/src/node_crypto.h index 28cee7a492..360024be88 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_CRYPTO_H_ #define SRC_NODE_CRYPTO_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "node_crypto_clienthello.h" // ClientHelloParser #include "node_crypto_clienthello-inl.h" @@ -742,4 +744,6 @@ void InitCrypto(v8::Local target); } // namespace crypto } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_CRYPTO_H_ diff --git a/src/node_crypto_bio.h b/src/node_crypto_bio.h index eb247b7f51..7fe0f9b796 100644 --- a/src/node_crypto_bio.h +++ b/src/node_crypto_bio.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_CRYPTO_BIO_H_ #define SRC_NODE_CRYPTO_BIO_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "openssl/bio.h" #include "env.h" #include "env-inl.h" @@ -134,4 +136,6 @@ class NodeBIO { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_CRYPTO_BIO_H_ diff --git a/src/node_crypto_clienthello-inl.h b/src/node_crypto_clienthello-inl.h index 9ae9fd41b6..108383bf2d 100644 --- a/src/node_crypto_clienthello-inl.h +++ b/src/node_crypto_clienthello-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_ #define SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "util.h" #include "util-inl.h" @@ -53,4 +55,6 @@ inline bool ClientHelloParser::IsPaused() const { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_ diff --git a/src/node_crypto_clienthello.h b/src/node_crypto_clienthello.h index ec814d8439..b0b63fb2e3 100644 --- a/src/node_crypto_clienthello.h +++ b/src/node_crypto_clienthello.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_CRYPTO_CLIENTHELLO_H_ #define SRC_NODE_CRYPTO_CLIENTHELLO_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include // size_t @@ -112,4 +114,6 @@ class ClientHelloParser { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_CRYPTO_CLIENTHELLO_H_ diff --git a/src/node_crypto_groups.h b/src/node_crypto_groups.h index ffbf671307..2817f4c926 100644 --- a/src/node_crypto_groups.h +++ b/src/node_crypto_groups.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_CRYPTO_GROUPS_H_ #define SRC_NODE_CRYPTO_GROUPS_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + /* These modular groups were literally taken from: * RFC 2412 (groups 1 and 2) @@ -388,4 +390,6 @@ static const modp_group modp_groups[] = { #undef V }; +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_CRYPTO_GROUPS_H_ diff --git a/src/node_dtrace.h b/src/node_dtrace.h index 9243d02f5a..5d192a60f7 100644 --- a/src/node_dtrace.h +++ b/src/node_dtrace.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_DTRACE_H_ #define SRC_NODE_DTRACE_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "v8.h" #include "env.h" @@ -58,4 +60,6 @@ void InitDTrace(Environment* env, v8::Local target); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_DTRACE_H_ diff --git a/src/node_file.h b/src/node_file.h index 8192ed9c2f..76dbe80348 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_FILE_H_ #define SRC_NODE_FILE_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "v8.h" @@ -10,4 +12,6 @@ void InitFs(v8::Local target); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_FILE_H_ diff --git a/src/node_http_parser.h b/src/node_http_parser.h index 9b49d4d99e..5fbe6f1305 100644 --- a/src/node_http_parser.h +++ b/src/node_http_parser.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_HTTP_PARSER_H_ #define SRC_NODE_HTTP_PARSER_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "v8.h" #include "http_parser.h" @@ -11,4 +13,6 @@ void InitHttpParser(v8::Local target); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_HTTP_PARSER_H_ diff --git a/src/node_i18n.h b/src/node_i18n.h index 4e812ad0f3..31ad18fa47 100644 --- a/src/node_i18n.h +++ b/src/node_i18n.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_I18N_H_ #define SRC_NODE_I18N_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #if defined(NODE_HAVE_I18N_SUPPORT) @@ -18,4 +20,6 @@ bool InitializeICUDirectory(const char* icu_data_path); #endif // NODE_HAVE_I18N_SUPPORT +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_I18N_H_ diff --git a/src/node_internals.h b/src/node_internals.h index a46d3130bf..2875f5ac79 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_INTERNALS_H_ #define SRC_NODE_INTERNALS_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "util.h" #include "util-inl.h" @@ -313,4 +315,6 @@ v8::MaybeLocal New(Environment* env, char* data, size_t length); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_INTERNALS_H_ diff --git a/src/node_javascript.h b/src/node_javascript.h index 1de6611b31..738d819572 100644 --- a/src/node_javascript.h +++ b/src/node_javascript.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_JAVASCRIPT_H_ #define SRC_NODE_JAVASCRIPT_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "v8.h" #include "env.h" @@ -11,4 +13,6 @@ v8::Local MainSource(Environment* env); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_JAVASCRIPT_H_ diff --git a/src/node_lttng.h b/src/node_lttng.h index 4e4147438f..edd802eb6e 100644 --- a/src/node_lttng.h +++ b/src/node_lttng.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_LTTNG_H_ #define SRC_NODE_LTTNG_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "v8.h" #include "env.h" @@ -37,4 +39,6 @@ void InitLTTNG(Environment* env, v8::Local target); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_LTTNG_H_ diff --git a/src/node_lttng_provider.h b/src/node_lttng_provider.h index 2b5b9be8d3..5913f39752 100644 --- a/src/node_lttng_provider.h +++ b/src/node_lttng_provider.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_LTTNG_PROVIDER_H_ #define SRC_NODE_LTTNG_PROVIDER_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #define TRACEPOINT_CREATE_PROBES #define TRACEPOINT_DEFINE #include "node_lttng_tp.h" @@ -99,4 +101,6 @@ bool NODE_NET_STREAM_END_ENABLED() { return true; } } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_LTTNG_PROVIDER_H_ diff --git a/src/node_lttng_tp.h b/src/node_lttng_tp.h index 53d04f47a8..baa3db2ce0 100644 --- a/src/node_lttng_tp.h +++ b/src/node_lttng_tp.h @@ -1,3 +1,5 @@ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #undef TRACEPOINT_PROVIDER #define TRACEPOINT_PROVIDER node @@ -128,3 +130,5 @@ TRACEPOINT_EVENT( #endif /* __NODE_LTTNG_TP_H */ #include + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/node_revert.h b/src/node_revert.h index 6a0f9b452e..b4c3633e94 100644 --- a/src/node_revert.h +++ b/src/node_revert.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_REVERT_H_ #define SRC_NODE_REVERT_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" /** @@ -41,4 +43,6 @@ bool IsReverted(const char * cve); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_REVERT_H_ diff --git a/src/node_root_certs.h b/src/node_root_certs.h index 866f75fd36..f00de758b8 100644 --- a/src/node_root_certs.h +++ b/src/node_root_certs.h @@ -1,3 +1,4 @@ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS /* GlobalSign Root CA */ "-----BEGIN CERTIFICATE-----\n" @@ -3881,3 +3882,5 @@ "1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY\n" "7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYua/GRspBl9JrmkO5K\n" "-----END CERTIFICATE-----\n", + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/node_stat_watcher.h b/src/node_stat_watcher.h index bc7929880b..6978f602e1 100644 --- a/src/node_stat_watcher.h +++ b/src/node_stat_watcher.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_STAT_WATCHER_H_ #define SRC_NODE_STAT_WATCHER_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "async-wrap.h" #include "env.h" @@ -35,4 +37,7 @@ class StatWatcher : public AsyncWrap { }; } // namespace node + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_STAT_WATCHER_H_ diff --git a/src/node_watchdog.h b/src/node_watchdog.h index ead31ce66d..36125ac0e1 100644 --- a/src/node_watchdog.h +++ b/src/node_watchdog.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_WATCHDOG_H_ #define SRC_NODE_WATCHDOG_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "v8.h" #include "uv.h" @@ -32,4 +34,6 @@ class Watchdog { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_WATCHDOG_H_ diff --git a/src/node_win32_etw_provider-inl.h b/src/node_win32_etw_provider-inl.h index 04cd31cee3..efc11ab0b9 100644 --- a/src/node_win32_etw_provider-inl.h +++ b/src/node_win32_etw_provider-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ #define SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node_win32_etw_provider.h" #include "node_etw_provider.h" @@ -265,4 +267,6 @@ bool NODE_V8SYMBOL_ENABLED() { return events_enabled > 0; } } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_WIN32_ETW_PROVIDER_INL_H_ diff --git a/src/node_win32_etw_provider.h b/src/node_win32_etw_provider.h index 23242349cd..baf9e38539 100644 --- a/src/node_win32_etw_provider.h +++ b/src/node_win32_etw_provider.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_WIN32_ETW_PROVIDER_H_ #define SRC_NODE_WIN32_ETW_PROVIDER_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node_dtrace.h" #include @@ -71,4 +73,6 @@ INLINE bool NODE_V8SYMBOL_ENABLED(); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_WIN32_ETW_PROVIDER_H_ diff --git a/src/node_win32_perfctr_provider.h b/src/node_win32_perfctr_provider.h index f1645f4bf8..315e32b029 100644 --- a/src/node_win32_perfctr_provider.h +++ b/src/node_win32_perfctr_provider.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_WIN32_PERFCTR_PROVIDER_H_ #define SRC_NODE_WIN32_PERFCTR_PROVIDER_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #if defined(_MSC_VER) # define INLINE __forceinline #else @@ -30,4 +32,6 @@ void TermPerfCountersWin32(); } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_WIN32_PERFCTR_PROVIDER_H_ diff --git a/src/node_wrap.h b/src/node_wrap.h index b2d6af8ad5..15cea7beda 100644 --- a/src/node_wrap.h +++ b/src/node_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_NODE_WRAP_H_ #define SRC_NODE_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "env.h" #include "env-inl.h" #include "js_stream.h" @@ -49,4 +51,6 @@ inline uv_stream_t* HandleToStream(Environment* env, } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_NODE_WRAP_H_ diff --git a/src/pipe_wrap.h b/src/pipe_wrap.h index eb3d18b80d..f4784ac13a 100644 --- a/src/pipe_wrap.h +++ b/src/pipe_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_PIPE_WRAP_H_ #define SRC_PIPE_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "env.h" #include "stream_wrap.h" @@ -44,5 +46,6 @@ class PipeWrap : public StreamWrap { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_PIPE_WRAP_H_ diff --git a/src/req-wrap-inl.h b/src/req-wrap-inl.h index 653babd2a7..84af22023d 100644 --- a/src/req-wrap-inl.h +++ b/src/req-wrap-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_REQ_WRAP_INL_H_ #define SRC_REQ_WRAP_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "req-wrap.h" #include "async-wrap.h" #include "async-wrap-inl.h" @@ -39,4 +41,6 @@ void ReqWrap::Dispatched() { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_REQ_WRAP_INL_H_ diff --git a/src/req-wrap.h b/src/req-wrap.h index 240df76ebf..e226dc6395 100644 --- a/src/req-wrap.h +++ b/src/req-wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_REQ_WRAP_H_ #define SRC_REQ_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "env.h" #include "util.h" @@ -27,4 +29,6 @@ class ReqWrap : public AsyncWrap { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_REQ_WRAP_H_ diff --git a/src/spawn_sync.h b/src/spawn_sync.h index fab2f09eef..9f53f0a22b 100644 --- a/src/spawn_sync.h +++ b/src/spawn_sync.h @@ -1,6 +1,8 @@ #ifndef SRC_SPAWN_SYNC_H_ #define SRC_SPAWN_SYNC_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "node_buffer.h" @@ -222,4 +224,6 @@ class SyncProcessRunner { }; } +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_SPAWN_SYNC_H_ diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index bdc8211707..a34c01082d 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_STREAM_BASE_INL_H_ #define SRC_STREAM_BASE_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "stream_base.h" #include "node.h" @@ -162,4 +164,6 @@ char* WriteWrap::Extra(size_t offset) { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_STREAM_BASE_INL_H_ diff --git a/src/stream_base.h b/src/stream_base.h index e722a208a8..903b94f346 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -1,6 +1,8 @@ #ifndef SRC_STREAM_BASE_H_ #define SRC_STREAM_BASE_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "env.h" #include "async-wrap.h" #include "req-wrap.h" @@ -270,4 +272,6 @@ class StreamBase : public StreamResource { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_STREAM_BASE_H_ diff --git a/src/stream_wrap.h b/src/stream_wrap.h index b0d9986db5..e930670202 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_STREAM_WRAP_H_ #define SRC_STREAM_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "stream_base.h" #include "env.h" @@ -103,5 +105,6 @@ class StreamWrap : public HandleWrap, public StreamBase { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_STREAM_WRAP_H_ diff --git a/src/string_bytes.h b/src/string_bytes.h index 4b83b7c0f4..75d70defe3 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -1,6 +1,8 @@ #ifndef SRC_STRING_BYTES_H_ #define SRC_STRING_BYTES_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + // Decodes a v8::Local or Buffer to a raw char* #include "v8.h" @@ -108,4 +110,6 @@ class StringBytes { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_STRING_BYTES_H_ diff --git a/src/string_search.h b/src/string_search.h index 0426fd840c..b60457da2a 100644 --- a/src/string_search.h +++ b/src/string_search.h @@ -5,6 +5,8 @@ #ifndef SRC_STRING_SEARCH_H_ #define SRC_STRING_SEARCH_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include @@ -674,4 +676,6 @@ size_t SearchString(const Char* haystack, } } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_STRING_SEARCH_H_ diff --git a/src/tcp_wrap.h b/src/tcp_wrap.h index 4810f1dc1b..af2d08d1ae 100644 --- a/src/tcp_wrap.h +++ b/src/tcp_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_TCP_WRAP_H_ #define SRC_TCP_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "env.h" #include "stream_wrap.h" @@ -52,5 +54,6 @@ class TCPWrap : public StreamWrap { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_TCP_WRAP_H_ diff --git a/src/tls_wrap.h b/src/tls_wrap.h index 471a92056d..3e470f9c6d 100644 --- a/src/tls_wrap.h +++ b/src/tls_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_TLS_WRAP_H_ #define SRC_TLS_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "node.h" #include "node_crypto.h" // SSLWrap @@ -165,4 +167,6 @@ class TLSWrap : public AsyncWrap, } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_TLS_WRAP_H_ diff --git a/src/tty_wrap.h b/src/tty_wrap.h index 581972a3b9..5e0517598b 100644 --- a/src/tty_wrap.h +++ b/src/tty_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_TTY_WRAP_H_ #define SRC_TTY_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "env.h" #include "handle_wrap.h" #include "stream_wrap.h" @@ -34,4 +36,6 @@ class TTYWrap : public StreamWrap { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_TTY_WRAP_H_ diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 2a92cb340d..0d33e617c0 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -1,6 +1,8 @@ #ifndef SRC_UDP_WRAP_H_ #define SRC_UDP_WRAP_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "async-wrap.h" #include "env.h" #include "handle_wrap.h" @@ -70,4 +72,6 @@ class UDPWrap: public HandleWrap { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_UDP_WRAP_H_ diff --git a/src/util-inl.h b/src/util-inl.h index 355dfcdbee..67fe0bd26c 100644 --- a/src/util-inl.h +++ b/src/util-inl.h @@ -1,6 +1,8 @@ #ifndef SRC_UTIL_INL_H_ #define SRC_UTIL_INL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "util.h" namespace node { @@ -219,4 +221,6 @@ bool StringEqualNoCase(const char* a, const char* b) { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_UTIL_INL_H_ diff --git a/src/util.h b/src/util.h index 406f6a1f36..077b7beb4d 100644 --- a/src/util.h +++ b/src/util.h @@ -1,6 +1,8 @@ #ifndef SRC_UTIL_H_ #define SRC_UTIL_H_ +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #include "v8.h" #include @@ -304,4 +306,6 @@ class BufferValue : public MaybeStackBuffer { } // namespace node +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + #endif // SRC_UTIL_H_ diff --git a/test/addons/buffer-free-callback/binding.gyp b/test/addons/buffer-free-callback/binding.gyp index 7ede63d94a..50d094746c 100644 --- a/test/addons/buffer-free-callback/binding.gyp +++ b/test/addons/buffer-free-callback/binding.gyp @@ -2,7 +2,10 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], + 'defines': [ + 'NODE_WANT_INTERNALS=1', + 'V8_DEPRECATION_WARNINGS=1', + ], 'sources': [ 'binding.cc' ] } ] diff --git a/test/addons/make-callback-recurse/binding.gyp b/test/addons/make-callback-recurse/binding.gyp index 7ede63d94a..50d094746c 100644 --- a/test/addons/make-callback-recurse/binding.gyp +++ b/test/addons/make-callback-recurse/binding.gyp @@ -2,7 +2,10 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], + 'defines': [ + 'NODE_WANT_INTERNALS=1', + 'V8_DEPRECATION_WARNINGS=1', + ], 'sources': [ 'binding.cc' ] } ] diff --git a/test/addons/make-callback/binding.gyp b/test/addons/make-callback/binding.gyp index 7ede63d94a..50d094746c 100644 --- a/test/addons/make-callback/binding.gyp +++ b/test/addons/make-callback/binding.gyp @@ -2,7 +2,10 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], + 'defines': [ + 'NODE_WANT_INTERNALS=1', + 'V8_DEPRECATION_WARNINGS=1', + ], 'sources': [ 'binding.cc' ] } ] diff --git a/test/addons/null-buffer-neuter/binding.gyp b/test/addons/null-buffer-neuter/binding.gyp index 7ede63d94a..50d094746c 100644 --- a/test/addons/null-buffer-neuter/binding.gyp +++ b/test/addons/null-buffer-neuter/binding.gyp @@ -2,7 +2,10 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], + 'defines': [ + 'NODE_WANT_INTERNALS=1', + 'V8_DEPRECATION_WARNINGS=1', + ], 'sources': [ 'binding.cc' ] } ]