Linux fallout from the hoist the mac could not see: bindgen emits unsafe blocks (layout tests/accessors) into OUT_DIR, where nobody hand-writes SAFETY proofs — pyrowave-sys failed clippy on .25 with 17 of them, and libvpl-sys would do the same on the Windows leg. Both crates are bindings-only by charter (the safe wrapper lives with the consumer), so the allow is crate-wide with the rationale at the crate root; the hand-written link-sanity tests keep their proofs by convention.
37 lines
1.8 KiB
Rust
37 lines
1.8 KiB
Rust
//! Raw FFI bindings to the vendored PyroWave C API (`pyrowave.h`).
|
|
//!
|
|
//! Empty on targets other than Linux/Windows — see build.rs. The safe wrapper
|
|
//! lives with its consumer (`punktfunk-host`'s encoder backend, and later the
|
|
//! Rust clients' decoder backend); this crate is bindings only.
|
|
|
|
#![allow(non_upper_case_globals)]
|
|
#![allow(non_camel_case_types)]
|
|
#![allow(non_snake_case)]
|
|
// Bindgen output for a C API: u128 layout warnings and the like are upstream's concern.
|
|
#![allow(improper_ctypes)]
|
|
// The workspace-wide undocumented_unsafe_blocks deny cannot apply to GENERATED code: bindgen
|
|
// emits `unsafe {}` in layout tests/accessors and nobody hand-writes proofs into OUT_DIR. This
|
|
// crate is bindings-only by charter (the safe wrapper lives with the consumer), so the allow is
|
|
// crate-wide; the hand-written link-sanity test below still carries its proof by convention.
|
|
#![allow(clippy::undocumented_unsafe_blocks)]
|
|
|
|
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
|
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
|
|
|
#[cfg(all(test, any(target_os = "linux", target_os = "windows")))]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
/// Link sanity: statically linked archives resolve and the vendored pin is
|
|
/// the API version we designed against. No GPU or Vulkan loader required —
|
|
/// the version query touches no device state.
|
|
#[test]
|
|
fn api_version_matches_vendored_pin() {
|
|
let (mut major, mut minor, mut patch) = (0u32, 0u32, 0u32);
|
|
// SAFETY: the version query writes three u32s through live local out-pointers and
|
|
// touches no device or global state.
|
|
unsafe { pyrowave_get_api_version(&mut major, &mut minor, &mut patch) };
|
|
assert_eq!((major, minor, patch), (0, 4, 0), "vendored pyrowave API version moved — re-check the §4.2 protocol coupling before bumping");
|
|
}
|
|
}
|