diff --git a/NEWS b/NEWS index 93a28cb200..8cd4f3c201 100644 --- a/NEWS +++ b/NEWS @@ -16,7 +16,7 @@ New Functionality to the version in 2.5), and much of its implementation has been redone. There's a new script-level "broker" framework that supersedes the old "communication" framework, which is now - depracated. The "cluster" and "control" frameworks have been ported + deprecated. The "cluster" and "control" frameworks have been ported to Broker; same for BroControl. For more about the new Broker framework, see doc/frameworks/broker.rst (there's also guide there for porting existing Bro scripts to Broker). For more about Broker @@ -252,7 +252,7 @@ New Functionality Changed Functionality --------------------- - - ALl communication is now handled through Broker, requiring changes + - All communication is now handled through Broker, requiring changes to existing scripts to port them over to the new API. The Broker framework documentation comes with a porting guide. @@ -356,6 +356,16 @@ 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 built-in function merge_pattern() has been deprecated. It will + be replaced by the '&' operator for patterns. + +- 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 1ab82853c3..ef8da8edbb 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 { @@ -1689,13 +1698,20 @@ BoolExpr::BoolExpr(BroExprTag arg_tag, Expr* arg_op1, Expr* arg_op2) if ( BothBool(bt1, bt2) ) { if ( is_vector(op1) || is_vector(op2) ) + { + if ( ! (is_vector(op1) && is_vector(op2)) ) + reporter->Warning("mixing vector and scalar operands is deprecated"); SetType(new VectorType(base_type(TYPE_BOOL))); + } else SetType(base_type(TYPE_BOOL)); } else if ( bt1 == TYPE_PATTERN && bt2 == bt1 ) + { + reporter->Warning("&& and || operators deprecated for pattern operands"); SetType(base_type(TYPE_PATTERN)); + } else ExprError("requires boolean operands"); @@ -1786,7 +1802,7 @@ Val* BoolExpr::Eval(Frame* f) const VectorVal* result = 0; - // It's either and EXPR_AND_AND or an EXPR_OR_OR. + // It's either an EXPR_AND_AND or an EXPR_OR_OR. bool is_and = (tag == EXPR_AND_AND); if ( scalar_v->IsZero() == is_and ) diff --git a/src/Val.cc b/src/Val.cc index acf0b6f915..36269ad9c9 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -3228,7 +3228,7 @@ bool VectorVal::AssignRepeat(unsigned int index, unsigned int how_many, ResizeAtLeast(index + how_many); for ( unsigned int i = index; i < index + how_many; ++i ) - if ( ! Assign(i, element ) ) + if ( ! Assign(i, element->Ref() ) ) return false; return true; diff --git a/src/bro.bif b/src/bro.bif index 652b8cdd07..27020b2601 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -2958,7 +2958,7 @@ function uuid_to_string%(uuid: string%): string ## ## This function must be called at Bro startup time, e.g., in the event ## :bro:id:`bro_init`. -function merge_pattern%(p1: pattern, p2: pattern%): pattern +function merge_pattern%(p1: pattern, p2: pattern%): pattern &deprecated %{ if ( bro_start_network_time != 0.0 ) {