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

src,tools: fix cpplint & de-lint header usage #26306

Merged
merged 2 commits into from
Mar 12, 2019
Merged
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
1 change: 1 addition & 0 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "async_wrap.h" // NOLINT(build/include_inline)
#include "async_wrap-inl.h"
#include "env-inl.h"
#include "node_errors.h"
Expand Down
5 changes: 0 additions & 5 deletions src/debug_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
#include <cstdio>
#endif

#else // __POSIX__

#include <windows.h>
#include <dbghelp.h>

#endif // __POSIX__

#if defined(__linux__) || defined(__sun) || defined(__FreeBSD__)
Expand Down
4 changes: 3 additions & 1 deletion src/env.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "env.h"

#include "async_wrap.h"
#include "node_buffer.h"
#include "node_context_data.h"
Expand All @@ -14,9 +16,9 @@
#include "tracing/traced_value.h"
#include "v8-profiler.h"

#include <cstdio>
#include <algorithm>
#include <atomic>
#include <cstdio>

namespace node {

Expand Down
5 changes: 3 additions & 2 deletions src/inspector/main_thread_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

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

#include <functional>
#include <unicode/unistr.h>
#include "util-inl.h"

#include <functional>

namespace node {
namespace inspector {
Expand Down
10 changes: 5 additions & 5 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

#include "libplatform/libplatform.h"

#ifdef __POSIX__
#include <pthread.h>
#include <climits> // PTHREAD_STACK_MIN
#endif // __POSIX__

#include <cstring>
#include <sstream>
#include <unordered_map>
#include <vector>

#ifdef __POSIX__
#include <climits> // PTHREAD_STACK_MIN
#include <pthread.h>
#endif // __POSIX__

namespace node {
namespace inspector {
namespace {
Expand Down
12 changes: 4 additions & 8 deletions src/inspector_agent.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#ifndef SRC_INSPECTOR_AGENT_H_
#define SRC_INSPECTOR_AGENT_H_
#pragma once

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include <memory>

#include <cstddef>

#if !HAVE_INSPECTOR
#error("This header can only be used when inspector is enabled")
#endif
Expand All @@ -15,6 +10,9 @@
#include "node_persistent.h"
#include "v8.h"

#include <cstddef>
#include <memory>

namespace v8_inspector {
class StringView;
} // namespace v8_inspector
Expand Down Expand Up @@ -143,5 +141,3 @@ class Agent {
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_INSPECTOR_AGENT_H_
16 changes: 7 additions & 9 deletions src/inspector_io.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#ifndef SRC_INSPECTOR_IO_H_
#define SRC_INSPECTOR_IO_H_
#pragma once

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#if !HAVE_INSPECTOR
#error("This header can only be used when inspector is enabled")
#endif

#include "inspector_socket_server.h"
#include "node_mutex.h"

#include "uv.h"

#include <memory>
#include <cstddef>

#if !HAVE_INSPECTOR
#error("This header can only be used when inspector is enabled")
#endif
#include <memory>


namespace v8_inspector {
Expand Down Expand Up @@ -93,5 +93,3 @@ class InspectorIo {
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_INSPECTOR_IO_H_
2 changes: 1 addition & 1 deletion src/inspector_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "openssl/sha.h" // Sha-1 hash

#include <map>
#include <cstring>
#include <map>

#define ACCEPT_KEY_LENGTH base64_encoded_size(20)

Expand Down
7 changes: 4 additions & 3 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
//
// SPDX-License-Identifier: MIT

#include <errno.h>
#include <fcntl.h> // _O_RDWR
#include <errno.h> // NOLINT(build/include)
#include <fcntl.h> // _O_RDWR
#include <limits.h> // PATH_MAX
#include <locale.h>
#include <signal.h>
Expand All @@ -31,11 +31,12 @@
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h> // readlink

#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <unistd.h> // readlink

// The functions in this file map the text segment of node into 2M pages.
// The algorithm is simple
Expand Down
17 changes: 8 additions & 9 deletions src/memory_tracker.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#ifndef SRC_MEMORY_TRACKER_H_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the original one would be more consistent.

Copy link
Contributor Author

@refack refack Feb 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree that consistency is better then simplicity and readability.
I changed only these files since I was churning them anyway.

#define SRC_MEMORY_TRACKER_H_
#pragma once

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include <unordered_map>
#include "aliased_buffer.h"
#include "v8-profiler.h"

#include <uv.h>

#include <limits>
#include <queue>
#include <stack>
#include <string>
#include <limits>
#include <uv.h>
#include "aliased_buffer.h"
#include "v8-profiler.h"
#include <unordered_map>

namespace node {

Expand Down Expand Up @@ -253,5 +254,3 @@ class MemoryTracker {
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_MEMORY_TRACKER_H_
8 changes: 5 additions & 3 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#include <algorithm>
#include <climits> // PATH_MAX
#include <sys/stat.h> // S_IFDIR
#include "module_wrap.h"

#include "env.h"
Expand All @@ -10,6 +7,11 @@
#include "node_contextify.h"
#include "node_watchdog.h"

#include <sys/stat.h> // S_IFDIR

#include <algorithm>
#include <climits> // PATH_MAX

namespace node {
namespace loader {

Expand Down
34 changes: 22 additions & 12 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +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"

// ========== local headers ==========

#include "debug_utils.h"
#include "node_binding.h"
#include "node_buffer.h"
Expand Down Expand Up @@ -72,25 +76,19 @@
#include "large_pages/node_large_page.h"
#endif

#include <cerrno>
#ifdef NODE_REPORT
#include "node_report.h"
#endif

// ========== global C headers ==========

#include <fcntl.h> // _O_RDWR
#include <climits> // PATH_MAX
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/types.h>

#include <string>
#include <vector>

#if defined(NODE_HAVE_I18N_SUPPORT)
#include <unicode/uvernum.h>
#endif

#ifdef NODE_REPORT
#include "node_report.h"
#endif

#if defined(LEAK_SANITIZER)
#include <sanitizer/lsan_interface.h>
Expand All @@ -106,6 +104,18 @@
#include <unistd.h> // STDIN_FILENO, STDERR_FILENO
#endif

// ========== global C++ headers ==========

#include <cerrno>
#include <climits> // PATH_MAX
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <string>
#include <vector>

namespace node {

using options_parser::kAllowedInEnvironment;
Expand Down
21 changes: 12 additions & 9 deletions src/node_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,31 @@

#include "zlib.h"

#include <cerrno>
#if !defined(_MSC_VER)
#include <unistd.h>
#endif

#include <fcntl.h>
#include <csignal>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits>


#if HAVE_OPENSSL
# include <openssl/ec.h>
# include <openssl/ssl.h>
# ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
# endif // !OPENSSL_NO_ENGINE
#endif
#include <openssl/ec.h>
#include <openssl/ssl.h>
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif // !OPENSSL_NO_ENGINE
#endif // HAVE_OPENSSL

#if defined(__POSIX__)
#include <dlfcn.h>
#endif

#include <cerrno>
#include <csignal>
#include <limits>

namespace node {

using v8::Local;
Expand Down
4 changes: 2 additions & 2 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "node_errors.h"
#include "node_contextify.h"

#include "node_internals.h"
#include "node_watchdog.h"
#include "base_object-inl.h"
#include "node_contextify.h"
#include "node_context_data.h"
#include "node_errors.h"
#include "module_wrap.h"
Expand Down
1 change: 1 addition & 0 deletions src/node_crypto_clienthello.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// 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" // NOLINT(build/include_inline)
#include "node_crypto_clienthello-inl.h"

namespace node {
Expand Down
9 changes: 3 additions & 6 deletions src/node_http_parser_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
// This file is included from 2 files, node_http_parser_traditional.cc
// and node_http_parser_llhttp.cc.

#ifndef SRC_NODE_HTTP_PARSER_IMPL_H_
#define SRC_NODE_HTTP_PARSER_IMPL_H_
#pragma once
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same.


#include "node.h"
#include "node_buffer.h"
Expand All @@ -32,13 +31,13 @@
#include "async_wrap-inl.h"
#include "env-inl.h"
#include "stream_base-inl.h"
#include "util-inl.h"
#include "v8.h"

#include "http_parser_adaptor.h"

#include <cstdlib> // free()
#include <cstring> // strdup(), strchr()

#include "http_parser_adaptor.h"

// This is a binding to http_parser (https://github.com/nodejs/http-parser)
// The goal is to decouple sockets from parsing for more javascript-level
Expand Down Expand Up @@ -978,5 +977,3 @@ void InitializeHttpParser(Local<Object> target,

} // anonymous namespace
} // namespace node

#endif // SRC_NODE_HTTP_PARSER_IMPL_H_
3 changes: 1 addition & 2 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "node_messaging.h"

#include "async_wrap-inl.h"
#include "async_wrap.h"
#include "debug_utils.h"
#include "node_buffer.h"
#include "node_errors.h"
#include "node_process.h"
#include "util-inl.h"
#include "util.h"

using v8::Array;
Expand Down
4 changes: 3 additions & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "node_options.h" // NOLINT(build/include_inline)
#include "node_options-inl.h"

#include "env-inl.h"
#include "node_binding.h"
#include "node_options-inl.h"
refack marked this conversation as resolved.
Show resolved Hide resolved

#include <cstdlib> // strtoul, errno

Expand Down
Loading