mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Remove support for building against Spicy versions before 1.8
zeek-6.0 shipped with spicy-1.8, but we still have dedicated handling for earlier versions of Spicy in the code. This patch cleans them up since these versions are unsupported.
This commit is contained in:
parent
0c55fb4dd7
commit
730316fc8a
5 changed files with 4 additions and 49 deletions
|
@ -101,13 +101,7 @@ void Manager::registerProtocolAnalyzer(const std::string& name, hilti::rt::Proto
|
||||||
|
|
||||||
analyzer::Component::factory_callback factory = nullptr;
|
analyzer::Component::factory_callback factory = nullptr;
|
||||||
|
|
||||||
#if SPICY_VERSION_NUMBER >= 10700
|
switch ( proto.value() ) {
|
||||||
auto proto_ = proto.value();
|
|
||||||
#else
|
|
||||||
auto proto_ = proto;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch ( proto_ ) {
|
|
||||||
case hilti::rt::Protocol::TCP: factory = spicy::rt::TCP_Analyzer::InstantiateAnalyzer; break;
|
case hilti::rt::Protocol::TCP: factory = spicy::rt::TCP_Analyzer::InstantiateAnalyzer; break;
|
||||||
case hilti::rt::Protocol::UDP: factory = spicy::rt::UDP_Analyzer::InstantiateAnalyzer; break;
|
case hilti::rt::Protocol::UDP: factory = spicy::rt::UDP_Analyzer::InstantiateAnalyzer; break;
|
||||||
default: reporter->Error("unsupported protocol in analyzer"); return;
|
default: reporter->Error("unsupported protocol in analyzer"); return;
|
||||||
|
@ -564,9 +558,7 @@ plugin::Configuration Manager::Configure() {
|
||||||
void Manager::InitPreScript() {
|
void Manager::InitPreScript() {
|
||||||
SPICY_DEBUG("Beginning pre-script initialization");
|
SPICY_DEBUG("Beginning pre-script initialization");
|
||||||
|
|
||||||
#if SPICY_VERSION_NUMBER >= 10700
|
|
||||||
hilti::rt::executeManualPreInits();
|
hilti::rt::executeManualPreInits();
|
||||||
#endif
|
|
||||||
|
|
||||||
autoDiscoverModules();
|
autoDiscoverModules();
|
||||||
|
|
||||||
|
@ -575,13 +567,7 @@ void Manager::InitPreScript() {
|
||||||
|
|
||||||
// Returns a port's Zeek-side transport protocol.
|
// Returns a port's Zeek-side transport protocol.
|
||||||
static ::TransportProto transport_protocol(const hilti::rt::Port port) {
|
static ::TransportProto transport_protocol(const hilti::rt::Port port) {
|
||||||
#if SPICY_VERSION_NUMBER >= 10700
|
switch ( port.protocol().value() ) {
|
||||||
auto proto = port.protocol().value();
|
|
||||||
#else
|
|
||||||
auto proto = port.protocol();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch ( proto ) {
|
|
||||||
case hilti::rt::Protocol::TCP: return ::TransportProto::TRANSPORT_TCP;
|
case hilti::rt::Protocol::TCP: return ::TransportProto::TRANSPORT_TCP;
|
||||||
case hilti::rt::Protocol::UDP: return ::TransportProto::TRANSPORT_UDP;
|
case hilti::rt::Protocol::UDP: return ::TransportProto::TRANSPORT_UDP;
|
||||||
case hilti::rt::Protocol::ICMP: return ::TransportProto::TRANSPORT_ICMP;
|
case hilti::rt::Protocol::ICMP: return ::TransportProto::TRANSPORT_ICMP;
|
||||||
|
@ -641,24 +627,17 @@ void Manager::InitPostScript() {
|
||||||
hilti_config.cout.reset();
|
hilti_config.cout.reset();
|
||||||
|
|
||||||
if ( id::find_const("Spicy::enable_profiling")->AsBool() )
|
if ( id::find_const("Spicy::enable_profiling")->AsBool() )
|
||||||
#if SPICY_VERSION_NUMBER >= 10800
|
|
||||||
hilti_config.enable_profiling = true;
|
hilti_config.enable_profiling = true;
|
||||||
#else
|
|
||||||
std::cerr << "Profiling is not supported with this version of Spicy, ignoring "
|
|
||||||
"'Spicy::enable_profiling'\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hilti_config.abort_on_exceptions = id::find_const("Spicy::abort_on_exceptions")->AsBool();
|
hilti_config.abort_on_exceptions = id::find_const("Spicy::abort_on_exceptions")->AsBool();
|
||||||
hilti_config.show_backtraces = id::find_const("Spicy::show_backtraces")->AsBool();
|
hilti_config.show_backtraces = id::find_const("Spicy::show_backtraces")->AsBool();
|
||||||
|
|
||||||
hilti::rt::configuration::set(hilti_config);
|
hilti::rt::configuration::set(hilti_config);
|
||||||
|
|
||||||
#if SPICY_VERSION_NUMBER >= 10700
|
|
||||||
auto spicy_config = ::spicy::rt::configuration::get();
|
auto spicy_config = ::spicy::rt::configuration::get();
|
||||||
spicy_config.hook_accept_input = hook_accept_input;
|
spicy_config.hook_accept_input = hook_accept_input;
|
||||||
spicy_config.hook_decline_input = hook_decline_input;
|
spicy_config.hook_decline_input = hook_decline_input;
|
||||||
::spicy::rt::configuration::set(std::move(spicy_config));
|
::spicy::rt::configuration::set(std::move(spicy_config));
|
||||||
#endif
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
::hilti::rt::init();
|
::hilti::rt::init();
|
||||||
|
@ -822,11 +801,7 @@ void Manager::loadModule(const hilti::rt::filesystem::path& path) {
|
||||||
else {
|
else {
|
||||||
SPICY_DEBUG(hilti::rt::fmt("Ignoring duplicate loading request for %s", canonical_path.native()));
|
SPICY_DEBUG(hilti::rt::fmt("Ignoring duplicate loading request for %s", canonical_path.native()));
|
||||||
}
|
}
|
||||||
#if SPICY_VERSION_NUMBER >= 10700
|
|
||||||
} catch ( const ::hilti::rt::UsageError& e ) {
|
} catch ( const ::hilti::rt::UsageError& e ) {
|
||||||
#else
|
|
||||||
} catch ( const ::hilti::rt::UserException& e ) {
|
|
||||||
#endif
|
|
||||||
hilti::rt::fatalError(e.what());
|
hilti::rt::fatalError(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,7 @@ function Spicy::__resource_usage%(%) : Spicy::ResourceUsage
|
||||||
r->Assign(n++, ru.memory_heap);
|
r->Assign(n++, ru.memory_heap);
|
||||||
r->Assign(n++, ru.num_fibers);
|
r->Assign(n++, ru.num_fibers);
|
||||||
r->Assign(n++, ru.max_fibers);
|
r->Assign(n++, ru.max_fibers);
|
||||||
#if SPICY_VERSION_NUMBER >= 10800
|
|
||||||
r->Assign(n++, ru.max_fiber_stack_size);
|
r->Assign(n++, ru.max_fiber_stack_size);
|
||||||
#endif
|
|
||||||
r->Assign(n++, ru.cached_fibers);
|
r->Assign(n++, ru.cached_fibers);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -119,10 +119,8 @@ Driver::Driver(std::unique_ptr<GlueCompiler> glue, const char* argv0, hilti::rt:
|
||||||
config.preprocessor_constants["HAVE_ZEEK"] = 1;
|
config.preprocessor_constants["HAVE_ZEEK"] = 1;
|
||||||
config.preprocessor_constants["ZEEK_VERSION"] = zeek_version;
|
config.preprocessor_constants["ZEEK_VERSION"] = zeek_version;
|
||||||
|
|
||||||
#if SPICY_VERSION_NUMBER >= 10500
|
|
||||||
::hilti::init();
|
::hilti::init();
|
||||||
::spicy::init();
|
::spicy::init();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Driver::~Driver() {}
|
Driver::~Driver() {}
|
||||||
|
|
|
@ -1011,14 +1011,8 @@ bool GlueCompiler::compile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SPICY_VERSION_NUMBER >= 10700
|
|
||||||
auto proto = a.protocol.value();
|
|
||||||
#else
|
|
||||||
auto proto = a.protocol;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hilti::ID protocol;
|
hilti::ID protocol;
|
||||||
switch ( proto ) {
|
switch ( a.protocol.value() ) {
|
||||||
case hilti::rt::Protocol::TCP: protocol = hilti::ID("hilti::Protocol::TCP"); break;
|
case hilti::rt::Protocol::TCP: protocol = hilti::ID("hilti::Protocol::TCP"); break;
|
||||||
case hilti::rt::Protocol::UDP: protocol = hilti::ID("hilti::Protocol::UDP"); break;
|
case hilti::rt::Protocol::UDP: protocol = hilti::ID("hilti::Protocol::UDP"); break;
|
||||||
default: hilti::logger().internalError("unexpected protocol");
|
default: hilti::logger().internalError("unexpected protocol");
|
||||||
|
|
|
@ -209,21 +209,11 @@ static hilti::Result<Nothing> parseOptions(int argc, char** argv, hilti::driver:
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Z':
|
case 'Z':
|
||||||
#if SPICY_VERSION_NUMBER >= 10800
|
|
||||||
driver_options->enable_profiling = true;
|
driver_options->enable_profiling = true;
|
||||||
compiler_options->enable_profiling = true;
|
compiler_options->enable_profiling = true;
|
||||||
#else
|
|
||||||
std::cerr << "Profiling is not supported with this version of Spicy, ignoring '-Z'\n";
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_CXX_LINK:
|
case OPT_CXX_LINK: compiler_options->cxx_link.emplace_back(optarg); break;
|
||||||
#if SPICY_VERSION_NUMBER >= 10600
|
|
||||||
compiler_options->cxx_link.emplace_back(optarg);
|
|
||||||
#else
|
|
||||||
return hilti::result::Error("option '--cxx-link' is only supported for Spicy 1.6 or newer");
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h': usage(); return Nothing();
|
case 'h': usage(); return Nothing();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue