diff --git a/src/Options.cc b/src/Options.cc index e6bc9a8f58..731aba8f74 100644 --- a/src/Options.cc +++ b/src/Options.cc @@ -160,6 +160,7 @@ static void set_analysis_option(const char* opt, Options& opts) fprintf(stderr, "--optimize options:\n"); fprintf(stderr, " all equivalent to \"inline\" and \"activate\"\n"); fprintf(stderr, " add-C++ generate private C++ for any missing script bodies\n"); + fprintf(stderr, " compile-all *if* compiling, compile all scripts, even inlined ones\n"); fprintf(stderr, " dump-uds dump use-defs to stdout; implies xform\n"); fprintf(stderr, " dump-xform dump transformed scripts to stdout; implies xform\n"); fprintf(stderr, " gen-C++ generate C++ script bodies\n"); @@ -179,6 +180,8 @@ static void set_analysis_option(const char* opt, Options& opts) if ( util::streq(opt, "add-C++") ) a_o.add_CPP = true; + else if ( util::streq(opt, "compile-all") ) + a_o.activate = a_o.compile_all = true; else if ( util::streq(opt, "dump-uds") ) a_o.activate = a_o.dump_uds = true; else if ( util::streq(opt, "dump-xform") ) @@ -189,6 +192,8 @@ static void set_analysis_option(const char* opt, Options& opts) a_o.gen_standalone_CPP = true; else if ( util::streq(opt, "inline") ) a_o.inliner = true; + else if ( util::streq(opt, "optimize-AST") ) + a_o.activate = a_o.optimize_AST = true; else if ( util::streq(opt, "recursive") ) a_o.inliner = a_o.report_recursive = true; else if ( util::streq(opt, "report-C++") ) @@ -199,8 +204,6 @@ static void set_analysis_option(const char* opt, Options& opts) a_o.use_CPP = true; else if ( util::streq(opt, "xform") ) a_o.activate = true; - else if ( util::streq(opt, "optimize-AST") ) - a_o.activate = a_o.optimize_AST = true; else { diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index 6c6bfa0336..ad74979df8 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -223,6 +223,7 @@ void analyze_scripts() check_env_opt("ZEEK_GEN_CPP", analysis_options.gen_CPP); check_env_opt("ZEEK_GEN_STANDALONE_CPP", analysis_options.gen_standalone_CPP); + check_env_opt("ZEEK_COMPILE_ALL", analysis_options.compile_all); check_env_opt("ZEEK_REPORT_CPP", analysis_options.report_CPP); check_env_opt("ZEEK_USE_CPP", analysis_options.use_CPP); @@ -523,7 +524,8 @@ void analyze_scripts() { auto func = f.Func(); - if ( inl && inl->WasInlined(func) && + if ( ! analysis_options.compile_all && + inl && inl->WasInlined(func) && func_used_indirectly.count(func) == 0 ) // No need to compile as it won't be // called directly. diff --git a/src/script_opt/ScriptOpt.h b/src/script_opt/ScriptOpt.h index 0fa254a1d3..8531e10f24 100644 --- a/src/script_opt/ScriptOpt.h +++ b/src/script_opt/ScriptOpt.h @@ -61,6 +61,11 @@ struct AnalyOpt { // If true, use C++ bodies if available. bool use_CPP = false; + // If true, compile all compileable functions, even those that + // are inlined. Mainly useful for ensuring compatibility for + // some tests in the test suite. + bool compile_all = false; + // If true, report on available C++ bodies. bool report_CPP = false;