mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
fixes for initializing globals when using -O gen-standalone-C++
This commit is contained in:
parent
9e85a0d27d
commit
3d58732cb3
8 changed files with 78 additions and 26 deletions
|
@ -457,11 +457,17 @@ int CPP_EnumMapping::ComputeOffset(InitsManager* im) const {
|
|||
|
||||
void CPP_GlobalLookupInit::Generate(InitsManager* im, std::vector<void*>& /* inits_vec */, int /* offset */) const {
|
||||
global = find_global__CPP(name);
|
||||
if ( val >= 0 )
|
||||
// Have explicit initialization value.
|
||||
global->SetVal(im->ConstVals(val));
|
||||
}
|
||||
|
||||
void CPP_GlobalInit::Generate(InitsManager* im, std::vector<void*>& /* inits_vec */, int /* offset */) const {
|
||||
auto& t = im->Types(type);
|
||||
global = lookup_global__CPP(name, t, exported);
|
||||
global = lookup_global__CPP(name, t, is_exported);
|
||||
|
||||
if ( is_option )
|
||||
global->SetOption();
|
||||
|
||||
if ( ! global->HasVal() ) {
|
||||
if ( val >= 0 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue