tweak to prevent an incorrect warning for scripts compiled to C++

This commit is contained in:
Vern Paxson 2024-09-11 16:23:51 +02:00 committed by Christian Kreibich
parent ed905c33cd
commit 8025ee74ef

View file

@ -369,6 +369,11 @@ void CPPCompile::GenWhenStmt(const WhenInfo* wi, const std::string& when_lambda,
Emit("\tthrow CPPDelayedCallException();");
Emit("return %s;", GenericValPtrToGT("retval", ret_type, GEN_NATIVE));
EndBlock();
// Return something to avoid return-without-value warnings - but not
// if this is a when-inside-a-when, or a hook.
if ( ! func_type->ExpressionlessReturnOkay() && ! in_hook )
Emit("return 0;");
}
Emit("}");