diff --git a/CHANGES b/CHANGES index 9938d4c503..85e2b324fb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,35 @@ +6.2.0-dev.533 | 2024-02-08 15:12:16 +0100 + + * Bump zeekjs for STMT_ANY deprecation (Arne Welzel, Corelight) + + * GH-3529: Stmt: Deprecate STMT_ANY (Arne Welzel, Corelight) + + This isn't used in-tree and has been misused by some external plugins + of mine (zeekjs and zeek-perf-support) for their own Stmt subclasses. + These plugins should be updated to use the new STMT_EXTERN statement. + + Handle STMT_ANY explicitly in stmt_name() for the time being + to fix #3529 until we remove STMT_ANY for good. + + * Stmt: Introduce STMT_EXTERN (Arne Welzel, Corelight) + + It's currently possible for plugin's to implement their own statement + subclasses and override the Exec() implementation. This has been leveraged + by ZeekJS [1] and zeek-perf-support [2] as well as a private WASM plugin. + All of these used STMT_ANY as the tag of their own statement subclasses. + + With STMT_EXTERN, we make the possibility to add external code into the AST + somewhat more supported. It's all in detail space and plugin authors have + no guarantee for stability, but it seems such a powerful extension point + that IMO we should keep it. + + I'm conscious there's the broader topic how this interacts with ZAM + optimization like in-lining or rewriting of statements. However, this + already applies to the STMT_ANY usage of the mentioned plugins. + + [1] https://github.com/corelight/zeekjs + [2] https://github.com/zeek/zeek-perf-support + 6.2.0-dev.528 | 2024-02-07 12:45:30 -0700 * Update .gitignore to add Emacs and Vim temp files (Tim Wojtulewicz) diff --git a/VERSION b/VERSION index 0236809319..911478b6f7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.2.0-dev.528 +6.2.0-dev.533 diff --git a/auxil/zeekjs b/auxil/zeekjs index 70d88f4b10..84826e2f73 160000 --- a/auxil/zeekjs +++ b/auxil/zeekjs @@ -1 +1 @@ -Subproject commit 70d88f4b10e36f8715eb0f2a25eb0fc0eb4fce37 +Subproject commit 84826e2f733f69843fb470328877c27758ebe164 diff --git a/src/Stmt.cc b/src/Stmt.cc index cf455c44ed..9c2a593b91 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -52,8 +52,15 @@ const char* stmt_name(StmtTag t) { "ZAM", "null", "assert", + "extern", }; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + if ( int(t) == STMT_ANY ) + return "any"; +#pragma GCC diagnostic pop + return stmt_names[int(t)]; } diff --git a/src/StmtEnums.h b/src/StmtEnums.h index 3eb463eab9..7cac90deae 100644 --- a/src/StmtEnums.h +++ b/src/StmtEnums.h @@ -6,7 +6,7 @@ namespace zeek::detail { // These are in a separate file to break circular dependences enum StmtTag { - STMT_ANY = -1, + STMT_ANY [[deprecated("Remove in v7.1 - Unused and plugins should use STMT_EXTERN.")]] = -1, STMT_ALARM, // Does no longer exist but kept to create enums consistent. STMT_PRINT, STMT_EVENT, @@ -31,7 +31,8 @@ enum StmtTag { STMT_ZAM, // a ZAM function body STMT_NULL, STMT_ASSERT, -#define NUM_STMTS (int(STMT_ASSERT) + 1) + STMT_EXTERN, // for custom Stmt subclasses provided by plugins +#define NUM_STMTS (int(STMT_EXTERN) + 1) }; enum StmtFlowType {