From 26a4b486d71bd023d6dd2ba3c02eadf23888cf4d Mon Sep 17 00:00:00 2001 From: Lattice 0 Date: Fri, 13 Nov 2026 19:10:15 -0300 Subject: [PATCH] Don't bind the C library functions that std defines too: memcpy, memmove, memset, memcmp, bcmp, strlen FFmpeg's headers include , and bindgen declared these with c_ulong for size_t where Rust's standard library has usize, which rustc warns about (suspicious_runtime_symbol_definitions, six warnings in every build). They aren't FFmpeg's API. build.rs blocklists them, and the tracked src/binding.rs drops the same six declarations, as the blocklist would generate it. --- build.rs | 4 ++++ src/binding.rs | 38 -------------------------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/build.rs b/build.rs index f1e4d02..82c5fde 100644 --- a/build.rs +++ b/build.rs @@ -265,6 +265,10 @@ fn generate_bindings(ffmpeg_include_dir: &Path, headers: &[PathBuf]) -> Bindings .clang_arg(format!("-I{}", ffmpeg_include_dir)) // Workaround: https://github.com/rust-lang/rust-bindgen/issues/2159 .blocklist_type("__mingw_ldbl_type_t") + // The C library's functions that Rust's standard library also uses: FFmpeg's headers include + // , and bindgen declares them with `c_ulong` for `size_t` where std has `usize`, which + // rustc warns about (`suspicious_runtime_symbol_definitions`). They aren't FFmpeg's API + .blocklist_function("memcpy|memmove|memset|memcmp|bcmp|strlen") // Stop bindgen from prefixing enums .prepend_enum_name(false) }, diff --git a/src/binding.rs b/src/binding.rs index 71075e3..a2750ea 100644 --- a/src/binding.rs +++ b/src/binding.rs @@ -5650,20 +5650,6 @@ extern "C" { pub fn getloadavg(__loadavg: *mut f64, __nelem: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { - pub fn memcpy( - __dest: *mut ::std::os::raw::c_void, - __src: *const ::std::os::raw::c_void, - __n: ::std::os::raw::c_ulong, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn memmove( - __dest: *mut ::std::os::raw::c_void, - __src: *const ::std::os::raw::c_void, - __n: ::std::os::raw::c_ulong, - ) -> *mut ::std::os::raw::c_void; -} extern "C" { pub fn memccpy( __dest: *mut ::std::os::raw::c_void, @@ -5672,20 +5658,6 @@ extern "C" { __n: ::std::os::raw::c_ulong, ) -> *mut ::std::os::raw::c_void; } -extern "C" { - pub fn memset( - __s: *mut ::std::os::raw::c_void, - __c: ::std::os::raw::c_int, - __n: ::std::os::raw::c_ulong, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn memcmp( - __s1: *const ::std::os::raw::c_void, - __s2: *const ::std::os::raw::c_void, - __n: ::std::os::raw::c_ulong, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn __memcmpeq( __s1: *const ::std::os::raw::c_void, @@ -5917,9 +5889,6 @@ extern "C" { __n: ::std::os::raw::c_ulong, ) -> *mut ::std::os::raw::c_void; } -extern "C" { - pub fn strlen(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_ulong; -} extern "C" { pub fn strnlen(__string: *const ::std::os::raw::c_char, __maxlen: usize) -> usize; } @@ -5940,13 +5909,6 @@ extern "C" { __l: locale_t, ) -> *mut ::std::os::raw::c_char; } -extern "C" { - pub fn bcmp( - __s1: *const ::std::os::raw::c_void, - __s2: *const ::std::os::raw::c_void, - __n: ::std::os::raw::c_ulong, - ) -> ::std::os::raw::c_int; -} extern "C" { pub fn bcopy( __src: *const ::std::os::raw::c_void,