mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +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;
|
||||
|
||||
#if SPICY_VERSION_NUMBER >= 10700
|
||||
auto proto_ = proto.value();
|
||||
#else
|
||||
auto proto_ = proto;
|
||||
#endif
|
||||
|
||||
switch ( proto_ ) {
|
||||
switch ( proto.value() ) {
|
||||
case hilti::rt::Protocol::TCP: factory = spicy::rt::TCP_Analyzer::InstantiateAnalyzer; break;
|
||||
case hilti::rt::Protocol::UDP: factory = spicy::rt::UDP_Analyzer::InstantiateAnalyzer; break;
|
||||
default: reporter->Error("unsupported protocol in analyzer"); return;
|
||||
|
@ -564,9 +558,7 @@ plugin::Configuration Manager::Configure() {
|
|||
void Manager::InitPreScript() {
|
||||
SPICY_DEBUG("Beginning pre-script initialization");
|
||||
|
||||
#if SPICY_VERSION_NUMBER >= 10700
|
||||
hilti::rt::executeManualPreInits();
|
||||
#endif
|
||||
|
||||
autoDiscoverModules();
|
||||
|
||||
|
@ -575,13 +567,7 @@ void Manager::InitPreScript() {
|
|||
|
||||
// Returns a port's Zeek-side transport protocol.
|
||||
static ::TransportProto transport_protocol(const hilti::rt::Port port) {
|
||||
#if SPICY_VERSION_NUMBER >= 10700
|
||||
auto proto = port.protocol().value();
|
||||
#else
|
||||
auto proto = port.protocol();
|
||||
#endif
|
||||
|
||||
switch ( proto ) {
|
||||
switch ( port.protocol().value() ) {
|
||||
case hilti::rt::Protocol::TCP: return ::TransportProto::TRANSPORT_TCP;
|
||||
case hilti::rt::Protocol::UDP: return ::TransportProto::TRANSPORT_UDP;
|
||||
case hilti::rt::Protocol::ICMP: return ::TransportProto::TRANSPORT_ICMP;
|
||||
|
@ -641,24 +627,17 @@ void Manager::InitPostScript() {
|
|||
hilti_config.cout.reset();
|
||||
|
||||
if ( id::find_const("Spicy::enable_profiling")->AsBool() )
|
||||
#if SPICY_VERSION_NUMBER >= 10800
|
||||
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.show_backtraces = id::find_const("Spicy::show_backtraces")->AsBool();
|
||||
|
||||
hilti::rt::configuration::set(hilti_config);
|
||||
|
||||
#if SPICY_VERSION_NUMBER >= 10700
|
||||
auto spicy_config = ::spicy::rt::configuration::get();
|
||||
spicy_config.hook_accept_input = hook_accept_input;
|
||||
spicy_config.hook_decline_input = hook_decline_input;
|
||||
::spicy::rt::configuration::set(std::move(spicy_config));
|
||||
#endif
|
||||
|
||||
try {
|
||||
::hilti::rt::init();
|
||||
|
@ -822,11 +801,7 @@ void Manager::loadModule(const hilti::rt::filesystem::path& path) {
|
|||
else {
|
||||
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 ) {
|
||||
#else
|
||||
} catch ( const ::hilti::rt::UserException& e ) {
|
||||
#endif
|
||||
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.num_fibers);
|
||||
r->Assign(n++, ru.max_fibers);
|
||||
#if SPICY_VERSION_NUMBER >= 10800
|
||||
r->Assign(n++, ru.max_fiber_stack_size);
|
||||
#endif
|
||||
r->Assign(n++, ru.cached_fibers);
|
||||
|
||||
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["ZEEK_VERSION"] = zeek_version;
|
||||
|
||||
#if SPICY_VERSION_NUMBER >= 10500
|
||||
::hilti::init();
|
||||
::spicy::init();
|
||||
#endif
|
||||
}
|
||||
|
||||
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;
|
||||
switch ( proto ) {
|
||||
switch ( a.protocol.value() ) {
|
||||
case hilti::rt::Protocol::TCP: protocol = hilti::ID("hilti::Protocol::TCP"); break;
|
||||
case hilti::rt::Protocol::UDP: protocol = hilti::ID("hilti::Protocol::UDP"); break;
|
||||
default: hilti::logger().internalError("unexpected protocol");
|
||||
|
|
|
@ -209,21 +209,11 @@ static hilti::Result<Nothing> parseOptions(int argc, char** argv, hilti::driver:
|
|||
}
|
||||
|
||||
case 'Z':
|
||||
#if SPICY_VERSION_NUMBER >= 10800
|
||||
driver_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;
|
||||
|
||||
case OPT_CXX_LINK:
|
||||
#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 OPT_CXX_LINK: compiler_options->cxx_link.emplace_back(optarg); break;
|
||||
|
||||
case 'h': usage(); return Nothing();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue