mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
avoid compiling-to-C++ for functions potentially influenced by conditionals
This commit is contained in:
parent
e73351a6e1
commit
a4b9218771
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include "zeek/script_opt/StmtOptInfo.h"
|
||||
#include "zeek/script_opt/CPP/Util.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
@ -50,6 +51,14 @@ bool is_CPP_compilable(const ProfileFunc* pf, const char** reason)
|
|||
return false;
|
||||
}
|
||||
|
||||
auto body = pf->ProfiledBody();
|
||||
if ( body && ! body->GetOptInfo()->is_free_of_conditionals )
|
||||
{
|
||||
if ( reason )
|
||||
*reason = "body may be affected by @if conditional";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue