mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Reformat the world
This commit is contained in:
parent
194cb24547
commit
b2f171ec69
714 changed files with 35149 additions and 35203 deletions
|
@ -1,23 +1,20 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "zeek/script_opt/CPP/Compile.h"
|
||||
|
||||
|
||||
namespace zeek::detail {
|
||||
namespace zeek::detail
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
CPPCompile::CPPCompile(vector<FuncInfo>& _funcs, ProfileFuncs& _pfs,
|
||||
const string& gen_name, const string& _addl_name,
|
||||
CPPHashManager& _hm, bool _update, bool _standalone,
|
||||
bool report_uncompilable)
|
||||
: funcs(_funcs), pfs(_pfs), hm(_hm),
|
||||
update(_update), standalone(_standalone)
|
||||
CPPCompile::CPPCompile(vector<FuncInfo>& _funcs, ProfileFuncs& _pfs, const string& gen_name,
|
||||
const string& _addl_name, CPPHashManager& _hm, bool _update,
|
||||
bool _standalone, bool report_uncompilable)
|
||||
: funcs(_funcs), pfs(_pfs), hm(_hm), update(_update), standalone(_standalone)
|
||||
{
|
||||
addl_name = _addl_name;
|
||||
bool is_addl = hm.IsAppend();
|
||||
|
@ -60,8 +57,7 @@ CPPCompile::CPPCompile(vector<FuncInfo>& _funcs, ProfileFuncs& _pfs,
|
|||
auto addl_f = fopen(addl_name.c_str(), "w");
|
||||
if ( ! addl_f )
|
||||
{
|
||||
reporter->Error("can't open C++ additional file %s",
|
||||
addl_name.c_str());
|
||||
reporter->Error("can't open C++ additional file %s", addl_name.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -105,9 +101,8 @@ void CPPCompile::Compile(bool report_uncompilable)
|
|||
if ( IsCompilable(func, &reason) )
|
||||
compilable_funcs.insert(BodyName(func));
|
||||
else if ( reason && report_uncompilable )
|
||||
fprintf(stderr,
|
||||
"%s cannot be compiled to C++ due to %s\n",
|
||||
func.Func()->Name(), reason);
|
||||
fprintf(stderr, "%s cannot be compiled to C++ due to %s\n", func.Func()->Name(),
|
||||
reason);
|
||||
|
||||
auto h = func.Profile()->HashVal();
|
||||
if ( hm.HasHash(h) )
|
||||
|
@ -257,16 +252,14 @@ void CPPCompile::RegisterCompiledBody(const string& f)
|
|||
// same binary).
|
||||
h = merge_p_hashes(h, p_hash(cf_locs[f]));
|
||||
|
||||
auto init = string("register_body__CPP(make_intrusive<") +
|
||||
f + "_cl>(\"" + f + "\"), " + Fmt(p) + ", " +
|
||||
Fmt(h) + ", " + events + ");";
|
||||
auto init = string("register_body__CPP(make_intrusive<") + f + "_cl>(\"" + f + "\"), " +
|
||||
Fmt(p) + ", " + Fmt(h) + ", " + events + ");";
|
||||
|
||||
AddInit(names_to_bodies[f], init);
|
||||
|
||||
if ( update )
|
||||
{
|
||||
fprintf(hm.HashFile(), "func\n%s%s\n",
|
||||
scope_prefix(addl_tag).c_str(), f.c_str());
|
||||
fprintf(hm.HashFile(), "func\n%s%s\n", scope_prefix(addl_tag).c_str(), f.c_str());
|
||||
fprintf(hm.HashFile(), "%llu\n", h);
|
||||
}
|
||||
}
|
||||
|
@ -367,4 +360,4 @@ bool CPPCompile::IsCompilable(const FuncInfo& func, const char** reason)
|
|||
return true;
|
||||
}
|
||||
|
||||
} // zeek::detail
|
||||
} // zeek::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue