mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +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
|
@ -479,10 +479,11 @@ public:
|
|||
};
|
||||
|
||||
// A lightweight initializer for a Zeek global that will look it up at
|
||||
// initialization time but not create it if missing.
|
||||
// initialization time but not create it if missing. If do_init is true,
|
||||
// then the global will be (re-)initialized to its value during compilation.
|
||||
class GlobalLookupInitInfo : public CPP_InitInfo {
|
||||
public:
|
||||
GlobalLookupInitInfo(CPPCompile* c, const ID* g, std::string CPP_name);
|
||||
GlobalLookupInitInfo(CPPCompile* c, const ID* g, std::string CPP_name, bool do_init = false);
|
||||
|
||||
std::string InitializerType() const override { return "CPP_GlobalLookupInit"; }
|
||||
void InitializerVals(std::vector<std::string>& ivs) const override;
|
||||
|
@ -490,6 +491,7 @@ public:
|
|||
protected:
|
||||
std::string Zeek_name;
|
||||
std::string CPP_name;
|
||||
std::string val;
|
||||
};
|
||||
|
||||
// Information for initializing a Zeek global.
|
||||
|
@ -504,7 +506,8 @@ protected:
|
|||
int type;
|
||||
int attrs;
|
||||
std::string val;
|
||||
bool exported;
|
||||
bool is_exported;
|
||||
bool is_option;
|
||||
bool func_with_no_val = false; // needed to handle some error situations
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue