From 2f9272f2d57ff2b1c45a764797e91e6da483da6a Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Sat, 1 Apr 2023 20:26:55 -0700 Subject: [PATCH 1/2] tweaks for "-O C++" of BTest's with conditional code --- testing/btest/language/at-if-lambda.zeek | 8 -------- .../policy/frameworks/dpd/packet-segment-logging.zeek | 2 -- testing/btest/supervisor/config-cluster-pcap.zeek | 1 + 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/testing/btest/language/at-if-lambda.zeek b/testing/btest/language/at-if-lambda.zeek index 887a15c2c7..e8d1133c08 100644 --- a/testing/btest/language/at-if-lambda.zeek +++ b/testing/btest/language/at-if-lambda.zeek @@ -9,11 +9,7 @@ event zeek_init() { local make_epoch_result = function(pass_name: string): function(ts: time): time { -@if ( Version::at_least("4.1") ) return function [pass_name] (ts: time): time -@else - return function (ts: time) -@endif { print pass_name; return ts; @@ -35,11 +31,7 @@ event zeek_init() { local make_epoch_result = function(pass_name: string): function(ts: time): time { -@if ( Version::at_least("4.1") ) return function [pass_name] (ts: time): time { -@else - return function (ts: time) { -@endif print pass_name; return ts; }; diff --git a/testing/btest/scripts/policy/frameworks/dpd/packet-segment-logging.zeek b/testing/btest/scripts/policy/frameworks/dpd/packet-segment-logging.zeek index 5f021ec746..f5e2366c30 100644 --- a/testing/btest/scripts/policy/frameworks/dpd/packet-segment-logging.zeek +++ b/testing/btest/scripts/policy/frameworks/dpd/packet-segment-logging.zeek @@ -9,10 +9,8 @@ event analyzer_violation(c: connection, atype: AllAnalyzers::Tag, aid: count, re print "analyzer_violation", c$id, atype, aid, reason; } -@if ( Version::at_least("5.1") ) event analyzer_violation_info(tag: AllAnalyzers::Tag, info: AnalyzerViolationInfo) { print "reason", info$reason; print "data", fmt("%s", info$data); } -@endif diff --git a/testing/btest/supervisor/config-cluster-pcap.zeek b/testing/btest/supervisor/config-cluster-pcap.zeek index a373d05702..88130c20f2 100644 --- a/testing/btest/supervisor/config-cluster-pcap.zeek +++ b/testing/btest/supervisor/config-cluster-pcap.zeek @@ -1,4 +1,5 @@ # @TEST-DOC: Test support for pcap_file on Supervisor::ClusterEndpoint and Supervisor::NodeConfig +# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1" # # @TEST-PORT: MANAGER_PORT # @TEST-PORT: WORKER_PORT From b5603fe5bf8e53bf82199fca5328c068bad01714 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Sat, 1 Apr 2023 21:06:42 -0700 Subject: [PATCH 2/2] addressed static analysis concern about possible null pointer --- src/script_opt/CPP/InitsInfo.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/script_opt/CPP/InitsInfo.cc b/src/script_opt/CPP/InitsInfo.cc index c7eb4ebbc4..924150f317 100644 --- a/src/script_opt/CPP/InitsInfo.cc +++ b/src/script_opt/CPP/InitsInfo.cc @@ -329,6 +329,7 @@ AttrInfo::AttrInfo(CPPCompile* _c, const AttrPtr& attr) : CompoundItemInfo(_c) else { ASSERT(a_e->Tag() == EXPR_RECORD_COERCE); + ASSERT(gi); vals.emplace_back(Fmt(static_cast(AE_RECORD))); vals.emplace_back(Fmt(gi->Offset())); }