Skip to content

Commit

Permalink
src: add and fix some preprocessor comments
Browse files Browse the repository at this point in the history
PR-URL: #40701
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
  • Loading branch information
tniessen authored and danielleadams committed Feb 1, 2022
1 parent be53296 commit 7681fdf
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/allocated_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
2 changes: 1 addition & 1 deletion src/api/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Local<Value> 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
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/crypto_tls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ unsigned int TLSWrap::PskClientCallback(
return psk_buf.length();
}

#endif
#endif // ifndef OPENSSL_NO_PSK

void TLSWrap::GetWriteQueueSize(const FunctionCallbackInfo<Value>& info) {
TLSWrap* wrap;
Expand Down
4 changes: 2 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
}
# endif

#endif
#endif // defined(NODE_HAVE_I18N_SUPPORT)

NativeModuleEnv::InitializeCodeCache();

Expand Down Expand Up @@ -1091,7 +1091,7 @@ InitializationResult InitializeOncePerProcess(
return result;
}
}
#else
#else // OPENSSL_VERSION_MAJOR < 3
if (FIPS_mode()) {
OPENSSL_init();
}
Expand Down
2 changes: 1 addition & 1 deletion src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/node_native_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 10 additions & 2 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ void PerProcessOptions::CheckOptions(std::vector<std::string>* 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") {
Expand Down Expand Up @@ -808,7 +809,14 @@ 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",
&PerProcessOptions::openssl_legacy_provider,
kAllowedInEnvironment);

#endif // OPENSSL_VERSION_MAJOR
AddOption("--use-largepages",
"Map the Node.js static code to large pages. Options are "
"'off' (the default value, meaning do not map), "
Expand Down
2 changes: 1 addition & 1 deletion src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ static void PrintResourceUsage(JSONWriter* writer) {
writer->json_objectend();
writer->json_objectend();
}
#endif
#endif // RUSAGE_THREAD
}

// Report operating system information.
Expand Down
2 changes: 1 addition & 1 deletion src/node_sockaddr-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,5 @@ v8::MaybeLocal<v8::Value> SocketAddressBlockList::Rule::ToV8String(
}
} // namespace node

#endif // NODE_WANT_INTERNALS
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_NODE_SOCKADDR_INL_H_
2 changes: 1 addition & 1 deletion src/node_sockaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
4 changes: 2 additions & 2 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/node_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
return;
}
}
#endif
#endif // NODE_WITHOUT_NODE_OPTIONS
}

if (args[2]->IsArray()) {
Expand Down
2 changes: 1 addition & 1 deletion src/stream_pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ class StreamPipe : public AsyncWrap {

} // namespace node

#endif
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_STREAM_PIPE_H_

0 comments on commit 7681fdf

Please sign in to comment.