mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
remove deprecated union and timer types, addressing #1898
This commit is contained in:
parent
d77fd8305d
commit
11f8729997
9 changed files with 28 additions and 78 deletions
|
@ -4275,8 +4275,6 @@ ScheduleExpr::ScheduleExpr(ExprPtr arg_when, EventExprPtr arg_event)
|
||||||
|
|
||||||
if ( bt != TYPE_TIME && bt != TYPE_INTERVAL )
|
if ( bt != TYPE_TIME && bt != TYPE_INTERVAL )
|
||||||
ExprError("schedule expression requires a time or time interval");
|
ExprError("schedule expression requires a time or time interval");
|
||||||
else
|
|
||||||
SetType(base_type(TYPE_TIMER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScheduleExpr::IsPure() const
|
bool ScheduleExpr::IsPure() const
|
||||||
|
|
42
src/Type.cc
42
src/Type.cc
|
@ -42,21 +42,19 @@ const char* type_name(TypeTag t)
|
||||||
"string", // 7
|
"string", // 7
|
||||||
"pattern", // 8
|
"pattern", // 8
|
||||||
"enum", // 9
|
"enum", // 9
|
||||||
"timer", // 10
|
"port", // 10
|
||||||
"port", // 11
|
"addr", // 11
|
||||||
"addr", // 12
|
"subnet", // 12
|
||||||
"subnet", // 13
|
"any", // 13
|
||||||
"any", // 14
|
"table", // 14
|
||||||
"table", // 15
|
"record", // 15
|
||||||
"union", // 16
|
"types", // 16
|
||||||
"record", // 17
|
"func", // 17
|
||||||
"types", // 18
|
"file", // 18
|
||||||
"func", // 19
|
"vector", // 19
|
||||||
"file", // 20
|
"opaque", // 20
|
||||||
"vector", // 21
|
"type", // 21
|
||||||
"opaque", // 22
|
"error", // 22
|
||||||
"type", // 23
|
|
||||||
"error", // 24
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( int(t) >= NUM_TYPES )
|
if ( int(t) >= NUM_TYPES )
|
||||||
|
@ -208,7 +206,6 @@ TypePtr Type::ShallowClone()
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_PATTERN:
|
case TYPE_PATTERN:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
case TYPE_ADDR:
|
case TYPE_ADDR:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
|
@ -1870,7 +1867,6 @@ bool same_type(const Type& arg_t1, const Type& arg_t2, bool is_init, bool match_
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_PATTERN:
|
case TYPE_PATTERN:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
case TYPE_ADDR:
|
case TYPE_ADDR:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
|
@ -1971,9 +1967,6 @@ bool same_type(const Type& arg_t1, const Type& arg_t2, bool is_init, bool match_
|
||||||
case TYPE_FILE:
|
case TYPE_FILE:
|
||||||
case TYPE_TYPE:
|
case TYPE_TYPE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_UNION:
|
|
||||||
reporter->Error("union type in same_type()");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get to here, then we're dealing with a type with
|
// If we get to here, then we're dealing with a type with
|
||||||
|
@ -2190,7 +2183,6 @@ bool is_assignable(TypeTag t)
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_PATTERN:
|
case TYPE_PATTERN:
|
||||||
case TYPE_ENUM:
|
case TYPE_ENUM:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
case TYPE_ADDR:
|
case TYPE_ADDR:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
|
@ -2210,9 +2202,6 @@ bool is_assignable(TypeTag t)
|
||||||
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case TYPE_UNION:
|
|
||||||
reporter->Error("union type in is_assignable()");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -2269,7 +2258,6 @@ TypePtr merge_types(const TypePtr& arg_t1, const TypePtr& arg_t2)
|
||||||
case TYPE_INTERVAL:
|
case TYPE_INTERVAL:
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_PATTERN:
|
case TYPE_PATTERN:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
case TYPE_ADDR:
|
case TYPE_ADDR:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
|
@ -2471,10 +2459,6 @@ TypePtr merge_types(const TypePtr& arg_t1, const TypePtr& arg_t2)
|
||||||
|
|
||||||
return make_intrusive<FileType>(merge_types(t1->Yield(), t2->Yield()));
|
return make_intrusive<FileType>(merge_types(t1->Yield(), t2->Yield()));
|
||||||
|
|
||||||
case TYPE_UNION:
|
|
||||||
reporter->InternalError("union type in merge_types()");
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad type in merge_types()");
|
reporter->InternalError("bad type in merge_types()");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
32
src/Type.h
32
src/Type.h
|
@ -49,21 +49,19 @@ enum TypeTag
|
||||||
TYPE_STRING, // 7
|
TYPE_STRING, // 7
|
||||||
TYPE_PATTERN, // 8
|
TYPE_PATTERN, // 8
|
||||||
TYPE_ENUM, // 9
|
TYPE_ENUM, // 9
|
||||||
TYPE_TIMER, // 10
|
TYPE_PORT, // 10
|
||||||
TYPE_PORT, // 11
|
TYPE_ADDR, // 11
|
||||||
TYPE_ADDR, // 12
|
TYPE_SUBNET, // 12
|
||||||
TYPE_SUBNET, // 13
|
TYPE_ANY, // 13
|
||||||
TYPE_ANY, // 14
|
TYPE_TABLE, // 14
|
||||||
TYPE_TABLE, // 15
|
TYPE_RECORD, // 15
|
||||||
TYPE_UNION, // 16
|
TYPE_LIST, // 16
|
||||||
TYPE_RECORD, // 17
|
TYPE_FUNC, // 17
|
||||||
TYPE_LIST, // 18
|
TYPE_FILE, // 18
|
||||||
TYPE_FUNC, // 19
|
TYPE_VECTOR, // 19
|
||||||
TYPE_FILE, // 20
|
TYPE_OPAQUE, // 20
|
||||||
TYPE_VECTOR, // 21
|
TYPE_TYPE, // 21
|
||||||
TYPE_OPAQUE, // 22
|
TYPE_ERROR // 22
|
||||||
TYPE_TYPE, // 23
|
|
||||||
TYPE_ERROR // 24
|
|
||||||
#define NUM_TYPES (int(TYPE_ERROR) + 1)
|
#define NUM_TYPES (int(TYPE_ERROR) + 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,10 +124,8 @@ constexpr InternalTypeTag to_internal_type_tag(TypeTag tag) noexcept
|
||||||
return TYPE_INTERNAL_SUBNET;
|
return TYPE_INTERNAL_SUBNET;
|
||||||
|
|
||||||
case TYPE_PATTERN:
|
case TYPE_PATTERN:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_ANY:
|
case TYPE_ANY:
|
||||||
case TYPE_TABLE:
|
case TYPE_TABLE:
|
||||||
case TYPE_UNION:
|
|
||||||
case TYPE_RECORD:
|
case TYPE_RECORD:
|
||||||
case TYPE_LIST:
|
case TYPE_LIST:
|
||||||
case TYPE_FUNC:
|
case TYPE_FUNC:
|
||||||
|
@ -951,7 +947,7 @@ inline bool IsInterval(TypeTag t)
|
||||||
// True if the given type tag corresponds to a record type.
|
// True if the given type tag corresponds to a record type.
|
||||||
inline bool IsRecord(TypeTag t)
|
inline bool IsRecord(TypeTag t)
|
||||||
{
|
{
|
||||||
return (t == TYPE_RECORD || t == TYPE_UNION);
|
return (t == TYPE_RECORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// True if the given type tag corresponds to a function type.
|
// True if the given type tag corresponds to a function type.
|
||||||
|
|
|
@ -104,8 +104,6 @@ ZVal::ZVal(ValPtr v, const TypePtr& t)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ERROR:
|
case TYPE_ERROR:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_UNION:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
reporter->InternalError("bad type in ZVal constructor");
|
reporter->InternalError("bad type in ZVal constructor");
|
||||||
}
|
}
|
||||||
|
@ -185,8 +183,6 @@ ZVal::ZVal(const TypePtr& t)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ERROR:
|
case TYPE_ERROR:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_UNION:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
reporter->InternalError("bad type in ZVal constructor");
|
reporter->InternalError("bad type in ZVal constructor");
|
||||||
}
|
}
|
||||||
|
@ -275,8 +271,6 @@ ValPtr ZVal::ToVal(const TypePtr& t) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ERROR:
|
case TYPE_ERROR:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_UNION:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
default:
|
default:
|
||||||
v = nullptr;
|
v = nullptr;
|
||||||
|
|
14
src/parse.y
14
src/parse.y
|
@ -18,7 +18,7 @@
|
||||||
%token TOK_PORT TOK_PRINT TOK_RECORD TOK_REDEF
|
%token TOK_PORT TOK_PRINT TOK_RECORD TOK_REDEF
|
||||||
%token TOK_REMOVE_FROM TOK_RETURN TOK_SCHEDULE TOK_SET
|
%token TOK_REMOVE_FROM TOK_RETURN TOK_SCHEDULE TOK_SET
|
||||||
%token TOK_STRING TOK_SUBNET TOK_SWITCH TOK_TABLE
|
%token TOK_STRING TOK_SUBNET TOK_SWITCH TOK_TABLE
|
||||||
%token TOK_TIME TOK_TIMEOUT TOK_TIMER TOK_TYPE TOK_UNION TOK_VECTOR TOK_WHEN
|
%token TOK_TIME TOK_TIMEOUT TOK_TYPE TOK_VECTOR TOK_WHEN
|
||||||
%token TOK_WHILE TOK_AS TOK_IS
|
%token TOK_WHILE TOK_AS TOK_IS
|
||||||
|
|
||||||
%token TOK_ATTR_ADD_FUNC TOK_ATTR_DEFAULT TOK_ATTR_OPTIONAL TOK_ATTR_REDEF
|
%token TOK_ATTR_ADD_FUNC TOK_ATTR_DEFAULT TOK_ATTR_OPTIONAL TOK_ATTR_REDEF
|
||||||
|
@ -1023,11 +1023,6 @@ type:
|
||||||
$$ = base_type(TYPE_PATTERN)->Ref();
|
$$ = base_type(TYPE_PATTERN)->Ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_TIMER {
|
|
||||||
set_location(@1);
|
|
||||||
$$ = base_type(TYPE_TIMER)->Ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
| TOK_PORT {
|
| TOK_PORT {
|
||||||
set_location(@1);
|
set_location(@1);
|
||||||
$$ = base_type(TYPE_PORT)->Ref();
|
$$ = base_type(TYPE_PORT)->Ref();
|
||||||
|
@ -1070,13 +1065,6 @@ type:
|
||||||
$$ = new RecordType($4);
|
$$ = new RecordType($4);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_UNION '{' type_list '}'
|
|
||||||
{
|
|
||||||
set_location(@1, @4);
|
|
||||||
reporter->Error("union type not implemented");
|
|
||||||
$$ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
| TOK_ENUM '{' { set_location(@1); parse_new_enum(); } enum_body '}'
|
| TOK_ENUM '{' { set_location(@1); parse_new_enum(); } enum_body '}'
|
||||||
{
|
{
|
||||||
set_location(@1, @5);
|
set_location(@1, @5);
|
||||||
|
|
|
@ -297,9 +297,7 @@ switch return TOK_SWITCH;
|
||||||
table return TOK_TABLE;
|
table return TOK_TABLE;
|
||||||
time return TOK_TIME;
|
time return TOK_TIME;
|
||||||
timeout return TOK_TIMEOUT;
|
timeout return TOK_TIMEOUT;
|
||||||
timer return TOK_TIMER;
|
|
||||||
type return TOK_TYPE;
|
type return TOK_TYPE;
|
||||||
union return TOK_UNION;
|
|
||||||
vector return TOK_VECTOR;
|
vector return TOK_VECTOR;
|
||||||
when return TOK_WHEN;
|
when return TOK_WHEN;
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,6 @@ void CPP_TypeInits::Generate(InitsManager* im, vector<TypePtr>& ivec, int offset
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
case TYPE_FILE:
|
case TYPE_FILE:
|
||||||
|
|
|
@ -141,8 +141,6 @@ const char* CPPCompile::TypeTagName(TypeTag tag)
|
||||||
return "TYPE_TABLE";
|
return "TYPE_TABLE";
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
return "TYPE_TIME";
|
return "TYPE_TIME";
|
||||||
case TYPE_TIMER:
|
|
||||||
return "TYPE_TIMER";
|
|
||||||
case TYPE_TYPE:
|
case TYPE_TYPE:
|
||||||
return "TYPE_TYPE";
|
return "TYPE_TYPE";
|
||||||
case TYPE_VECTOR:
|
case TYPE_VECTOR:
|
||||||
|
@ -302,7 +300,6 @@ shared_ptr<CPP_InitInfo> CPPCompile::RegisterType(const TypePtr& tp)
|
||||||
case TYPE_PORT:
|
case TYPE_PORT:
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
case TYPE_FILE:
|
case TYPE_FILE:
|
||||||
|
|
|
@ -576,8 +576,6 @@ void ProfileFuncs::TraverseValue(const ValPtr& v)
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_UNION:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -777,8 +775,6 @@ p_hash_type ProfileFuncs::HashType(const Type* t)
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
case TYPE_SUBNET:
|
case TYPE_SUBNET:
|
||||||
case TYPE_TIME:
|
case TYPE_TIME:
|
||||||
case TYPE_TIMER:
|
|
||||||
case TYPE_UNION:
|
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
h = merge_p_hashes(h, p_hash(t));
|
h = merge_p_hashes(h, p_hash(t));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue