From 5e0dd79a3c111ae62712e22512de5ae18f9bcf9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 2 Nov 2021 16:31:14 +0000 Subject: [PATCH] src: add and fix some preprocessor comments PR-URL: https://github.com/nodejs/node/pull/40701 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Minwoo Jung --- src/allocated_buffer.h | 2 +- src/api/exceptions.cc | 2 +- src/crypto/crypto_tls.cc | 2 +- src/node.cc | 4 ++-- src/node_internals.h | 2 +- src/node_native_module.cc | 2 +- src/node_options.cc | 5 +++-- src/node_report.cc | 2 +- src/node_sockaddr-inl.h | 2 +- src/node_sockaddr.h | 2 +- src/node_url.cc | 4 ++-- src/node_worker.cc | 2 +- src/stream_pipe.h | 2 +- 13 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/allocated_buffer.h b/src/allocated_buffer.h index c984a342a8b2b8..9cf41bffdc19dc 100644 --- a/src/allocated_buffer.h +++ b/src/allocated_buffer.h @@ -68,6 +68,6 @@ struct AllocatedBuffer { } // namespace node -#endif // NODE_WANT_INTERNALS +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_ALLOCATED_BUFFER_H_ diff --git a/src/api/exceptions.cc b/src/api/exceptions.cc index 493e0e806f76f3..1b9b308ad89fc6 100644 --- a/src/api/exceptions.cc +++ b/src/api/exceptions.cc @@ -237,7 +237,7 @@ Local WinapiErrnoException(Isolate* isolate, return e; } -#endif +#endif // _WIN32 // Implement the legacy name exposed in node.h. This has not been in fact // fatal any more, as the user can handle the exception in the diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index 23bc2f21493dc1..bca554d5db4cef 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -1474,7 +1474,7 @@ unsigned int TLSWrap::PskClientCallback( return psk_buf.length(); } -#endif +#endif // ifndef OPENSSL_NO_PSK void TLSWrap::GetWriteQueueSize(const FunctionCallbackInfo& info) { TLSWrap* wrap; diff --git a/src/node.cc b/src/node.cc index 254181b6fbdb25..7f18a21f672537 100644 --- a/src/node.cc +++ b/src/node.cc @@ -960,7 +960,7 @@ int InitializeNodeWithArgs(std::vector* argv, } # endif -#endif +#endif // defined(NODE_HAVE_I18N_SUPPORT) NativeModuleEnv::InitializeCodeCache(); @@ -1091,7 +1091,7 @@ InitializationResult InitializeOncePerProcess( return result; } } -#else +#else // OPENSSL_VERSION_MAJOR < 3 if (FIPS_mode()) { OPENSSL_init(); } diff --git a/src/node_internals.h b/src/node_internals.h index 2671bec87463e1..fc82053cdbd262 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -283,7 +283,7 @@ class ThreadPoolWork { #if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) #define NODE_IMPLEMENTS_POSIX_CREDENTIALS 1 -#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) +#endif // defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) namespace credentials { bool SafeGetenv(const char* key, std::string* text, Environment* env = nullptr); diff --git a/src/node_native_module.cc b/src/node_native_module.cc index 006a30903184d7..5d20e1d6a86416 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -90,7 +90,7 @@ void NativeModuleLoader::InitializeModuleCategories() { #if !NODE_USE_V8_PLATFORM || !defined(NODE_HAVE_I18N_SUPPORT) "trace_events", -#endif // !NODE_USE_V8_PLATFORM +#endif // !NODE_USE_V8_PLATFORM || !defined(NODE_HAVE_I18N_SUPPORT) #if !HAVE_OPENSSL "crypto", diff --git a/src/node_options.cc b/src/node_options.cc index 3363860919a9ac..3dc704cab0947b 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -83,7 +83,8 @@ void PerProcessOptions::CheckOptions(std::vector* errors) { if ((secure_heap_min & (secure_heap_min - 1)) != 0) errors->push_back("--secure-heap-min must be a power of 2"); } -#endif +#endif // HAVE_OPENSSL + if (use_largepages != "off" && use_largepages != "on" && use_largepages != "silent") { @@ -816,7 +817,7 @@ PerProcessOptionsParser::PerProcessOptionsParser( "minimum allocation size from the OpenSSL secure heap", &PerProcessOptions::secure_heap_min, kAllowedInEnvironment); -#endif +#endif // HAVE_OPENSSL #if OPENSSL_VERSION_MAJOR >= 3 AddOption("--openssl-legacy-provider", "enable OpenSSL 3.0 legacy provider", diff --git a/src/node_report.cc b/src/node_report.cc index f1d8d191ab08ae..4bf6993ac5be92 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -687,7 +687,7 @@ static void PrintResourceUsage(JSONWriter* writer) { writer->json_objectend(); writer->json_objectend(); } -#endif +#endif // RUSAGE_THREAD } // Report operating system information. diff --git a/src/node_sockaddr-inl.h b/src/node_sockaddr-inl.h index b5ae5acb5fd7fd..0b2361595f3db7 100644 --- a/src/node_sockaddr-inl.h +++ b/src/node_sockaddr-inl.h @@ -262,5 +262,5 @@ v8::MaybeLocal SocketAddressBlockList::Rule::ToV8String( } } // namespace node -#endif // NODE_WANT_INTERNALS +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_NODE_SOCKADDR_INL_H_ diff --git a/src/node_sockaddr.h b/src/node_sockaddr.h index b1c66580fae922..4cc5291ceefead 100644 --- a/src/node_sockaddr.h +++ b/src/node_sockaddr.h @@ -400,6 +400,6 @@ class SocketAddressBlockListWrap : public BaseObject { } // namespace node -#endif // NOE_WANT_INTERNALS +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_NODE_SOCKADDR_H_ diff --git a/src/node_url.cc b/src/node_url.cc index 14522fccb079ab..708d79f8d80826 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -331,7 +331,7 @@ bool ToASCII(const std::string& input, std::string* output) { output->assign(*buf, buf.length()); return true; } -#else +#else // !defined(NODE_HAVE_I18N_SUPPORT) // Intentional non-ops if ICU is not present. bool ToUnicode(const std::string& input, std::string* output) { *output = input; @@ -342,7 +342,7 @@ bool ToASCII(const std::string& input, std::string* output) { *output = input; return true; } -#endif +#endif // !defined(NODE_HAVE_I18N_SUPPORT) #define NS_IN6ADDRSZ 16 diff --git a/src/node_worker.cc b/src/node_worker.cc index 16b7be36f28431..a734d65965a9d7 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -497,7 +497,7 @@ void Worker::New(const FunctionCallbackInfo& args) { return; } } -#endif +#endif // NODE_WITHOUT_NODE_OPTIONS } if (args[2]->IsArray()) { diff --git a/src/stream_pipe.h b/src/stream_pipe.h index 3c3768602b3e26..f411468294d3f0 100644 --- a/src/stream_pipe.h +++ b/src/stream_pipe.h @@ -72,6 +72,6 @@ class StreamPipe : public AsyncWrap { } // namespace node -#endif +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_STREAM_PIPE_H_