remove -O force-C++, and also some inadvertently replicated code

This commit is contained in:
Vern Paxson 2021-05-05 19:11:17 -07:00
parent c116b2b8ad
commit 2b0f1c9d6e
5 changed files with 4 additions and 92 deletions

View file

@ -219,15 +219,10 @@ void analyze_scripts()
analysis_options.gen_standalone_CPP);
check_env_opt("ZEEK_REPORT_CPP", analysis_options.report_CPP);
check_env_opt("ZEEK_USE_CPP", analysis_options.use_CPP);
check_env_opt("ZEEK_FORCE_USE_CPP",
analysis_options.force_use_CPP);
if ( analysis_options.gen_standalone_CPP )
analysis_options.gen_CPP = true;
if ( analysis_options.force_use_CPP )
analysis_options.use_CPP = true;
if ( analysis_options.gen_CPP )
{
if ( analysis_options.add_CPP )
@ -372,74 +367,6 @@ void analyze_scripts()
h->SetUsed();
}
}
else if ( analysis_options.force_use_CPP )
reporter->Warning("no C++ available for %s", f.Func()->Name());
}
// Now that we've loaded all of the compiled scripts
// relevant for the AST, activate standalone ones.
for ( auto cb : standalone_activations )
(*cb)();
}
if ( generating_CPP )
{
auto hm = std::make_unique<CPPHashManager>(hash_name.c_str(),
analysis_options.add_CPP);
if ( ! analysis_options.gen_CPP )
{
for ( auto& func : funcs )
{
auto hash = func.Profile()->HashVal();
if ( compiled_scripts.count(hash) > 0 ||
hm->HasHash(hash) )
func.SetSkip(true);
}
// Now that we've presumably marked a lot of functions
// as skippable, recompute the global profile.
pfs = std::make_unique<ProfileFuncs>(funcs, is_CPP_compilable, false);
}
CPPCompile cpp(funcs, *pfs, gen_name.c_str(), *hm,
analysis_options.gen_CPP ||
analysis_options.update_CPP,
analysis_options.gen_standalone_CPP);
exit(0);
}
if ( analysis_options.use_CPP )
{
for ( auto& f : funcs )
{
auto hash = f.Profile()->HashVal();
auto s = compiled_scripts.find(hash);
if ( s == compiled_scripts.end() )
{ // Look for script-specific body.
hash = script_specific_hash(f.Body(), hash);
s = compiled_scripts.find(hash);
}
if ( s != compiled_scripts.end() )
{
auto b = s->second.body;
b->SetHash(hash);
f.Func()->ReplaceBody(f.Body(), b);
f.SetBody(b);
for ( auto& e : s->second.events )
{
auto h = event_registry->Register(e);
h->SetUsed();
}
}
else if ( analysis_options.force_use_CPP )
reporter->Warning("no C++ available for %s", f.Func()->Name());
}
// Now that we've loaded all of the compiled scripts