diff --git a/CHANGES b/CHANGES index 73393f90c0..3ad7addb23 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5.0.0-dev.92 | 2022-02-04 10:33:47 -0700 + + * fix existing checks for looking to use C++ when it's not available (Vern Paxson, Corelight) + 5.0.0-dev.90 | 2022-02-04 10:32:41 -0700 * fixes for ZAM profiling, which didn't get fully integrated originally (Vern Paxson, Corelight) diff --git a/VERSION b/VERSION index 2519c571e8..4f9db38fff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.0.0-dev.90 +5.0.0-dev.92 diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index 94f711da6c..937671a600 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -286,9 +286,6 @@ static void init_options() if ( analysis_options.use_CPP && generating_CPP ) reporter->FatalError("generating C++ incompatible with using C++"); - if ( analysis_options.use_CPP && ! CPP_init_hook ) - reporter->FatalError("no C++ functions available to use"); - auto usage = getenv("ZEEK_USAGE_ISSUES"); if ( usage ) @@ -336,10 +333,7 @@ static void init_options() static void report_CPP() { if ( ! CPP_init_hook ) - { - printf("no C++ script bodies available\n"); - exit(0); - } + reporter->FatalError("no C++ script bodies available"); printf("C++ script bodies available that match loaded scripts:\n"); @@ -373,6 +367,9 @@ static void report_CPP() static void use_CPP() { + if ( ! CPP_init_hook ) + reporter->FatalError("no C++ functions available to use"); + for ( auto& f : funcs ) { auto hash = f.Profile()->HashVal(); @@ -553,7 +550,14 @@ void analyze_scripts() auto pfs = std::make_unique(funcs, is_CPP_compilable, false); if ( CPP_init_hook ) + { (*CPP_init_hook)(); + if ( compiled_scripts.empty() ) + // The initialization failed to produce any + // script bodies. Make this easily available + // to subsequent checks. + CPP_init_hook = nullptr; + } if ( analysis_options.report_CPP ) {