Repository navigation
Conversation
…ove, memset, memcmp, bcmp, strlen FFmpeg's headers include <string.h>, 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the six warnings that every build of this crate prints with a recent rustc:
Why
build.rsruns bindgen on FFmpeg's headers with no allowlist, and FFmpeg's headers include<string.h>. So the bindings declare about 50 C library functions, which aren't FFmpeg's API. Six of them are runtime symbols that Rust's standard library defines too: bindgen declares them withc_ulongforsize_t, where std hasusize, and rustc flags the mismatch. On LP64 Linux and macOS the two are the same size, but on Windowsc_ulongis 32 bits.What changes
build.rs:.blocklist_function("memcpy|memmove|memset|memcmp|bcmp|strlen"), so bindgen no longer declares them. bindgen anchors the pattern: in the regenerated bindings exactly those six go, andmemchr,memccpy,strnlen,memmemandmempcpystay.src/binding.rs, the tracked binding that docs.rs and theuse_prebuilt_bindingfeature copy: the same sixextern "C"blocks removed (38 lines, nothing else), which is what the blocklist generates. It couldn't be regenerated here, as that needs FFmpeg 8.1's headers.Nothing in the crate uses these six. Code that called them through
rusty_ffmpeg::ffiwould usestd::ptr::copyand the like, orlibc.Tested
With
RUSTFLAGS="-D warnings", offline, in a container (rustc 1.98.1, bindgen 0.72.1):DOCS_RS=1 cargo check --features ffmpeg8_1(the tracked binding)cargo check --features ffmpeg8, bindgen on FFmpeg 8.0.3's headers throughFFMPEG_PKG_CONFIG_PATHThe 0.16 line's numbers come from lattice0-labs/supernova, which uses this crate through rsmpeg and where these warnings showed in every build.
Not tested: Windows, and generating against FFmpeg 8.1's headers.