mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/bbannier/fix-spicy-main'
* origin/topic/bbannier/fix-spicy-main: Fix clang-tidy `bugprone-inc-dec-in-conditions` report in Spicy plugins glue compiler Fix clang-tidy `performance-enum-size` reports in Spicy plugin's glue compiler Remove unneeded copies in Spicy plugin glue compiler Adjust for renamed function flavor in Spicy development version
This commit is contained in:
commit
912356deac
4 changed files with 28 additions and 14 deletions
14
CHANGES
14
CHANGES
|
@ -1,3 +1,17 @@
|
|||
8.0.0-dev.87 | 2025-05-12 11:33:38 -0700
|
||||
|
||||
* Fix clang-tidy `bugprone-inc-dec-in-conditions` report in Spicy plugins glue compiler (Benjamin Bannier, Corelight)
|
||||
|
||||
* Fix clang-tidy `performance-enum-size` reports in Spicy plugin's glue compiler (Benjamin Bannier, Corelight)
|
||||
|
||||
* Remove unneeded copies in Spicy plugin glue compiler (Benjamin Bannier, Corelight)
|
||||
|
||||
* Adjust for renamed function flavor in Spicy development version (Benjamin Bannier, Corelight)
|
||||
|
||||
With zeek/spicy#2048 the flavor for functions was renamed from
|
||||
`Standard` to `Function`. This patch adapts the code for that while
|
||||
still allowing using earlier Spicy versions.
|
||||
|
||||
8.0.0-dev.82 | 2025-05-09 17:25:38 +0200
|
||||
|
||||
* speed up file analysis, remove IncrementByteCount (Justin Azoff)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
8.0.0-dev.82
|
||||
8.0.0-dev.87
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ceb058a517e1feb042ebbaf6fb80facf4b15a23d
|
||||
Subproject commit abd484926df173d8351bc1269a5ac0ad848b3d6e
|
|
@ -38,12 +38,8 @@ static std::string::size_type looking_at(const std::string& chunk, std::string::
|
|||
const std::string_view& token) {
|
||||
eat_spaces(chunk, &i);
|
||||
|
||||
for ( char j : token ) {
|
||||
if ( i >= chunk.size() || chunk[i++] != j )
|
||||
return 0;
|
||||
}
|
||||
|
||||
return i;
|
||||
bool token_at_position = i < chunk.size() && token == std::string_view(chunk).substr(i, token.size());
|
||||
return token_at_position ? i + token.size() : 0;
|
||||
}
|
||||
|
||||
static void eat_token(const std::string& chunk, std::string::size_type* i, const std::string_view& token) {
|
||||
|
@ -343,7 +339,7 @@ hilti::Result<std::string> GlueCompiler::getNextEvtBlock(std::istream& in, int*
|
|||
std::string chunk;
|
||||
|
||||
// Parser need to track whether we are inside a string or a comment.
|
||||
enum State { Default, InComment, InString } state = Default;
|
||||
enum State : char { Default, InComment, InString } state = Default;
|
||||
char prev = '\0';
|
||||
|
||||
while ( true ) {
|
||||
|
@ -666,7 +662,7 @@ glue::ProtocolAnalyzer GlueCompiler::parseProtocolAnalyzer(const std::string& ch
|
|||
|
||||
eat_token(chunk, &i, ":");
|
||||
|
||||
enum { orig, resp, both } dir;
|
||||
enum Dir : char { orig, resp, both } dir;
|
||||
|
||||
while ( true ) {
|
||||
if ( looking_at(chunk, i, "parse") ) {
|
||||
|
@ -1046,7 +1042,7 @@ bool GlueCompiler::compile() {
|
|||
preinit_body.addCall("zeek_rt::register_file_analyzer",
|
||||
{builder()->stringMutable(a.name.str()),
|
||||
builder()->vector(hilti::util::transform(a.mime_types,
|
||||
[&](auto m) {
|
||||
[&](const auto& m) {
|
||||
return builder()
|
||||
->stringMutable(m)
|
||||
->template as<hilti::Expression>();
|
||||
|
@ -1100,7 +1096,7 @@ bool GlueCompiler::compile() {
|
|||
m->spicy_module->add(context(), import_);
|
||||
|
||||
// Create a vector of unique parent paths from all EVTs files going into this module.
|
||||
auto search_dirs = hilti::util::transform(m->evts, [](auto p) { return p.parent_path(); });
|
||||
auto search_dirs = hilti::util::transform(m->evts, [](const auto& p) { return p.parent_path(); });
|
||||
auto search_dirs_vec = std::vector<hilti::rt::filesystem::path>(search_dirs.begin(), search_dirs.end());
|
||||
|
||||
// Import any dependencies.
|
||||
|
@ -1120,11 +1116,15 @@ bool GlueCompiler::compile() {
|
|||
preinit_body.addCall("zeek_rt::register_spicy_module_end", {});
|
||||
|
||||
if ( ! preinit_body.empty() ) {
|
||||
#if SPICY_VERSION_NUMBER >= 11400
|
||||
constexpr auto zeek_preinit_flavor = hilti::type::function::Flavor::Function;
|
||||
#else
|
||||
constexpr auto zeek_preinit_flavor = hilti::type::function::Flavor::Standard;
|
||||
#endif
|
||||
auto preinit_function =
|
||||
builder()->function(hilti::ID("zeek_preinit"),
|
||||
builder()->qualifiedType(builder()->typeVoid(), hilti::Constness::Const), {},
|
||||
preinit_body.block(), hilti::type::function::Flavor::Standard,
|
||||
hilti::declaration::Linkage::PreInit);
|
||||
preinit_body.block(), zeek_preinit_flavor, hilti::declaration::Linkage::PreInit);
|
||||
init_module->add(context(), preinit_function);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue