Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v8.x backport] src: do not include x.h if x-inl.h is included #16609

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CPP_STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ class FancyContainer {
What it says in the title.
## Do not include `*.h` if `*-inl.h` has already been included
Do
```cpp
#include "util-inl.h" // already includes util.h
```

instead of

```cpp
#include "util.h"
#include "util-inl.h"
```

## Avoid throwing JavaScript errors in nested C++ methods

If you need to throw JavaScript errors from a C++ binding method, try to do it
Expand Down
1 change: 0 additions & 1 deletion src/aliased_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#define SRC_ALIASED_BUFFER_H_

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

namespace node {
Expand Down
1 change: 0 additions & 1 deletion src/async-wrap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "async-wrap.h"
#include "base-object.h"
#include "base-object-inl.h"
#include "node_internals.h"

Expand Down
2 changes: 0 additions & 2 deletions src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"

#include "uv.h"
Expand Down
2 changes: 0 additions & 2 deletions src/base-object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

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

Expand Down
2 changes: 0 additions & 2 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@

#define CARES_STATICLIB
#include "ares.h"
#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "node.h"
#include "req-wrap.h"
#include "req-wrap-inl.h"
#include "util.h"
#include "util-inl.h"
Expand Down
2 changes: 0 additions & 2 deletions src/connect_wrap.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "connect_wrap.h"

#include "env.h"
#include "env-inl.h"
#include "req-wrap.h"
#include "req-wrap-inl.h"
#include "util.h"
#include "util-inl.h"
Expand Down
2 changes: 0 additions & 2 deletions src/connection_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

#include "connect_wrap.h"
#include "env-inl.h"
#include "env.h"
#include "pipe_wrap.h"
#include "stream_wrap.h"
#include "tcp_wrap.h"
#include "util.h"
#include "util-inl.h"

namespace node {
Expand Down
1 change: 0 additions & 1 deletion src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "aliased_buffer.h"
#include "env.h"
#include "node.h"
#include "util.h"
#include "util-inl.h"
#include "uv.h"
#include "v8.h"
Expand Down
2 changes: 0 additions & 2 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"
#include "node.h"
#include "handle_wrap.h"
Expand Down
2 changes: 0 additions & 2 deletions src/handle_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "handle_wrap.h"
#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"
#include "node.h"

Expand Down
1 change: 0 additions & 1 deletion src/inspector_io.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "inspector_io.h"

#include "inspector_socket_server.h"
#include "env.h"
#include "env-inl.h"
#include "node.h"
#include "node_crypto.h"
Expand Down
1 change: 0 additions & 1 deletion src/inspector_js_api.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "base-object.h"
#include "base-object-inl.h"
#include "inspector_agent.h"
#include "inspector_io.h"
Expand Down
1 change: 0 additions & 1 deletion src/inspector_socket.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "inspector_socket.h"
#include "util.h"
#include "util-inl.h"

#define NODE_WANT_INTERNALS 1
Expand Down
1 change: 0 additions & 1 deletion src/inspector_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define SRC_INSPECTOR_SOCKET_H_

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

Expand Down
2 changes: 0 additions & 2 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "js_stream.h"

#include "async-wrap.h"
#include "env.h"
#include "env-inl.h"
#include "node_buffer.h"
#include "stream_base.h"
#include "stream_base-inl.h"
#include "v8.h"

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

#include "env.h"
#include "node_url.h"
#include "util.h"
#include "util-inl.h"
#include "node_internals.h"

Expand Down
1 change: 0 additions & 1 deletion src/module_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <string>
#include <vector>
#include "node_url.h"
#include "base-object.h"
#include "base-object-inl.h"

namespace node {
Expand Down
2 changes: 0 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@
#endif

#include "ares.h"
#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "handle_wrap.h"
#include "http_parser.h"
#include "nghttp2/nghttp2ver.h"
#include "req-wrap.h"
#include "req-wrap-inl.h"
#include "string_bytes.h"
#include "tracing/agent.h"
Expand Down
2 changes: 0 additions & 2 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
#include "node.h"
#include "node_buffer.h"

#include "env.h"
#include "env-inl.h"
#include "string_bytes.h"
#include "string_search.h"
#include "util.h"
#include "util-inl.h"
#include "v8-profiler.h"
#include "v8.h"
Expand Down
2 changes: 0 additions & 2 deletions src/node_config.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "node.h"
#include "node_i18n.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"
#include "node_debug_options.h"

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

#include "node_internals.h"
#include "node_watchdog.h"
#include "base-object.h"
#include "base-object-inl.h"
#include "v8-debug.h"

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

#include "node_counters.h"
#include "uv.h"
#include "env.h"
#include "env-inl.h"

#include <string.h>
Expand Down
2 changes: 0 additions & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
#include "node_mutex.h"
#include "tls_wrap.h" // TLSWrap

#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "string_bytes.h"
#include "util.h"
#include "util-inl.h"
#include "v8.h"
// CNNIC Hash WhiteList is taken from
Expand Down
4 changes: 1 addition & 3 deletions src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node.h"
#include "node_crypto_clienthello.h" // ClientHelloParser
// ClientHelloParser
#include "node_crypto_clienthello-inl.h"

#include "node_buffer.h"

#include "env.h"
#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "base-object.h"
#include "base-object-inl.h"

#include "v8.h"
Expand Down
1 change: 0 additions & 1 deletion src/node_crypto_bio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "node_crypto_bio.h"
#include "openssl/bio.h"
#include "util.h"
#include "util-inl.h"
#include <limits.h>
#include <string.h>
Expand Down
2 changes: 0 additions & 2 deletions src/node_crypto_bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

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

Expand Down
1 change: 0 additions & 1 deletion src/node_crypto_clienthello-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

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

namespace node {
Expand Down
1 change: 0 additions & 1 deletion src/node_crypto_clienthello.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_crypto_clienthello.h"
#include "node_crypto_clienthello-inl.h"

namespace node {
Expand Down
1 change: 0 additions & 1 deletion src/node_dtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#ifdef HAVE_DTRACE
#include "node_provider.h"
#elif HAVE_ETW
#include "node_win32_etw_provider.h"
#include "node_win32_etw_provider-inl.h"
#else
#define NODE_HTTP_SERVER_REQUEST(arg0, arg1)
Expand Down
1 change: 0 additions & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "node_internals.h"
#include "node_stat_watcher.h"

#include "req-wrap.h"
#include "req-wrap-inl.h"
#include "string_bytes.h"

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

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "util.h"
#include "util-inl.h"
#include "uv.h"
#include "nghttp2/nghttp2.h"
Expand Down
2 changes: 0 additions & 2 deletions src/node_http_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
#include "node.h"
#include "node_buffer.h"

#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "http_parser.h"
#include "stream_base.h"
#include "stream_base-inl.h"
#include "util.h"
#include "util-inl.h"
Expand Down
3 changes: 0 additions & 3 deletions src/node_i18n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@

#include "node.h"
#include "node_buffer.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"
#include "base-object.h"
#include "base-object-inl.h"
#include "v8.h"

Expand Down
2 changes: 0 additions & 2 deletions src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node.h"
#include "util.h"
#include "util-inl.h"
#include "env.h"
#include "env-inl.h"
#include "uv.h"
#include "v8.h"
Expand Down
1 change: 0 additions & 1 deletion src/node_lttng.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define NODE_GC_DONE(arg0, arg1, arg2)
#endif

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

namespace node {
Expand Down
1 change: 0 additions & 1 deletion src/node_perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "node.h"
#include "node_perf_common.h"
#include "env.h"
#include "base-object.h"
#include "base-object-inl.h"

#include "v8.h"
Expand Down
1 change: 0 additions & 1 deletion src/node_serdes.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "node_internals.h"
#include "node_buffer.h"
#include "base-object.h"
#include "base-object-inl.h"

namespace node {
Expand Down
2 changes: 0 additions & 2 deletions src/node_stat_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "node_stat_watcher.h"
#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"

#include <string.h>
Expand Down
1 change: 0 additions & 1 deletion src/node_url.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "node_url.h"
#include "node_internals.h"
#include "base-object.h"
#include "base-object-inl.h"
#include "node_i18n.h"

Expand Down
Loading