diff --git a/NEWS b/NEWS index 445305ea59..8542d7853b 100644 --- a/NEWS +++ b/NEWS @@ -356,6 +356,13 @@ Deprecated Functionality removal with the next Bro release. Bro's new configuration framework 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 ========= diff --git a/src/Expr.cc b/src/Expr.cc index 0c890eaea2..be4b05d6a2 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -909,11 +909,17 @@ void BinaryExpr::PromoteOps(TypeTag t) TypeTag bt1 = op1->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(); - if ( IsVector(bt2) ) + if ( is_vec2 ) 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 ) op1 = new ArithCoerceExpr(op1, t); if ( bt2 != t ) @@ -1003,7 +1009,10 @@ IncrExpr::IncrExpr(BroExprTag arg_tag, Expr* arg_op) if ( ! IsIntegral(t->AsVectorType()->YieldType()->Tag()) ) ExprError("vector elements must be integral for increment operator"); else + { + reporter->Warning("increment/decrement operations for vectors deprecated"); SetType(t->Ref()); + } } else {