Merge remote-tracking branch 'origin/topic/vern/CPP-feature-complete'

* origin/topic/vern/CPP-feature-complete:
  NEWS items for script profiling, "footprint" BiFs, and Trigger method deprecations
  tweaks per reviewing feedback
  make deprecation advice a bit more helpful
  format shell scripts per style guide
  add deprecation for Trigger Cache/Lookup interfaces
  helper scripts for -O C++ maintenance
  "-O use-C++" now fails if no C++ bodies wound up being applicable
  update environemnt variable names to match command-line arguments
  final changes for -O C++ feature completeness, mainly "when" statement support
  Change "when" statements that don't require closures to use new implementation. Provide hooks for script optimization access to "when" statements. Regularize treatment of naming and timeouts for Triggers.
  switch cached Trigger values to be opaque-and-generic, rather than assuming CallExpr's
  tracking of when statements/expressions occur in a "when" context
  fix bug that sometimes associated the wrong location with global statements
  fix incomplete AST traversal of "when" statements
  add some missing "when" closures
  regularize test suite names to avoid custom/outdated suffices
This commit is contained in:
Tim Wojtulewicz 2022-05-16 16:59:31 -07:00
commit 3d133ccb0a
45 changed files with 719 additions and 244 deletions

View file

@ -10,7 +10,7 @@ global result_count = 0;
function print_keys(a: opaque of Broker::Store)
{
when ( local s = Broker::keys(a) )
when [a] ( local s = Broker::keys(a) )
{
print "keys", s;
++result_count;

View file

@ -12,7 +12,7 @@ global step: count = 0;
function print_index(k: any)
{
when ( local r = Broker::get(h, k) )
when [k] ( local r = Broker::get(h, k) )
{
step += 1;
print fmt("[%d]", step), k, r$status, r$result;
@ -26,7 +26,7 @@ function print_index(k: any)
function print_exists(k: any)
{
when ( local r = Broker::exists(h, k) )
when [k] ( local r = Broker::exists(h, k) )
{
step += 1;
print fmt("[%d]", step), k, r;
@ -40,7 +40,7 @@ function print_exists(k: any)
function print_index_from_value(k: any, i: any)
{
when ( local r = Broker::get_index_from_value(h, k, i) )
when [k, i] ( local r = Broker::get_index_from_value(h, k, i) )
{
step += 1;
print fmt("[%d]", step), k, r$status, r$result;

View file

@ -12,7 +12,7 @@ global h: opaque of Broker::Store;
function print_index(k: any)
{
when ( local r = Broker::get(h, k) )
when [k] ( local r = Broker::get(h, k) )
{
print k, r$status, r$result;
}

View file

@ -52,7 +52,7 @@ function die()
{
local h: addr = 127.0.0.1;
when ( local hname = lookup_addr(h) )
when [h] ( local hname = lookup_addr(h) )
{
print "lookup successful";
terminate();

View file

@ -43,7 +43,7 @@ event do_another()
if ( ! done )
schedule 1sec { set_flag() };
when ( local result = async_func("from do_another()") )
when [local_dummy, anon] ( local result = async_func("from do_another()") )
{
print "async_func() return result in do_another()", result;
print local_dummy("from do_another() when block");
@ -66,7 +66,7 @@ event zeek_init()
schedule 1sec { set_flag() };
when ( local result = async_func("from zeek_init()") )
when [local_dummy, anon] ( local result = async_func("from zeek_init()") )
{
print "async_func() return result in zeek_init()", result;
print local_dummy("from zeek_init() when block");

View file

@ -9,7 +9,7 @@ event zeek_init()
{
local h: addr = 127.0.0.1;
when ( local hname = lookup_addr(h) )
when [h] ( local hname = lookup_addr(h) )
{
print "lookup successful";
terminate();
@ -21,9 +21,9 @@ event zeek_init()
local to = 5sec;
# Just checking that timeouts can use arbitrary expressions...
when ( local hname2 = lookup_addr(h) ) {}
when [h] ( local hname2 = lookup_addr(h) ) {}
timeout to {}
when ( local hname3 = lookup_addr(h) ) {}
when [h] ( local hname3 = lookup_addr(h) ) {}
timeout to + 2sec {}
print "done";