Skip to content

Commit

Permalink
Remove unnecessary __uint*_t typedefs
Browse files Browse the repository at this point in the history
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] rust-lang/rust-bindgen#1663
  • Loading branch information
robinkrahl committed Sep 20, 2020
1 parent 2b367a3 commit 90bcfc8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
21 changes: 21 additions & 0 deletions patches/remove-uint.diff
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
deprecated.diff
remove-uint.diff
4 changes: 0 additions & 4 deletions src/ffi.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 90bcfc8

Please sign in to comment.