mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
fix existing checks for looking to use C++ when it's not available
This commit is contained in:
parent
9a7d5c986e
commit
a6e493062c
1 changed files with 11 additions and 7 deletions
|
@ -286,9 +286,6 @@ static void init_options()
|
||||||
if ( analysis_options.use_CPP && generating_CPP )
|
if ( analysis_options.use_CPP && generating_CPP )
|
||||||
reporter->FatalError("generating C++ incompatible with using C++");
|
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");
|
auto usage = getenv("ZEEK_USAGE_ISSUES");
|
||||||
|
|
||||||
if ( usage )
|
if ( usage )
|
||||||
|
@ -336,10 +333,7 @@ static void init_options()
|
||||||
static void report_CPP()
|
static void report_CPP()
|
||||||
{
|
{
|
||||||
if ( ! CPP_init_hook )
|
if ( ! CPP_init_hook )
|
||||||
{
|
reporter->FatalError("no C++ script bodies available");
|
||||||
printf("no C++ script bodies available\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("C++ script bodies available that match loaded scripts:\n");
|
printf("C++ script bodies available that match loaded scripts:\n");
|
||||||
|
|
||||||
|
@ -373,6 +367,9 @@ static void report_CPP()
|
||||||
|
|
||||||
static void use_CPP()
|
static void use_CPP()
|
||||||
{
|
{
|
||||||
|
if ( ! CPP_init_hook )
|
||||||
|
reporter->FatalError("no C++ functions available to use");
|
||||||
|
|
||||||
for ( auto& f : funcs )
|
for ( auto& f : funcs )
|
||||||
{
|
{
|
||||||
auto hash = f.Profile()->HashVal();
|
auto hash = f.Profile()->HashVal();
|
||||||
|
@ -553,7 +550,14 @@ void analyze_scripts()
|
||||||
auto pfs = std::make_unique<ProfileFuncs>(funcs, is_CPP_compilable, false);
|
auto pfs = std::make_unique<ProfileFuncs>(funcs, is_CPP_compilable, false);
|
||||||
|
|
||||||
if ( CPP_init_hook )
|
if ( CPP_init_hook )
|
||||||
|
{
|
||||||
(*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 )
|
if ( analysis_options.report_CPP )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue