Skip to content

Commit 7681fdf

Browse files
tniessendanielleadams
authored andcommitted
src: add and fix some preprocessor comments
PR-URL: #40701 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent be53296 commit 7681fdf

13 files changed

+24
-16
lines changed

src/allocated_buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ struct AllocatedBuffer {
6868

6969
} // namespace node
7070

71-
#endif // NODE_WANT_INTERNALS
71+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
7272

7373
#endif // SRC_ALLOCATED_BUFFER_H_

src/api/exceptions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
237237

238238
return e;
239239
}
240-
#endif
240+
#endif // _WIN32
241241

242242
// Implement the legacy name exposed in node.h. This has not been in fact
243243
// fatal any more, as the user can handle the exception in the

src/crypto/crypto_tls.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ unsigned int TLSWrap::PskClientCallback(
14741474
return psk_buf.length();
14751475
}
14761476

1477-
#endif
1477+
#endif // ifndef OPENSSL_NO_PSK
14781478

14791479
void TLSWrap::GetWriteQueueSize(const FunctionCallbackInfo<Value>& info) {
14801480
TLSWrap* wrap;

src/node.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
960960
}
961961
# endif
962962

963-
#endif
963+
#endif // defined(NODE_HAVE_I18N_SUPPORT)
964964

965965
NativeModuleEnv::InitializeCodeCache();
966966

@@ -1091,7 +1091,7 @@ InitializationResult InitializeOncePerProcess(
10911091
return result;
10921092
}
10931093
}
1094-
#else
1094+
#else // OPENSSL_VERSION_MAJOR < 3
10951095
if (FIPS_mode()) {
10961096
OPENSSL_init();
10971097
}

src/node_internals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class ThreadPoolWork {
283283

284284
#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)
285285
#define NODE_IMPLEMENTS_POSIX_CREDENTIALS 1
286-
#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__)
286+
#endif // defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)
287287

288288
namespace credentials {
289289
bool SafeGetenv(const char* key, std::string* text, Environment* env = nullptr);

src/node_native_module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void NativeModuleLoader::InitializeModuleCategories() {
9090

9191
#if !NODE_USE_V8_PLATFORM || !defined(NODE_HAVE_I18N_SUPPORT)
9292
"trace_events",
93-
#endif // !NODE_USE_V8_PLATFORM
93+
#endif // !NODE_USE_V8_PLATFORM || !defined(NODE_HAVE_I18N_SUPPORT)
9494

9595
#if !HAVE_OPENSSL
9696
"crypto",

src/node_options.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {
8080
if ((secure_heap_min & (secure_heap_min - 1)) != 0)
8181
errors->push_back("--secure-heap-min must be a power of 2");
8282
}
83-
#endif
83+
#endif // HAVE_OPENSSL
84+
8485
if (use_largepages != "off" &&
8586
use_largepages != "on" &&
8687
use_largepages != "silent") {
@@ -808,7 +809,14 @@ PerProcessOptionsParser::PerProcessOptionsParser(
808809
"minimum allocation size from the OpenSSL secure heap",
809810
&PerProcessOptions::secure_heap_min,
810811
kAllowedInEnvironment);
811-
#endif
812+
#endif // HAVE_OPENSSL
813+
#if OPENSSL_VERSION_MAJOR >= 3
814+
AddOption("--openssl-legacy-provider",
815+
"enable OpenSSL 3.0 legacy provider",
816+
&PerProcessOptions::openssl_legacy_provider,
817+
kAllowedInEnvironment);
818+
819+
#endif // OPENSSL_VERSION_MAJOR
812820
AddOption("--use-largepages",
813821
"Map the Node.js static code to large pages. Options are "
814822
"'off' (the default value, meaning do not map), "

src/node_report.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ static void PrintResourceUsage(JSONWriter* writer) {
687687
writer->json_objectend();
688688
writer->json_objectend();
689689
}
690-
#endif
690+
#endif // RUSAGE_THREAD
691691
}
692692

693693
// Report operating system information.

src/node_sockaddr-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,5 +262,5 @@ v8::MaybeLocal<v8::Value> SocketAddressBlockList::Rule::ToV8String(
262262
}
263263
} // namespace node
264264

265-
#endif // NODE_WANT_INTERNALS
265+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
266266
#endif // SRC_NODE_SOCKADDR_INL_H_

src/node_sockaddr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,6 @@ class SocketAddressBlockListWrap : public BaseObject {
400400

401401
} // namespace node
402402

403-
#endif // NOE_WANT_INTERNALS
403+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
404404

405405
#endif // SRC_NODE_SOCKADDR_H_

src/node_url.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ bool ToASCII(const std::string& input, std::string* output) {
331331
output->assign(*buf, buf.length());
332332
return true;
333333
}
334-
#else
334+
#else // !defined(NODE_HAVE_I18N_SUPPORT)
335335
// Intentional non-ops if ICU is not present.
336336
bool ToUnicode(const std::string& input, std::string* output) {
337337
*output = input;
@@ -342,7 +342,7 @@ bool ToASCII(const std::string& input, std::string* output) {
342342
*output = input;
343343
return true;
344344
}
345-
#endif
345+
#endif // !defined(NODE_HAVE_I18N_SUPPORT)
346346

347347
#define NS_IN6ADDRSZ 16
348348

src/node_worker.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
497497
return;
498498
}
499499
}
500-
#endif
500+
#endif // NODE_WITHOUT_NODE_OPTIONS
501501
}
502502

503503
if (args[2]->IsArray()) {

src/stream_pipe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ class StreamPipe : public AsyncWrap {
7272

7373
} // namespace node
7474

75-
#endif
75+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
7676

7777
#endif // SRC_STREAM_PIPE_H_

0 commit comments

Comments
 (0)