From 0b310df5325fb02fe0617ba1d2513607a65f97b9 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 12 Mar 2020 21:32:07 -0400 Subject: [PATCH] src: unconditionally include report feature This commit removes all #ifdef NODE_REPORT checks in the src directory. PR-URL: https://github.com/nodejs/node/pull/32242 Fixes: https://github.com/nodejs/node/issues/26293 Reviewed-By: Richard Lau Reviewed-By: David Carlier Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- src/node.cc | 7 +------ src/node_binding.cc | 8 +------- src/node_errors.cc | 6 ++---- src/node_options.cc | 8 +------- src/node_options.h | 8 -------- 5 files changed, 5 insertions(+), 32 deletions(-) diff --git a/src/node.cc b/src/node.cc index 583c8d5b8b818f..bd004cee8763b2 100644 --- a/src/node.cc +++ b/src/node.cc @@ -35,6 +35,7 @@ #include "node_options-inl.h" #include "node_perf.h" #include "node_process.h" +#include "node_report.h" #include "node_revert.h" #include "node_v8_platform-inl.h" #include "node_version.h" @@ -67,10 +68,6 @@ #include "large_pages/node_large_page.h" -#ifdef NODE_REPORT -#include "node_report.h" -#endif - // ========== global C headers ========== #include // _O_RDWR @@ -733,11 +730,9 @@ int InitializeNodeWithArgs(std::vector* argv, // Make inherited handles noninheritable. uv_disable_stdio_inheritance(); -#ifdef NODE_REPORT // Cache the original command line to be // used in diagnostic reports. per_process::cli_options->cmdline = *argv; -#endif // NODE_REPORT #if defined(NODE_V8_OPTIONS) // Should come before the call to V8::SetFlagsFromCommandLine() diff --git a/src/node_binding.cc b/src/node_binding.cc index 9f9695c2251b2e..91ae3530d09b16 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -17,12 +17,6 @@ #define NODE_BUILTIN_ICU_MODULES(V) #endif -#if NODE_REPORT -#define NODE_BUILTIN_REPORT_MODULES(V) V(report) -#else -#define NODE_BUILTIN_REPORT_MODULES(V) -#endif - #if HAVE_INSPECTOR #define NODE_BUILTIN_PROFILER_MODULES(V) V(profiler) #else @@ -68,6 +62,7 @@ V(pipe_wrap) \ V(process_wrap) \ V(process_methods) \ + V(report) \ V(serdes) \ V(signal_wrap) \ V(spawn_sync) \ @@ -95,7 +90,6 @@ NODE_BUILTIN_STANDARD_MODULES(V) \ NODE_BUILTIN_OPENSSL_MODULES(V) \ NODE_BUILTIN_ICU_MODULES(V) \ - NODE_BUILTIN_REPORT_MODULES(V) \ NODE_BUILTIN_PROFILER_MODULES(V) \ NODE_BUILTIN_DTRACE_MODULES(V) diff --git a/src/node_errors.cc b/src/node_errors.cc index 9d038e3d1683e7..ae1da87ef6b0e0 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -4,9 +4,7 @@ #include "debug_utils-inl.h" #include "node_errors.h" #include "node_internals.h" -#ifdef NODE_REPORT #include "node_report.h" -#endif #include "node_process.h" #include "node_v8_platform-inl.h" #include "util-inl.h" @@ -405,14 +403,14 @@ void OnFatalError(const char* location, const char* message) { } else { FPrintF(stderr, "FATAL ERROR: %s\n", message); } -#ifdef NODE_REPORT + Isolate* isolate = Isolate::GetCurrent(); Environment* env = Environment::GetCurrent(isolate); if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { report::TriggerNodeReport( isolate, env, message, "FatalError", "", Local()); } -#endif // NODE_REPORT + fflush(stderr); ABORT(); } diff --git a/src/node_options.cc b/src/node_options.cc index 4d9398da9ca67b..c2a28c0719fc55 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -76,7 +76,7 @@ void PerProcessOptions::CheckOptions(std::vector* errors) { void PerIsolateOptions::CheckOptions(std::vector* errors) { per_env->CheckOptions(errors); -#ifdef NODE_REPORT + if (per_env->experimental_report) { // Assign the report_signal default value here. Once the // --experimental-report flag is dropped, move this initialization to @@ -117,7 +117,6 @@ void PerIsolateOptions::CheckOptions(std::vector* errors) { "--report-uncaught-exception option is valid only when " "--experimental-report is set"); } -#endif // NODE_REPORT } void EnvironmentOptions::CheckOptions(std::vector* errors) { @@ -396,12 +395,10 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { &EnvironmentOptions::experimental_vm_modules, kAllowedInEnvironment); AddOption("--experimental-worker", "", NoOp{}, kAllowedInEnvironment); -#ifdef NODE_REPORT AddOption("--experimental-report", "enable report generation", &EnvironmentOptions::experimental_report, kAllowedInEnvironment); -#endif // NODE_REPORT AddOption("--experimental-wasi-unstable-preview1", "experimental WASI support", &EnvironmentOptions::experimental_wasi, @@ -660,8 +657,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( "disable runtime allocation of executable memory", V8Option{}, kAllowedInEnvironment); - -#ifdef NODE_REPORT AddOption("--report-uncaught-exception", "generate diagnostic report on uncaught exceptions", &PerIsolateOptions::report_uncaught_exception, @@ -690,7 +685,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( " (default: current working directory of Node.js process)", &PerIsolateOptions::report_directory, kAllowedInEnvironment); -#endif // NODE_REPORT Insert(eop, &PerIsolateOptions::get_per_env_options); } diff --git a/src/node_options.h b/src/node_options.h index 75044ff268adab..05e9fb25dd57ce 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -152,9 +152,7 @@ class EnvironmentOptions : public Options { bool syntax_check_only = false; bool has_eval_string = false; -#ifdef NODE_REPORT bool experimental_report = false; -#endif // NODE_REPORT bool experimental_wasi = false; std::string eval_string; bool print_eval = false; @@ -188,15 +186,12 @@ class PerIsolateOptions : public Options { std::shared_ptr per_env { new EnvironmentOptions() }; bool track_heap_objects = false; bool no_node_snapshot = false; - -#ifdef NODE_REPORT bool report_uncaught_exception = false; bool report_on_signal = false; bool report_on_fatalerror = false; std::string report_signal; std::string report_filename; std::string report_directory; -#endif // NODE_REPORT inline EnvironmentOptions* get_per_env_options(); void CheckOptions(std::vector* errors) override; }; @@ -241,10 +236,7 @@ class PerProcessOptions : public Options { #endif std::string use_largepages = "off"; bool trace_sigint = false; - -#ifdef NODE_REPORT std::vector cmdline; -#endif // NODE_REPORT inline PerIsolateOptions* get_per_isolate_options(); void CheckOptions(std::vector* errors) override;