Skip to content

Commit

Permalink
src: add include guards to internal headers
Browse files Browse the repository at this point in the history
For consistency with the newly added src/base64.h header, check that
NODE_WANT_INTERNALS is defined and set in internal headers.

PR-URL: nodejs#6948
Refs: nodejs#6910
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
bnoordhuis authored and Fishrock123 committed May 30, 2016
1 parent 04634ae commit 73af4ee
Show file tree
Hide file tree
Showing 53 changed files with 204 additions and 4 deletions.
1 change: 1 addition & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions src/async-wrap-inl.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -120,4 +122,6 @@ inline v8::Local<v8::Value> AsyncWrap::MakeCallback(

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ASYNC_WRAP_INL_H_
3 changes: 3 additions & 0 deletions src/async-wrap.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -86,5 +88,6 @@ void LoadAsyncWrapperInfo(Environment* env);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ASYNC_WRAP_H_
4 changes: 4 additions & 0 deletions src/base-object-inl.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -68,4 +70,6 @@ inline void BaseObject::ClearWeak() {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_BASE_OBJECT_INL_H_
4 changes: 4 additions & 0 deletions src/base-object.h
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -48,4 +50,6 @@ class BaseObject {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_BASE_OBJECT_H_
4 changes: 4 additions & 0 deletions src/debug-agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -132,4 +134,6 @@ class Agent {
} // namespace debugger
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_DEBUG_AGENT_H_
4 changes: 4 additions & 0 deletions src/env-inl.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -576,4 +578,6 @@ inline v8::Local<v8::Object> Environment::NewInternalFieldObject() {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ENV_INL_H_
4 changes: 4 additions & 0 deletions src/env.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -647,4 +649,6 @@ class Environment {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ENV_H_
3 changes: 3 additions & 0 deletions src/handle_wrap.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -69,5 +71,6 @@ class HandleWrap : public AsyncWrap {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_HANDLE_WRAP_H_
4 changes: 4 additions & 0 deletions src/js_stream.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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_
4 changes: 4 additions & 0 deletions src/node_constants.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -37,4 +39,6 @@ extern const char* default_cipher_list;
void DefineConstants(v8::Local<v8::Object> target);
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_CONSTANTS_H_
4 changes: 4 additions & 0 deletions src/node_counters.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,4 +33,6 @@ void TermPerfCounters(v8::Local<v8::Object> target);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_COUNTERS_H_
4 changes: 4 additions & 0 deletions src/node_crypto.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -742,4 +744,6 @@ void InitCrypto(v8::Local<v8::Object> target);
} // namespace crypto
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_CRYPTO_H_
4 changes: 4 additions & 0 deletions src/node_crypto_bio.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -134,4 +136,6 @@ class NodeBIO {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_CRYPTO_BIO_H_
4 changes: 4 additions & 0 deletions src/node_crypto_clienthello-inl.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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_
4 changes: 4 additions & 0 deletions src/node_crypto_clienthello.h
Original file line number Diff line number Diff line change
@@ -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 <stddef.h> // size_t
Expand Down Expand Up @@ -112,4 +114,6 @@ class ClientHelloParser {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_CRYPTO_CLIENTHELLO_H_
4 changes: 4 additions & 0 deletions src/node_crypto_groups.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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_
4 changes: 4 additions & 0 deletions src/node_dtrace.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -58,4 +60,6 @@ void InitDTrace(Environment* env, v8::Local<v8::Object> target);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_DTRACE_H_
4 changes: 4 additions & 0 deletions src/node_file.h
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -10,4 +12,6 @@ void InitFs(v8::Local<v8::Object> target);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_FILE_H_
4 changes: 4 additions & 0 deletions src/node_http_parser.h
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -11,4 +13,6 @@ void InitHttpParser(v8::Local<v8::Object> target);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_HTTP_PARSER_H_
4 changes: 4 additions & 0 deletions src/node_i18n.h
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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_
4 changes: 4 additions & 0 deletions src/node_internals.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -313,4 +315,6 @@ v8::MaybeLocal<v8::Object> New(Environment* env, char* data, size_t length);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_INTERNALS_H_
4 changes: 4 additions & 0 deletions src/node_javascript.h
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -11,4 +13,6 @@ v8::Local<v8::String> MainSource(Environment* env);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_JAVASCRIPT_H_
4 changes: 4 additions & 0 deletions src/node_lttng.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -37,4 +39,6 @@ void InitLTTNG(Environment* env, v8::Local<v8::Object> target);

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_NODE_LTTNG_H_
4 changes: 4 additions & 0 deletions src/node_lttng_provider.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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_
Loading

0 comments on commit 73af4ee

Please sign in to comment.