From e4f71621b7eb37feb0dd579e6c0c13a828cc13f0 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Mon, 31 Mar 2025 21:12:22 +0200 Subject: [PATCH] rust: fix clippy missing_abi warning warning: extern declarations without an explicit ABI are deprecated --> src/core.rs:72:1 | 72 | extern { | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: `#[warn(missing_abi)]` on by default --- rust/src/applayer.rs | 6 +++--- rust/src/core.rs | 4 ++-- rust/src/detect/mod.rs | 2 +- rust/src/filecontainer.rs | 2 +- rust/src/frames.rs | 2 +- rust/src/lua.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 943d35c16a..2663d9a515 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -494,7 +494,7 @@ pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char; // Defined in app-layer-register.h /// cbindgen:ignore -extern { +extern "C" { pub fn AppLayerRegisterProtocolDetection(parser: *const RustParser, enable_default: c_int) -> AppProto; pub fn AppLayerRegisterParserAlias(parser_name: *const c_char, alias_name: *const c_char); pub fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProto) -> c_int; @@ -503,7 +503,7 @@ extern { // Defined in app-layer-detect-proto.h /// cbindgen:ignore -extern { +extern "C" { pub fn AppLayerForceProtocolChange(f: *const Flow, new_proto: AppProto); pub fn AppLayerProtoDetectPPRegister(ipproto: u8, portstr: *const c_char, alproto: AppProto, min_depth: u16, max_depth: u16, dir: u8, @@ -543,7 +543,7 @@ pub const _APP_LAYER_TX_INSPECTED_TS: u8 = BIT_U8!(2); pub const _APP_LAYER_TX_INSPECTED_TC: u8 = BIT_U8!(3); /// cbindgen:ignore -extern { +extern "C" { pub fn AppLayerParserStateSetFlag(state: *mut c_void, flag: u16); pub fn AppLayerParserStateIssetFlag(state: *mut c_void, flag: u16) -> u16; pub fn AppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32); diff --git a/rust/src/core.rs b/rust/src/core.rs index 07fe219c50..59be1e52fb 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -69,7 +69,7 @@ macro_rules!BIT_U64 { // Defined in app-layer-protos.h /// cbindgen:ignore -extern { +extern "C" { pub fn StringToAppProto(proto_name: *const u8) -> AppProto; } @@ -181,7 +181,7 @@ pub struct SuricataFileContext { } /// cbindgen:ignore -extern { +extern "C" { pub fn SCGetContext() -> &'static mut SuricataContext; } diff --git a/rust/src/detect/mod.rs b/rust/src/detect/mod.rs index b970c20629..19a5e34818 100644 --- a/rust/src/detect/mod.rs +++ b/rust/src/detect/mod.rs @@ -86,7 +86,7 @@ pub(crate) const SIGMATCH_QUOTES_MANDATORY: u16 = 0x40; // BIT_U16(6) in detect. pub const SIGMATCH_INFO_STICKY_BUFFER: u16 = 0x200; // BIT_U16(9) /// cbindgen:ignore -extern { +extern "C" { pub fn DetectBufferSetActiveList(de: *mut c_void, s: *mut c_void, bufid: c_int) -> c_int; pub fn DetectHelperGetData( de: *mut c_void, transforms: *const c_void, flow: *const c_void, flow_flags: u8, diff --git a/rust/src/filecontainer.rs b/rust/src/filecontainer.rs index 28d10cf05c..2db0b40cc6 100644 --- a/rust/src/filecontainer.rs +++ b/rust/src/filecontainer.rs @@ -24,7 +24,7 @@ use crate::core::*; // Defined in util-file.h /// cbindgen:ignore -extern { +extern "C" { pub fn FileFlowFlagsToFlags(flow_file_flags: u16, flags: u8) -> u16; } diff --git a/rust/src/frames.rs b/rust/src/frames.rs index b1dba3ea40..2e8ffb5354 100644 --- a/rust/src/frames.rs +++ b/rust/src/frames.rs @@ -31,7 +31,7 @@ struct CFrame { // Defined in app-layer-register.h /// cbindgen:ignore -extern { +extern "C" { #[cfg(not(test))] fn AppLayerFrameNewByRelativeOffset( flow: *const Flow, stream_slice: *const StreamSlice, frame_start_rel: u32, len: i64, diff --git a/rust/src/lua.rs b/rust/src/lua.rs index e68ba18be5..43855574de 100644 --- a/rust/src/lua.rs +++ b/rust/src/lua.rs @@ -25,7 +25,7 @@ use std::os::raw::c_long; pub enum CLuaState {} /// cbindgen:ignore -extern { +extern "C" { fn lua_createtable(lua: *mut CLuaState, narr: c_int, nrec: c_int); fn lua_settable(lua: *mut CLuaState, idx: c_long); fn lua_pushlstring(lua: *mut CLuaState, s: *const c_char, len: usize); -- 2.47.2