mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
added &no_ZAM_opt/&no_CPP_opt attributes and --no-opt-files/--no-opt-funcs for controlling skipping script optimization
This commit is contained in:
parent
2bde66c9d6
commit
441baaf2c1
16 changed files with 198 additions and 57 deletions
19
src/Func.cc
19
src/Func.cc
|
@ -808,7 +808,10 @@ static int get_func_priority(const std::vector<AttrPtr>& attrs) {
|
|||
int priority = 0;
|
||||
|
||||
for ( const auto& a : attrs ) {
|
||||
if ( a->Tag() == ATTR_DEPRECATED || a->Tag() == ATTR_IS_USED || a->Tag() == ATTR_GROUP )
|
||||
static const std::set<AttrTag> ok_for_func = {
|
||||
ATTR_DEPRECATED, ATTR_GROUP, ATTR_IS_USED, ATTR_NO_CPP_OPT, ATTR_NO_ZAM_OPT,
|
||||
};
|
||||
if ( ok_for_func.contains(a->Tag()) )
|
||||
continue;
|
||||
|
||||
if ( a->Tag() != ATTR_PRIORITY ) {
|
||||
|
@ -879,12 +882,16 @@ FunctionIngredients::FunctionIngredients(ScopePtr _scope, StmtPtr _body, const s
|
|||
|
||||
groups = get_func_groups(*attrs);
|
||||
|
||||
for ( const auto& a : *attrs )
|
||||
if ( a->Tag() == ATTR_IS_USED ) {
|
||||
for ( const auto& a : *attrs ) {
|
||||
static const std::set<AttrTag> assoc_with_id = {
|
||||
ATTR_IS_USED,
|
||||
ATTR_NO_CPP_OPT,
|
||||
ATTR_NO_ZAM_OPT,
|
||||
};
|
||||
if ( assoc_with_id.contains(a->Tag()) )
|
||||
// Associate this with the identifier, too.
|
||||
id->AddAttr(make_intrusive<Attr>(ATTR_IS_USED));
|
||||
break;
|
||||
}
|
||||
id->AddAttr(make_intrusive<Attr>(a->Tag()));
|
||||
}
|
||||
}
|
||||
else
|
||||
priority = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue