summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-03-11 12:18:53 -0800
committerJames M Snell <jasnell@gmail.com>2017-04-19 09:15:50 -0700
commita16b570f8c1283db81b85ff78ce73608a4265f61 (patch)
treebc1dd9d23003dfb32d81b8aadb7d36302e703f0b /src
parentd3dedb7223c54e77e7fa58c899070eaa4c3b2503 (diff)
downloadandroid-node-v8-a16b570f8c1283db81b85ff78ce73608a4265f61.tar.gz
android-node-v8-a16b570f8c1283db81b85ff78ce73608a4265f61.tar.bz2
android-node-v8-a16b570f8c1283db81b85ff78ce73608a4265f61.zip
src: add --pending-deprecation and NODE_PENDING_DEPRECATION
Command line flag and environment variable that can be used to indicate that pending deprecations should be emitted. PR-URL: https://github.com/nodejs/node/pull/11968 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc12
-rw-r--r--src/node_config.cc3
-rw-r--r--src/node_internals.h4
3 files changed, 19 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index a24dcdb734..21296a1418 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -209,6 +209,10 @@ bool trace_warnings = false;
// that is used by lib/module.js
bool config_preserve_symlinks = false;
+// Set by ParseArgs when --pending-deprecation or NODE_PENDING_DEPRECATION
+// is used.
+bool config_pending_deprecation = false;
+
// Set in node.cc by ParseArgs when --redirect-warnings= is used.
std::string config_warning_file; // NOLINT(runtime/string)
@@ -3768,6 +3772,8 @@ static void ParseArgs(int* argc,
short_circuit = true;
} else if (strcmp(arg, "--zero-fill-buffers") == 0) {
zero_fill_all_buffers = true;
+ } else if (strcmp(arg, "--pending-deprecation") == 0) {
+ config_pending_deprecation = true;
} else if (strcmp(arg, "--v8-options") == 0) {
new_v8_argv[new_v8_argc] = "--help";
new_v8_argc += 1;
@@ -4187,6 +4193,12 @@ void Init(int* argc,
V8::SetFlagsFromString(NODE_V8_OPTIONS, sizeof(NODE_V8_OPTIONS) - 1);
#endif
+ {
+ std::string text;
+ config_pending_deprecation =
+ SafeGetenv("NODE_PENDING_DEPRECATION", &text) && text[0] == '1';
+ }
+
// Allow for environment set preserving symlinks.
{
std::string text;
diff --git a/src/node_config.cc b/src/node_config.cc
index 05a163c3f1..f4729a64fe 100644
--- a/src/node_config.cc
+++ b/src/node_config.cc
@@ -49,6 +49,9 @@ static void InitConfig(Local<Object> target,
if (config_preserve_symlinks)
READONLY_BOOLEAN_PROPERTY("preserveSymlinks");
+ if (config_pending_deprecation)
+ READONLY_BOOLEAN_PROPERTY("pendingDeprecation");
+
if (!config_warning_file.empty()) {
Local<String> name = OneByteString(env->isolate(), "warningFile");
Local<String> value = String::NewFromUtf8(env->isolate(),
diff --git a/src/node_internals.h b/src/node_internals.h
index fa219b96cd..e07cb9d6d3 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -76,6 +76,10 @@ extern bool config_expose_internals;
// it to stderr.
extern std::string config_warning_file; // NOLINT(runtime/string)
+// Set in node.cc by ParseArgs when --pending-deprecation or
+// NODE_PENDING_DEPRECATION is used
+extern bool config_pending_deprecation;
+
// Tells whether it is safe to call v8::Isolate::GetCurrent().
extern bool v8_initialized;