From 90bcfc8cc905b09d99064fc17a745c8ae2288c62 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 20 Sep 2020 11:43:14 +0200 Subject: Remove unnecessary __uint*_t typedefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While bindgen is able to replace the C uint types with the correct Rust types, it still generates typedefs for __uint{8,16,32,64}_t [0]. We don’t need these typedefs, so we add a patch to remove them. [0] https://github.com/rust-lang/rust-bindgen/issues/1663 --- patches/remove-uint.diff | 21 +++++++++++++++++++++ patches/series | 1 + src/ffi.rs | 4 ---- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 patches/remove-uint.diff diff --git a/patches/remove-uint.diff b/patches/remove-uint.diff new file mode 100644 index 0000000..2db1d95 --- /dev/null +++ b/patches/remove-uint.diff @@ -0,0 +1,21 @@ +Remove uint type definitions + +While bindgen is able to replace the C uint types with the correct Rust types, +it still generates typedefs for __uint{8,16,32,64}_t [0]. We don’t need these +typedefs, so we remove them manually. + +[0] https://github.com/rust-lang/rust-bindgen/issues/1663 +Index: nitrokey-sys-rs/src/ffi.rs +=================================================================== +--- nitrokey-sys-rs.orig/src/ffi.rs ++++ nitrokey-sys-rs/src/ffi.rs +@@ -1,9 +1,5 @@ + /* automatically generated by rust-bindgen */ + +-pub type __uint8_t = ::std::os::raw::c_uchar; +-pub type __uint16_t = ::std::os::raw::c_ushort; +-pub type __uint32_t = ::std::os::raw::c_uint; +-pub type __uint64_t = ::std::os::raw::c_ulong; + extern "C" { + #[link_name = "\u{1}NK_PWS_SLOT_COUNT"] + pub static mut NK_PWS_SLOT_COUNT: u8; diff --git a/patches/series b/patches/series index 82bbc83..1cbd24b 100644 --- a/patches/series +++ b/patches/series @@ -1 +1,2 @@ deprecated.diff +remove-uint.diff diff --git a/src/ffi.rs b/src/ffi.rs index 0dea45a..799e5bc 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -1,9 +1,5 @@ /* automatically generated by rust-bindgen */ -pub type __uint8_t = ::std::os::raw::c_uchar; -pub type __uint16_t = ::std::os::raw::c_ushort; -pub type __uint32_t = ::std::os::raw::c_uint; -pub type __uint64_t = ::std::os::raw::c_ulong; extern "C" { #[link_name = "\u{1}NK_PWS_SLOT_COUNT"] pub static mut NK_PWS_SLOT_COUNT: u8; -- cgit v1.2.3