mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
deprecate mixing scalars and vectors
This commit is contained in:
parent
6c8562bbdd
commit
cff68b4371
2 changed files with 18 additions and 2 deletions
7
NEWS
7
NEWS
|
@ -356,6 +356,13 @@ Deprecated Functionality
|
||||||
removal with the next Bro release. Bro's new configuration framework
|
removal with the next Bro release. Bro's new configuration framework
|
||||||
is taking its place.
|
is taking its place.
|
||||||
|
|
||||||
|
- Mixing of scalars and vectors, such as "v + e" yielding a vector
|
||||||
|
corresponding to the vector v with the scalar e added to each of
|
||||||
|
its elements, has been deprecated.
|
||||||
|
|
||||||
|
- The undocumented feature of using "&&" and "||" operators for patterns
|
||||||
|
has been deprecated.
|
||||||
|
|
||||||
Bro 2.5.1
|
Bro 2.5.1
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
|
13
src/Expr.cc
13
src/Expr.cc
|
@ -909,11 +909,17 @@ void BinaryExpr::PromoteOps(TypeTag t)
|
||||||
TypeTag bt1 = op1->Type()->Tag();
|
TypeTag bt1 = op1->Type()->Tag();
|
||||||
TypeTag bt2 = op2->Type()->Tag();
|
TypeTag bt2 = op2->Type()->Tag();
|
||||||
|
|
||||||
if ( IsVector(bt1) )
|
bool is_vec1 = IsVector(bt1);
|
||||||
|
bool is_vec2 = IsVector(bt2);
|
||||||
|
|
||||||
|
if ( is_vec1 )
|
||||||
bt1 = op1->Type()->AsVectorType()->YieldType()->Tag();
|
bt1 = op1->Type()->AsVectorType()->YieldType()->Tag();
|
||||||
if ( IsVector(bt2) )
|
if ( is_vec2 )
|
||||||
bt2 = op2->Type()->AsVectorType()->YieldType()->Tag();
|
bt2 = op2->Type()->AsVectorType()->YieldType()->Tag();
|
||||||
|
|
||||||
|
if ( (is_vec1 || is_vec2) && ! (is_vec1 && is_vec2) )
|
||||||
|
reporter->Warning("mixing vector and scalar operands is deprecated");
|
||||||
|
|
||||||
if ( bt1 != t )
|
if ( bt1 != t )
|
||||||
op1 = new ArithCoerceExpr(op1, t);
|
op1 = new ArithCoerceExpr(op1, t);
|
||||||
if ( bt2 != t )
|
if ( bt2 != t )
|
||||||
|
@ -1003,7 +1009,10 @@ IncrExpr::IncrExpr(BroExprTag arg_tag, Expr* arg_op)
|
||||||
if ( ! IsIntegral(t->AsVectorType()->YieldType()->Tag()) )
|
if ( ! IsIntegral(t->AsVectorType()->YieldType()->Tag()) )
|
||||||
ExprError("vector elements must be integral for increment operator");
|
ExprError("vector elements must be integral for increment operator");
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
reporter->Warning("increment/decrement operations for vectors deprecated");
|
||||||
SetType(t->Ref());
|
SetType(t->Ref());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue