summaryrefslogtreecommitdiff
path: root/src/node_options.cc
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2018-12-18 09:55:56 -0500
committerRefael Ackermann <refack@gmail.com>2019-01-31 18:47:08 -0500
commite3c4b670a4c365c01dc4a3719c72bde734e0d6b4 (patch)
treee01d7cdca471bd6b1c031455376461fa2e95be94 /src/node_options.cc
parentca9e24e8b43b89dc705227a4ed29172c2a95f57f (diff)
downloadandroid-node-v8-e3c4b670a4c365c01dc4a3719c72bde734e0d6b4.tar.gz
android-node-v8-e3c4b670a4c365c01dc4a3719c72bde734e0d6b4.tar.bz2
android-node-v8-e3c4b670a4c365c01dc4a3719c72bde734e0d6b4.zip
src: workaround MSVC compiler bug
PR-URL: https://github.com/nodejs/node/pull/25596 Fixes: https://github.com/nodejs/node/issues/25593 Refs: https://developercommunity.visualstudio.com/content/problem/432157/dynamic-initializers-out-of-order.html Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_options.cc')
-rw-r--r--src/node_options.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/node_options.cc b/src/node_options.cc
index 8bd8b827fa..b7b924501a 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -107,6 +107,20 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
namespace options_parser {
+// Explicitly access the singelton instances in their dependancy order.
+// This was moved here to workaround a compiler bug.
+// Refs: https://github.com/nodejs/node/issues/25593
+
+#if HAVE_INSPECTOR
+const DebugOptionsParser DebugOptionsParser::instance;
+#endif // HAVE_INSPECTOR
+
+const EnvironmentOptionsParser EnvironmentOptionsParser::instance;
+
+const PerIsolateOptionsParser PerIsolateOptionsParser::instance;
+
+const PerProcessOptionsParser PerProcessOptionsParser::instance;
+
// XXX: If you add an option here, please also add it to doc/node.1 and
// doc/api/cli.md
// TODO(addaleax): Make that unnecessary.
@@ -143,10 +157,6 @@ DebugOptionsParser::DebugOptionsParser() {
AddAlias("--debug-brk=", { "--inspect-port", "--debug-brk" });
}
-#if HAVE_INSPECTOR
-const DebugOptionsParser DebugOptionsParser::instance;
-#endif // HAVE_INSPECTOR
-
EnvironmentOptionsParser::EnvironmentOptionsParser() {
AddOption("--experimental-modules",
"experimental ES Module support and caching modules",
@@ -282,8 +292,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
#endif // HAVE_INSPECTOR
}
-const EnvironmentOptionsParser EnvironmentOptionsParser::instance;
-
PerIsolateOptionsParser::PerIsolateOptionsParser() {
AddOption("--track-heap-objects",
"track heap object allocations for heap snapshots",
@@ -341,8 +349,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser() {
&PerIsolateOptions::get_per_env_options);
}
-const PerIsolateOptionsParser PerIsolateOptionsParser::instance;
-
PerProcessOptionsParser::PerProcessOptionsParser() {
AddOption("--title",
"the process title to use on startup",
@@ -449,8 +455,6 @@ PerProcessOptionsParser::PerProcessOptionsParser() {
&PerProcessOptions::get_per_isolate_options);
}
-const PerProcessOptionsParser PerProcessOptionsParser::instance;
-
inline std::string RemoveBrackets(const std::string& host) {
if (!host.empty() && host.front() == '[' && host.back() == ']')
return host.substr(1, host.size() - 2);