From b864772e8ac18df273afeb8d2ce471422591fc73 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Thu, 21 Jun 2018 15:15:05 -0700 Subject: [PATCH 1/6] fixed typos in NEWS --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 93a28cb200..445305ea59 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. From 6c8562bbdd45d4e5499d4b6e6dc1eca1ca8a9d77 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Thu, 21 Jun 2018 15:50:56 -0700 Subject: [PATCH 2/6] deprecate && / || operators for patterns --- src/Expr.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Expr.cc b/src/Expr.cc index 1ab82853c3..0c890eaea2 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -1695,7 +1695,10 @@ BoolExpr::BoolExpr(BroExprTag arg_tag, Expr* arg_op1, Expr* arg_op2) } 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"); From cff68b437152c2117e3ac8a0565e040b29ad92cc Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 22 Jun 2018 10:03:13 -0700 Subject: [PATCH 3/6] deprecate mixing scalars and vectors --- NEWS | 7 +++++++ src/Expr.cc | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) 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 { From b811a8e7a6fa4d2b56b60937fadbe144cdc4ed51 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 22 Jun 2018 13:40:53 -0700 Subject: [PATCH 4/6] bug fix (and typo fix) for vector+scalar boolean operations --- src/Expr.cc | 2 +- src/Val.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Expr.cc b/src/Expr.cc index be4b05d6a2..cd431fdca1 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -1798,7 +1798,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 4da4a35d48..61cca185df 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -3226,7 +3226,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; From 89b7b88e75f7662fc655d73ef81827290941f1db Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 22 Jun 2018 13:43:51 -0700 Subject: [PATCH 5/6] deprecate boolean scalar+vector operations --- src/Expr.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Expr.cc b/src/Expr.cc index cd431fdca1..ef8da8edbb 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -1698,7 +1698,11 @@ 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)); } From 9e2c70b90b79db440873bdbe55ed735f6d04033b Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 22 Jun 2018 14:17:15 -0700 Subject: [PATCH 6/6] deprecate merge_patterns() --- NEWS | 3 +++ src/bro.bif | 2 ++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 8542d7853b..8cd4f3c201 100644 --- a/NEWS +++ b/NEWS @@ -360,6 +360,9 @@ Deprecated Functionality 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. diff --git a/src/bro.bif b/src/bro.bif index 652b8cdd07..f0641104c9 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -2966,6 +2966,8 @@ function merge_pattern%(p1: pattern, p2: pattern%): pattern return 0; } + reporter->Warning("merge_pattern() builtin-function has been deprecated"); + RE_Matcher* re = new RE_Matcher(); re->AddPat(p1->PatternText()); re->AddPat(p2->PatternText());