Skip to content

Commit

Permalink
src: unconditionally include report feature
Browse files Browse the repository at this point in the history
This commit removes all #ifdef NODE_REPORT checks in the src
directory.

PR-URL: nodejs#32242
Fixes: nodejs#26293
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Apr 25, 2020
1 parent 127e2ba commit 2939a45
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 32 deletions.
7 changes: 1 addition & 6 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -67,10 +68,6 @@

#include "large_pages/node_large_page.h"

#ifdef NODE_REPORT
#include "node_report.h"
#endif

// ========== global C headers ==========

#include <fcntl.h> // _O_RDWR
Expand Down Expand Up @@ -733,11 +730,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* 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()
Expand Down
8 changes: 1 addition & 7 deletions src/node_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,6 +62,7 @@
V(pipe_wrap) \
V(process_wrap) \
V(process_methods) \
V(report) \
V(serdes) \
V(signal_wrap) \
V(spawn_sync) \
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 2 additions & 4 deletions src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<String>());
}
#endif // NODE_REPORT

fflush(stderr);
ABORT();
}
Expand Down
8 changes: 1 addition & 7 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {

void PerIsolateOptions::CheckOptions(std::vector<std::string>* 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
Expand Down Expand Up @@ -117,7 +117,6 @@ void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors) {
"--report-uncaught-exception option is valid only when "
"--experimental-report is set");
}
#endif // NODE_REPORT
}

void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
Expand Down Expand Up @@ -365,12 +364,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,
Expand Down Expand Up @@ -629,8 +626,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,
Expand Down Expand Up @@ -659,7 +654,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);
}
Expand Down
8 changes: 0 additions & 8 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -188,15 +186,12 @@ class PerIsolateOptions : public Options {
std::shared_ptr<EnvironmentOptions> 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<std::string>* errors) override;
};
Expand Down Expand Up @@ -241,10 +236,7 @@ class PerProcessOptions : public Options {
#endif
std::string use_largepages = "off";
bool trace_sigint = false;

#ifdef NODE_REPORT
std::vector<std::string> cmdline;
#endif // NODE_REPORT

inline PerIsolateOptions* get_per_isolate_options();
void CheckOptions(std::vector<std::string>* errors) override;
Expand Down

0 comments on commit 2939a45

Please sign in to comment.