mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
-O gen-C++ fix for run-time warnings for "when" lambdas
This commit is contained in:
parent
d1c31927c4
commit
5c38f7637d
3 changed files with 7 additions and 1 deletions
|
@ -511,6 +511,7 @@ FuncTypeInfo::FuncTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, st
|
||||||
flavor = f->Flavor();
|
flavor = f->Flavor();
|
||||||
params = f->Params();
|
params = f->Params();
|
||||||
yield = f->Yield();
|
yield = f->Yield();
|
||||||
|
expressionless_return_okay = f->ExpressionlessReturnOkay();
|
||||||
|
|
||||||
auto gi = c->RegisterType(params);
|
auto gi = c->RegisterType(params);
|
||||||
if ( gi )
|
if ( gi )
|
||||||
|
@ -527,6 +528,7 @@ void FuncTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const {
|
||||||
ivs.emplace_back(Fmt(c->TypeOffset(params)));
|
ivs.emplace_back(Fmt(c->TypeOffset(params)));
|
||||||
ivs.emplace_back(Fmt(yield ? c->TypeOffset(yield) : -1));
|
ivs.emplace_back(Fmt(yield ? c->TypeOffset(yield) : -1));
|
||||||
ivs.emplace_back(Fmt(static_cast<int>(flavor)));
|
ivs.emplace_back(Fmt(static_cast<int>(flavor)));
|
||||||
|
ivs.emplace_back(Fmt(static_cast<int>(expressionless_return_okay)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordTypeInfo::RecordTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t)) {
|
RecordTypeInfo::RecordTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t)) {
|
||||||
|
|
|
@ -624,6 +624,7 @@ private:
|
||||||
FunctionFlavor flavor;
|
FunctionFlavor flavor;
|
||||||
RecordTypePtr params;
|
RecordTypePtr params;
|
||||||
TypePtr yield;
|
TypePtr yield;
|
||||||
|
bool expressionless_return_okay;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RecordTypeInfo : public AbstractTypeInfo {
|
class RecordTypeInfo : public AbstractTypeInfo {
|
||||||
|
|
|
@ -357,6 +357,7 @@ TypePtr CPP_TypeInits::BuildFuncType(InitsManager* im, ValElemVec& init_vals) co
|
||||||
auto p = cast_intrusive<RecordType>(im->Types(init_vals[1]));
|
auto p = cast_intrusive<RecordType>(im->Types(init_vals[1]));
|
||||||
auto yield_i = init_vals[2];
|
auto yield_i = init_vals[2];
|
||||||
auto flavor = static_cast<FunctionFlavor>(init_vals[3]);
|
auto flavor = static_cast<FunctionFlavor>(init_vals[3]);
|
||||||
|
auto expressionless_return_okay = static_cast<FunctionFlavor>(init_vals[4]);
|
||||||
|
|
||||||
TypePtr y;
|
TypePtr y;
|
||||||
|
|
||||||
|
@ -366,7 +367,9 @@ TypePtr CPP_TypeInits::BuildFuncType(InitsManager* im, ValElemVec& init_vals) co
|
||||||
else if ( flavor == FUNC_FLAVOR_FUNCTION || flavor == FUNC_FLAVOR_HOOK )
|
else if ( flavor == FUNC_FLAVOR_FUNCTION || flavor == FUNC_FLAVOR_HOOK )
|
||||||
y = base_type(TYPE_VOID);
|
y = base_type(TYPE_VOID);
|
||||||
|
|
||||||
return make_intrusive<FuncType>(p, y, flavor);
|
auto ft = make_intrusive<FuncType>(p, y, flavor);
|
||||||
|
ft->SetExpressionlessReturnOkay(expressionless_return_okay);
|
||||||
|
return ft;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypePtr CPP_TypeInits::BuildRecordType(InitsManager* im, ValElemVec& init_vals, int offset) const {
|
TypePtr CPP_TypeInits::BuildRecordType(InitsManager* im, ValElemVec& init_vals, int offset) const {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue