mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge branch 'topic/awelzel/no-abort-identified-not-defined'
* topic/awelzel/no-abort-identified-not-defined: Tame error reporting and abort() for undefined types
This commit is contained in:
commit
1772a1bd6d
6 changed files with 25 additions and 4 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
|||
5.2.0-dev.534 | 2023-01-26 20:06:24 +0100
|
||||
|
||||
* Tame error reporting and abort() for undefined types (Arne Welzel, Corelight)
|
||||
|
||||
5.2.0-dev.532 | 2023-01-26 10:55:02 -0700
|
||||
|
||||
* Bump spicy to v1.6.1. (Benjamin Bannier, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
5.2.0-dev.532
|
||||
5.2.0-dev.534
|
||||
|
|
|
@ -243,8 +243,9 @@ void Attributes::AddAttr(AttrPtr attr, bool is_redef)
|
|||
// We only check the attribute after we've added it, to facilitate
|
||||
// generating error messages via Attributes::Describe. If the
|
||||
// instantiator of the object specified a null type, however, then
|
||||
// that's a signal to skip the checking.
|
||||
if ( type )
|
||||
// that's a signal to skip the checking. If the type is error,
|
||||
// there's no point checking attributes either.
|
||||
if ( type && ! IsErrorType(type->Tag()) )
|
||||
CheckAttr(attr.get());
|
||||
|
||||
// For ADD_FUNC or DEL_FUNC, add in an implicit REDEF, since
|
||||
|
|
|
@ -1088,7 +1088,7 @@ void RecordType::AddField(unsigned int field, const TypeDecl* td)
|
|||
auto def_attr = a ? a->Find(detail::ATTR_DEFAULT) : nullptr;
|
||||
auto def_expr = def_attr ? def_attr->GetExpr() : nullptr;
|
||||
|
||||
if ( def_expr )
|
||||
if ( def_expr && ! IsErrorType(type->Tag()) )
|
||||
{
|
||||
if ( type->Tag() == TYPE_RECORD && def_expr->GetType()->Tag() == TYPE_RECORD &&
|
||||
! same_type(def_expr->GetType(), type) )
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
error in <...>/identifier-not-defined-error.zeek, line 12: identifier not defined: MyEnumTypo
|
14
testing/btest/language/identifier-not-defined-error.zeek
Normal file
14
testing/btest/language/identifier-not-defined-error.zeek
Normal file
|
@ -0,0 +1,14 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
module MyModule;
|
||||
|
||||
export {
|
||||
type MyEnum: enum {
|
||||
MY_ENUM_A,
|
||||
MY_ENUM_B,
|
||||
};
|
||||
|
||||
type MyRec: record {
|
||||
a: MyEnumTypo &default=MY_ENUM_A;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue