Merge branch 'topic/amazingpp/2384-record-deprecation' of github.com:/AmazingPP/zeek

* 'topic/amazingpp/2384-record-deprecation' of github.com:/AmazingPP/zeek:
  Replace all the Warning() calls after IsFieldDeprecated() over to Warn()
  Fix deprecation not flagged and incorrect line number in record
This commit is contained in:
Christian Kreibich 2022-09-19 18:15:39 -07:00
commit d20ffb100c
3 changed files with 17 additions and 13 deletions

View file

@ -3228,7 +3228,7 @@ FieldExpr::FieldExpr(ExprPtr arg_op, const char* arg_field_name)
td = rt->FieldDecl(field);
if ( rt->IsFieldDeprecated(field) )
reporter->Warning("%s", rt->GetFieldDeprecationWarning(field, false).c_str());
Warn(rt->GetFieldDeprecationWarning(field, false).c_str());
}
}
}
@ -3313,7 +3313,7 @@ HasFieldExpr::HasFieldExpr(ExprPtr arg_op, const char* arg_field_name)
if ( field < 0 )
ExprError("no such field in record");
else if ( rt->IsFieldDeprecated(field) )
reporter->Warning("%s", rt->GetFieldDeprecationWarning(field, true).c_str());
Warn(rt->GetFieldDeprecationWarning(field, true).c_str());
SetType(base_type(TYPE_BOOL));
}
@ -3443,6 +3443,8 @@ RecordConstructorExpr::RecordConstructorExpr(RecordTypePtr known_rt, ListExprPtr
ExprError(err.c_str());
}
}
else if ( known_rt->IsFieldDeprecated(i) )
Warn(known_rt->GetFieldDeprecationWarning(i, false).c_str());
}
ValPtr RecordConstructorExpr::Eval(Frame* f) const
@ -4213,7 +4215,7 @@ RecordCoerceExpr::RecordCoerceExpr(ExprPtr arg_op, RecordTypePtr r)
}
}
else if ( t_r->IsFieldDeprecated(i) )
reporter->Warning("%s", t_r->GetFieldDeprecationWarning(i, false).c_str());
Warn(t_r->GetFieldDeprecationWarning(i, false).c_str());
}
}
}

View file

@ -7,11 +7,12 @@ warning in ./no-warnings.zeek, line 33: deprecated (blah)
warning in ./no-warnings.zeek, line 37: deprecated (my_event)
warning in ./no-warnings.zeek, line 38: deprecated (my_event)
warning in ./no-warnings.zeek, line 39: deprecated (my_hook)
warning in ./no-warnings.zeek, line 42: deprecated (my_record$b)
warning in ./no-warnings.zeek, line 43: deprecated (my_record$b)
warning in ./no-warnings.zeek, line 45: deprecated (my_record?$b)
warning in ./no-warnings.zeek, line 46: deprecated (my_record$b)
warning in ./no-warnings.zeek, line 49: deprecated (my_record$b)
warning in ./no-warnings.zeek, line 41: deprecated (my_record$b) (my_record($a=3, $b=yeah))
warning in ./no-warnings.zeek, line 42: deprecated (my_record$b) ((coerce [$a=4, $b=ye] to my_record))
warning in ./no-warnings.zeek, line 43: deprecated (my_record$b) ((coerce [$a=5, $b=y] to my_record))
warning in ./no-warnings.zeek, line 45: deprecated (my_record?$b) (mr?$b)
warning in ./no-warnings.zeek, line 46: deprecated (my_record$b) (mr$b)
warning in ./no-warnings.zeek, line 49: deprecated (my_record$b) (mr$b)
warning in ./no-warnings.zeek, line 52: deprecated (my_event)
warning in ./no-warnings.zeek, line 57: deprecated (my_hook)
warning in ./no-warnings.zeek, line 62: deprecated (blah)

View file

@ -7,11 +7,12 @@ warning in ./warnings.zeek, line 33: deprecated (blah): type warning
warning in ./warnings.zeek, line 37: deprecated (my_event): event warning
warning in ./warnings.zeek, line 38: deprecated (my_event): event warning
warning in ./warnings.zeek, line 39: deprecated (my_hook): hook warning
warning in ./warnings.zeek, line 42: deprecated (my_record$b): record warning
warning in ./warnings.zeek, line 43: deprecated (my_record$b): record warning
warning in ./warnings.zeek, line 45: deprecated (my_record?$b): record warning
warning in ./warnings.zeek, line 46: deprecated (my_record$b): record warning
warning in ./warnings.zeek, line 49: deprecated (my_record$b): record warning
warning in ./warnings.zeek, line 41: deprecated (my_record$b): record warning (my_record($a=3, $b=yeah))
warning in ./warnings.zeek, line 42: deprecated (my_record$b): record warning ((coerce [$a=4, $b=ye] to my_record))
warning in ./warnings.zeek, line 43: deprecated (my_record$b): record warning ((coerce [$a=5, $b=y] to my_record))
warning in ./warnings.zeek, line 45: deprecated (my_record?$b): record warning (mr?$b)
warning in ./warnings.zeek, line 46: deprecated (my_record$b): record warning (mr$b)
warning in ./warnings.zeek, line 49: deprecated (my_record$b): record warning (mr$b)
warning in ./warnings.zeek, line 52: deprecated (my_event): event warning
warning in ./warnings.zeek, line 57: deprecated (my_hook): hook warning
warning in ./warnings.zeek, line 62: deprecated (blah): type warning