Skip to content

Commit

Permalink
Remove size_t to usize conversion rule
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcavity authored and emilio committed Dec 13, 2019
1 parent b3c3980 commit 5d38f2a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4092,9 +4092,9 @@ mod utils {
"int64_t" => primitive_ty(ctx, "i64"),
"uint64_t" => primitive_ty(ctx, "u64"),

"uintptr_t" | "size_t" => primitive_ty(ctx, "usize"),
"uintptr_t" => primitive_ty(ctx, "usize"),

"intptr_t" | "ptrdiff_t" | "ssize_t" => primitive_ty(ctx, "isize"),
"intptr_t" | "ptrdiff_t" => primitive_ty(ctx, "isize"),
_ => return None,
})
}
Expand Down
12 changes: 9 additions & 3 deletions tests/expectations/tests/blocks-signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#![cfg(target_os = "macos")]

extern crate block;
pub type size_t = ::std::os::raw::c_ulonglong;
extern "C" {
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
pub fn atexit_b(arg1: _bindgen_ty_id_33);
Expand Down Expand Up @@ -82,11 +83,16 @@ impl Default for contains_block_pointers {
}
pub type _bindgen_ty_id_33 = *const ::block::Block<(), ()>;
pub type _bindgen_ty_id_40 = *const ::block::Block<
(dispatch_data_t, usize, *const ::std::os::raw::c_void, usize),
(
dispatch_data_t,
size_t,
*const ::std::os::raw::c_void,
size_t,
),
bool,
>;
pub type _bindgen_ty_id_50 = *const ::block::Block<(usize,), ()>;
pub type _bindgen_ty_id_56 = *const ::block::Block<(usize,), ()>;
pub type _bindgen_ty_id_50 = *const ::block::Block<(size_t,), ()>;
pub type _bindgen_ty_id_56 = *const ::block::Block<(size_t,), ()>;
pub type contains_block_pointers__bindgen_ty_id_61 =
*const ::block::Block<(::std::os::raw::c_int,), ()>;
pub type _bindgen_ty_id_68 =
Expand Down
1 change: 1 addition & 0 deletions tests/expectations/tests/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
)]
#![cfg(target_os = "macos")]

pub type size_t = ::std::os::raw::c_ulonglong;
extern "C" {
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
pub fn atexit_b(arg1: *mut ::std::os::raw::c_void);
Expand Down
3 changes: 2 additions & 1 deletion tests/expectations/tests/issue-1498.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
non_upper_case_globals
)]

pub type size_t = u64;
#[repr(C, packed)]
#[derive(Copy, Clone)]
pub struct rte_memseg {
///< Start physical address.
pub phys_addr: u64,
pub __bindgen_anon_1: rte_memseg__bindgen_ty_1,
///< Length of the segment.
pub len: usize,
pub len: size_t,
///< The pagesize of underlying memory
pub hugepage_sz: u64,
///< NUMA socket ID.
Expand Down
3 changes: 2 additions & 1 deletion tests/expectations/tests/jsval_layout_opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ where
pub const JSVAL_TAG_SHIFT: u32 = 47;
pub const JSVAL_PAYLOAD_MASK: u64 = 140737488355327;
pub const JSVAL_TAG_MASK: i64 = -140737488355328;
pub type size_t = ::std::os::raw::c_ulonglong;
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum JSValueType {
Expand Down Expand Up @@ -188,7 +189,7 @@ pub union jsval_layout {
pub s: jsval_layout__bindgen_ty_2,
pub asDouble: f64,
pub asPtr: *mut ::std::os::raw::c_void,
pub asWord: usize,
pub asWord: size_t,
pub asUIntPtr: usize,
_bindgen_union_align: u64,
}
Expand Down
3 changes: 2 additions & 1 deletion tests/expectations/tests/jsval_layout_opaque_1_0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ impl<T> ::std::cmp::Eq for __BindgenUnionField<T> {}
pub const JSVAL_TAG_SHIFT: u32 = 47;
pub const JSVAL_PAYLOAD_MASK: u64 = 140737488355327;
pub const JSVAL_TAG_MASK: i64 = -140737488355328;
pub type size_t = ::std::os::raw::c_ulonglong;
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum JSValueType {
Expand Down Expand Up @@ -231,7 +232,7 @@ pub struct jsval_layout {
pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>,
pub asDouble: __BindgenUnionField<f64>,
pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub asWord: __BindgenUnionField<usize>,
pub asWord: __BindgenUnionField<size_t>,
pub asUIntPtr: __BindgenUnionField<usize>,
pub bindgen_union_field: u64,
}
Expand Down
3 changes: 2 additions & 1 deletion tests/expectations/tests/layout_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub const RTE_CACHE_LINE_SIZE: u32 = 64;
pub const RTE_MEMPOOL_OPS_NAMESIZE: u32 = 32;
pub const RTE_MEMPOOL_MAX_OPS_IDX: u32 = 16;
pub const RTE_HEAP_NUM_FREELISTS: u32 = 13;
pub type size_t = ::std::os::raw::c_longlong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rte_mempool {
Expand Down Expand Up @@ -292,7 +293,7 @@ pub struct malloc_heap {
pub lock: rte_spinlock_t,
pub free_head: [malloc_heap__bindgen_ty_1; 13usize],
pub alloc_count: ::std::os::raw::c_uint,
pub total_size: usize,
pub total_size: size_t,
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
Expand Down
3 changes: 2 additions & 1 deletion tests/expectations/tests/msvc-no-usr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
non_upper_case_globals
)]

pub type size_t = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub foo: usize,
pub foo: size_t,
}
#[test]
fn bindgen_test_layout_A() {
Expand Down
1 change: 1 addition & 0 deletions tests/expectations/tests/nsBaseHashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
non_upper_case_globals
)]

pub type size_t = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct nsBaseHashtableET {
Expand Down

0 comments on commit 5d38f2a

Please sign in to comment.