Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
running 71 tests
test header_blocks_h ... ok
test header_anon_enum_whitelist_h ... ok
test header_bitfield_method_mangling_h ... ok
test header_complex_global_h ... ok
test header_const_resolved_ty_h ... ok
test header_complex_h ... FAILED
test header_constant_evaluate_h ... FAILED
test header_constify_all_enums_h ... FAILED
test header_constify_enum_h ... ok
test header_convert_floats_h ... FAILED
test header_dash_language_h ... ok
test header_decl_extern_int_twice_h ... ok
test header_decl_ptr_to_array_h ... ok
test header_enum_dupe_h ... ok
test header_16_byte_alignment_h ... FAILED
test header_enum_h ... ok
test header_enum_negative_h ... ok
test header_enum_packed_h ... ok
test header_forward_declared_struct_h ... FAILED
test header_func_proto_h ... ok
test header_func_ptr_h ... ok
test header_func_with_array_arg_h ... ok
test header_func_ptr_in_struct_h ... FAILED
test header_func_with_func_ptr_arg_h ... ok
test header_inline_function_h ... ok
test header_int128_t_h ... ok
test header_keywords_h ... ok
test header_layout_align_h ... FAILED
test header_layout_arp_h ... FAILED
test header_layout_h ... ok
test header_layout_kni_mbuf_h ... FAILED
test header_layout_cmdline_token_h ... FAILED
test header_layout_array_h ... FAILED
test header_macro_const_h ... ok
test header_macro_redef_h ... ok
test header_macro_expr_basic_h ... ok
test header_no_comments_h ... FAILED
test header_no_derive_debug_h ... FAILED
test header_no_derive_default_h ... FAILED
test header_no_recursive_whitelisting_h ... FAILED
test header_no_std_h ... FAILED
test header_objc_interface_h ... ok
test header_objc_interface_type_h ... FAILED
test header_objc_method_h ... ok
test header_resolved_type_def_function_h ... ok
test header_struct_containing_forward_declared_struct_h ... FAILED
test header_struct_with_anon_struct_h ... FAILED
test header_struct_with_anon_struct_array_h ... FAILED
test header_struct_with_anon_struct_pointer_h ... FAILED
test header_struct_with_anon_union_h ... FAILED
test header_struct_with_anon_unnamed_struct_h ... FAILED
test header_struct_with_anon_unnamed_union_h ... FAILED
test header_struct_with_bitfields_h ... FAILED
test header_struct_with_derive_debug_h ... FAILED
test header_struct_with_packing_h ... FAILED
test header_struct_with_nesting_h ... FAILED
test header_struct_with_struct_h ... FAILED
test header_type_referenced_by_whitelisted_function_h ... FAILED
test header_typedefd_array_as_function_arg_h ... ok
test header_union_with_anon_struct_h ... FAILED
test header_union_with_anon_struct_bitfield_h ... FAILED
test header_union_with_anon_union_h ... FAILED
test header_union_with_anon_unnamed_struct_h ... FAILED
test header_union_with_anon_unnamed_union_h ... FAILED
test header_union_with_big_member_h ... FAILED
test header_unknown_attr_h ... FAILED
test header_union_with_nesting_h ... FAILED
test header_use_core_h ... FAILED
test header_whitelist_vars_h ... ok
test header_layout_mbuf_h ... FAILED
test header_layout_eth_conf_h ... FAILED
failures:
---- header_complex_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/complex.rs"
+++ generated from: "/bindgen/tests/headers/complex.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
#[repr(C)]
pub struct __BindgenComplex<T> {
pub re: T,
pub im: T,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct TestDouble {
pub mMember: __BindgenComplex<f64>,
}
#[test]
fn bindgen_test_layout_TestDouble() {
assert_eq!(::std::mem::size_of::<TestDouble>() , 16usize , concat ! (
"Size of: " , stringify ! ( TestDouble ) ));
assert_eq! (::std::mem::align_of::<TestDouble>() , 8usize , concat ! (
"Alignment of " , stringify ! ( TestDouble ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const TestDouble ) ) . mMember as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( TestDouble ) , "::" ,
- stringify ! ( mMember ) ));
}
impl Clone for TestDouble {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct TestDoublePtr {
pub mMember: *mut __BindgenComplex<f64>,
}
#[test]
fn bindgen_test_layout_TestDoublePtr() {
assert_eq!(::std::mem::size_of::<TestDoublePtr>() , 8usize , concat ! (
"Size of: " , stringify ! ( TestDoublePtr ) ));
assert_eq! (::std::mem::align_of::<TestDoublePtr>() , 8usize , concat ! (
"Alignment of " , stringify ! ( TestDoublePtr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const TestDoublePtr ) ) . mMember as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( TestDoublePtr ) , "::"
- , stringify ! ( mMember ) ));
}
impl Clone for TestDoublePtr {
fn clone(&self) -> Self { *self }
}
impl Default for TestDoublePtr {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct TestFloat {
pub mMember: __BindgenComplex<f32>,
}
#[test]
fn bindgen_test_layout_TestFloat() {
assert_eq!(::std::mem::size_of::<TestFloat>() , 8usize , concat ! (
"Size of: " , stringify ! ( TestFloat ) ));
assert_eq! (::std::mem::align_of::<TestFloat>() , 4usize , concat ! (
"Alignment of " , stringify ! ( TestFloat ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const TestFloat ) ) . mMember as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( TestFloat ) , "::" ,
- stringify ! ( mMember ) ));
}
impl Clone for TestFloat {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct TestFloatPtr {
pub mMember: *mut __BindgenComplex<f32>,
}
#[test]
fn bindgen_test_layout_TestFloatPtr() {
assert_eq!(::std::mem::size_of::<TestFloatPtr>() , 8usize , concat ! (
"Size of: " , stringify ! ( TestFloatPtr ) ));
assert_eq! (::std::mem::align_of::<TestFloatPtr>() , 8usize , concat ! (
"Alignment of " , stringify ! ( TestFloatPtr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const TestFloatPtr ) ) . mMember as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( TestFloatPtr ) , "::" ,
- stringify ! ( mMember ) ));
}
impl Clone for TestFloatPtr {
fn clone(&self) -> Self { *self }
}
impl Default for TestFloatPtr {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_complex_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
---- header_constant_evaluate_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/constant-evaluate.rs"
+++ generated from: "/bindgen/tests/headers/constant-evaluate.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
pub const foo: _bindgen_ty_1 = _bindgen_ty_1::foo;
pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum _bindgen_ty_1 { foo = 4, bar = 8, }
pub type EasyToOverflow = ::std::os::raw::c_ulonglong;
pub const k: EasyToOverflow = 2147483648;
-pub const k_expr: EasyToOverflow = 0;
-pub const BAZ: ::std::os::raw::c_longlong = 24;
-pub const fuzz: f64 = 51.;
-pub const BAZZ: ::std::os::raw::c_char = 53;
-pub const WAT: ::std::os::raw::c_char = 0;
-pub const bytestring: &'static [u8; 4usize] = b"Foo\x00";
-pub const NOT_UTF8: [u8; 5usize] = [240, 40, 140, 40, 0];
+extern "C" {
+ #[link_name = "k_expr"]
+ pub static k_expr: EasyToOverflow;
+}
+extern "C" {
+ #[link_name = "BAZ"]
+ pub static BAZ: ::std::os::raw::c_longlong;
+}
+extern "C" {
+ #[link_name = "fuzz"]
+ pub static fuzz: f64;
+}
+extern "C" {
+ #[link_name = "BAZZ"]
+ pub static BAZZ: ::std::os::raw::c_char;
+}
+extern "C" {
+ #[link_name = "WAT"]
+ pub static WAT: ::std::os::raw::c_char;
+}
+extern "C" {
+ #[link_name = "bytestring"]
+ pub static mut bytestring: *const ::std::os::raw::c_char;
+}
+extern "C" {
+ #[link_name = "NOT_UTF8"]
+ pub static mut NOT_UTF8: *const ::std::os::raw::c_char;
+}
thread 'header_constant_evaluate_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:19
---- header_constify_all_enums_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/constify-all-enums.rs"
+++ generated from: "/bindgen/tests/headers/constify-all-enums.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
pub const foo_THIS: foo = 0;
pub const foo_SHOULD_BE: foo = 1;
pub const foo_A_CONSTANT: foo = 2;
pub type foo = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct bar {
pub this_should_work: foo,
}
#[test]
fn bindgen_test_layout_bar() {
assert_eq!(::std::mem::size_of::<bar>() , 4usize , concat ! (
"Size of: " , stringify ! ( bar ) ));
assert_eq! (::std::mem::align_of::<bar>() , 4usize , concat ! (
"Alignment of " , stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bar ) ) . this_should_work as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( bar ) , "::" ,
- stringify ! ( this_should_work ) ));
}
impl Clone for bar {
fn clone(&self) -> Self { *self }
}
impl Default for bar {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_constify_all_enums_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:69
---- header_convert_floats_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/convert-floats.rs"
+++ generated from: "/bindgen/tests/headers/convert-floats.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
#[repr(C)]
pub struct __BindgenComplex<T> {
pub re: T,
pub im: T,
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
pub bar: ::std::os::raw::c_float,
pub baz: ::std::os::raw::c_float,
pub bazz: ::std::os::raw::c_double,
pub bazzz: *mut ::std::os::raw::c_double,
pub complexFloat: __BindgenComplex<::std::os::raw::c_float>,
pub complexDouble: __BindgenComplex<::std::os::raw::c_double>,
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 48usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . baz as * const _ as usize } ,
- 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( baz ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bazz as * const _ as usize } ,
- 8usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bazz ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bazzz as * const _ as usize } ,
- 16usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bazzz ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . complexFloat as * const _ as
- usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( complexFloat ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . complexDouble as * const _ as
- usize } , 32usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( complexDouble ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
impl Default for foo {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_convert_floats_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:50
---- header_16_byte_alignment_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/16-byte-alignment.rs"
+++ generated from: "/bindgen/tests/headers/16-byte-alignment.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_ipv4_tuple {
pub src_addr: u32,
pub dst_addr: u32,
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_ipv4_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
pub sctp_tag: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
, 4usize , concat ! (
"Size of: " , stringify ! (
rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
, 2usize , concat ! (
"Alignment of " , stringify ! (
rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . dport as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( dport ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . sport as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( sport ) ));
}
impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>() , 4usize
, concat ! (
"Size of: " , stringify ! ( rte_ipv4_tuple__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1>() ,
4usize , concat ! (
"Alignment of " , stringify ! ( rte_ipv4_tuple__bindgen_ty_1 )
));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv4_tuple__bindgen_ty_1 ) ) .
- sctp_tag as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1 ) , "::" , stringify ! ( sctp_tag
- ) ));
}
impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple() {
assert_eq!(::std::mem::size_of::<rte_ipv4_tuple>() , 12usize , concat ! (
"Size of: " , stringify ! ( rte_ipv4_tuple ) ));
assert_eq! (::std::mem::align_of::<rte_ipv4_tuple>() , 4usize , concat ! (
"Alignment of " , stringify ! ( rte_ipv4_tuple ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv4_tuple ) ) . src_addr as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv4_tuple ) , "::"
- , stringify ! ( src_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv4_tuple ) ) . dst_addr as * const
- _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv4_tuple ) , "::"
- , stringify ! ( dst_addr ) ));
}
impl Clone for rte_ipv4_tuple {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_ipv6_tuple {
pub src_addr: [u8; 16usize],
pub dst_addr: [u8; 16usize],
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_ipv6_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
pub sctp_tag: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
, 4usize , concat ! (
"Size of: " , stringify ! (
rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
, 2usize , concat ! (
"Alignment of " , stringify ! (
rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . dport as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( dport ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . sport as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( sport ) ));
}
impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>() , 4usize
, concat ! (
"Size of: " , stringify ! ( rte_ipv6_tuple__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1>() ,
4usize , concat ! (
"Alignment of " , stringify ! ( rte_ipv6_tuple__bindgen_ty_1 )
));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv6_tuple__bindgen_ty_1 ) ) .
- sctp_tag as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1 ) , "::" , stringify ! ( sctp_tag
- ) ));
}
impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple() {
assert_eq!(::std::mem::size_of::<rte_ipv6_tuple>() , 36usize , concat ! (
"Size of: " , stringify ! ( rte_ipv6_tuple ) ));
assert_eq! (::std::mem::align_of::<rte_ipv6_tuple>() , 4usize , concat ! (
"Alignment of " , stringify ! ( rte_ipv6_tuple ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv6_tuple ) ) . src_addr as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv6_tuple ) , "::"
- , stringify ! ( src_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv6_tuple ) ) . dst_addr as * const
- _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv6_tuple ) , "::"
- , stringify ! ( dst_addr ) ));
}
impl Clone for rte_ipv6_tuple {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Copy)]
pub struct rte_thash_tuple {
pub v4: __BindgenUnionField<rte_ipv4_tuple>,
pub v6: __BindgenUnionField<rte_ipv6_tuple>,
pub bindgen_union_field: [u8; 48usize],
}
#[test]
fn bindgen_test_layout_rte_thash_tuple() {
assert_eq!(::std::mem::size_of::<rte_thash_tuple>() , 48usize , concat ! (
"Size of: " , stringify ! ( rte_thash_tuple ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_thash_tuple ) ) . v4 as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_thash_tuple ) ,
- "::" , stringify ! ( v4 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_thash_tuple ) ) . v6 as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_thash_tuple ) ,
- "::" , stringify ! ( v6 ) ));
}
impl Clone for rte_thash_tuple {
fn clone(&self) -> Self { *self }
}
impl Default for rte_thash_tuple {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_16_byte_alignment_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:36
---- header_forward_declared_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/forward_declared_struct.rs"
+++ generated from: "/bindgen/tests/headers/forward_declared_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct a {
pub b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_a() {
assert_eq!(::std::mem::size_of::<a>() , 4usize , concat ! (
"Size of: " , stringify ! ( a ) ));
assert_eq! (::std::mem::align_of::<a>() , 4usize , concat ! (
"Alignment of " , stringify ! ( a ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const a ) ) . b as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( a ) , "::" , stringify
- ! ( b ) ));
}
impl Clone for a {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct c {
pub d: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_c() {
assert_eq!(::std::mem::size_of::<c>() , 4usize , concat ! (
"Size of: " , stringify ! ( c ) ));
assert_eq! (::std::mem::align_of::<c>() , 4usize , concat ! (
"Alignment of " , stringify ! ( c ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const c ) ) . d as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( c ) , "::" , stringify
- ! ( d ) ));
}
impl Clone for c {
fn clone(&self) -> Self { *self }
}
thread 'header_forward_declared_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:58
---- header_func_ptr_in_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/func_ptr_in_struct.rs"
+++ generated from: "/bindgen/tests/headers/func_ptr_in_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum baz { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
pub bar: ::std::option::Option<unsafe extern "C" fn(x:
::std::os::raw::c_int,
y:
::std::os::raw::c_int)
-> baz>,
}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( Foo ) ));
assert_eq! (::std::mem::align_of::<Foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( Foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for Foo {
fn clone(&self) -> Self { *self }
}
impl Default for Foo {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_func_ptr_in_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:66
---- header_layout_align_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/layout_align.rs"
+++ generated from: "/bindgen/tests/headers/layout_align.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>);
impl <T> __IncompleteArrayField<T> {
#[inline]
pub fn new() -> Self {
__IncompleteArrayField(::std::marker::PhantomData)
}
#[inline]
pub unsafe fn as_ptr(&self) -> *const T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut_ptr(&mut self) -> *mut T {
::std::mem::transmute(self)
}
#[inline]
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
::std::slice::from_raw_parts(self.as_ptr(), len)
}
#[inline]
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
}
}
impl <T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__IncompleteArrayField")
}
}
impl <T> ::std::clone::Clone for __IncompleteArrayField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_kni_fifo {
/**< Next position to be written*/
pub write: ::std::os::raw::c_uint,
/**< Next position to be read */
pub read: ::std::os::raw::c_uint,
/**< Circular buffer length */
pub len: ::std::os::raw::c_uint,
/**< Pointer size - for 32/64 bit OS */
pub elem_size: ::std::os::raw::c_uint,
/**< The buffer contains mbuf pointers */
pub buffer: __IncompleteArrayField<*mut ::std::os::raw::c_void>,
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_rte_kni_fifo() {
assert_eq!(::std::mem::size_of::<rte_kni_fifo>() , 16usize , concat ! (
"Size of: " , stringify ! ( rte_kni_fifo ) ));
assert_eq! (::std::mem::align_of::<rte_kni_fifo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( rte_kni_fifo ) ));
}
impl Clone for rte_kni_fifo {
fn clone(&self) -> Self { *self }
}
impl Default for rte_kni_fifo {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_eth_link {
/**< ETH_SPEED_NUM_ */
pub link_speed: u32,
pub _bitfield_1: u8,
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_rte_eth_link() {
assert_eq!(::std::mem::size_of::<rte_eth_link>() , 8usize , concat ! (
"Size of: " , stringify ! ( rte_eth_link ) ));
assert_eq! (::std::mem::align_of::<rte_eth_link>() , 8usize , concat ! (
"Alignment of " , stringify ! ( rte_eth_link ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_link ) ) . link_speed as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_link ) , "::" ,
- stringify ! ( link_speed ) ));
}
impl Clone for rte_eth_link {
fn clone(&self) -> Self { *self }
}
impl rte_eth_link {
#[inline]
pub fn link_duplex(&self) -> u16 {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (1usize as u8)) >>
0u32) as u16)
}
}
#[inline]
pub fn set_link_duplex(&mut self, val: u16) {
self._bitfield_1 &= !(1usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 0u32) & (1usize as u8);
}
#[inline]
pub fn link_autoneg(&self) -> u16 {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (2usize as u8)) >>
1u32) as u16)
}
}
#[inline]
pub fn set_link_autoneg(&mut self, val: u16) {
self._bitfield_1 &= !(2usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 1u32) & (2usize as u8);
}
#[inline]
pub fn link_status(&self) -> u16 {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (4usize as u8)) >>
2u32) as u16)
}
}
#[inline]
pub fn set_link_status(&mut self, val: u16) {
self._bitfield_1 &= !(4usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 2u32) & (4usize as u8);
}
}
thread 'header_layout_align_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:1
---- header_layout_arp_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/layout_arp.rs"
+++ generated from: "/bindgen/tests/headers/layout_arp.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
pub const ETHER_ADDR_LEN: ::std::os::raw::c_uint = 6;
pub const ARP_HRD_ETHER: ::std::os::raw::c_uint = 1;
pub const ARP_OP_REQUEST: ::std::os::raw::c_uint = 1;
pub const ARP_OP_REPLY: ::std::os::raw::c_uint = 2;
pub const ARP_OP_REVREQUEST: ::std::os::raw::c_uint = 3;
pub const ARP_OP_REVREPLY: ::std::os::raw::c_uint = 4;
pub const ARP_OP_INVREQUEST: ::std::os::raw::c_uint = 8;
pub const ARP_OP_INVREPLY: ::std::os::raw::c_uint = 9;
/**
* Ethernet address:
* A universally administered address is uniquely assigned to a device by its
* manufacturer. The first three octets (in transmission order) contain the
* Organizationally Unique Identifier (OUI). The following three (MAC-48 and
* EUI-48) octets are assigned by that organization with the only constraint
* of uniqueness.
* A locally administered address is assigned to a device by a network
* administrator and does not contain OUIs.
* See http://standards.ieee.org/regauth/groupmac/tutorial.html
*/
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct ether_addr {
/**< Addr bytes in tx order */
pub addr_bytes: [u8; 6usize],
}
#[test]
fn bindgen_test_layout_ether_addr() {
assert_eq!(::std::mem::size_of::<ether_addr>() , 6usize , concat ! (
"Size of: " , stringify ! ( ether_addr ) ));
assert_eq! (::std::mem::align_of::<ether_addr>() , 1usize , concat ! (
"Alignment of " , stringify ! ( ether_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const ether_addr ) ) . addr_bytes as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( ether_addr ) , "::" ,
- stringify ! ( addr_bytes ) ));
}
impl Clone for ether_addr {
fn clone(&self) -> Self { *self }
}
/**
* ARP header IPv4 payload.
*/
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct arp_ipv4 {
/**< sender hardware address */
pub arp_sha: ether_addr,
/**< sender IP address */
pub arp_sip: u32,
/**< target hardware address */
pub arp_tha: ether_addr,
/**< target IP address */
pub arp_tip: u32,
}
#[test]
fn bindgen_test_layout_arp_ipv4() {
assert_eq!(::std::mem::size_of::<arp_ipv4>() , 20usize , concat ! (
"Size of: " , stringify ! ( arp_ipv4 ) ));
assert_eq! (::std::mem::align_of::<arp_ipv4>() , 1usize , concat ! (
"Alignment of " , stringify ! ( arp_ipv4 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_ipv4 ) ) . arp_sha as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_ipv4 ) , "::" ,
- stringify ! ( arp_sha ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_ipv4 ) ) . arp_sip as * const _ as
- usize } , 6usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_ipv4 ) , "::" ,
- stringify ! ( arp_sip ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_ipv4 ) ) . arp_tha as * const _ as
- usize } , 10usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_ipv4 ) , "::" ,
- stringify ! ( arp_tha ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_ipv4 ) ) . arp_tip as * const _ as
- usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_ipv4 ) , "::" ,
- stringify ! ( arp_tip ) ));
}
impl Clone for arp_ipv4 {
fn clone(&self) -> Self { *self }
}
/**
* ARP header.
*/
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct arp_hdr {
pub arp_hrd: u16,
pub arp_pro: u16,
pub arp_hln: u8,
pub arp_pln: u8,
pub arp_op: u16,
pub arp_data: arp_ipv4,
}
#[test]
fn bindgen_test_layout_arp_hdr() {
assert_eq!(::std::mem::size_of::<arp_hdr>() , 28usize , concat ! (
"Size of: " , stringify ! ( arp_hdr ) ));
assert_eq! (::std::mem::align_of::<arp_hdr>() , 1usize , concat ! (
"Alignment of " , stringify ! ( arp_hdr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_hdr ) ) . arp_hrd as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_hdr ) , "::" ,
- stringify ! ( arp_hrd ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_hdr ) ) . arp_pro as * const _ as
- usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_hdr ) , "::" ,
- stringify ! ( arp_pro ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_hdr ) ) . arp_hln as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_hdr ) , "::" ,
- stringify ! ( arp_hln ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_hdr ) ) . arp_pln as * const _ as
- usize } , 5usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_hdr ) , "::" ,
- stringify ! ( arp_pln ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_hdr ) ) . arp_op as * const _ as
- usize } , 6usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_hdr ) , "::" ,
- stringify ! ( arp_op ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const arp_hdr ) ) . arp_data as * const _ as
- usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( arp_hdr ) , "::" ,
- stringify ! ( arp_data ) ));
}
impl Clone for arp_hdr {
fn clone(&self) -> Self { *self }
}
thread 'header_layout_arp_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:9
---- header_layout_kni_mbuf_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/layout_kni_mbuf.rs"
+++ generated from: "/bindgen/tests/headers/layout_kni_mbuf.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
pub const RTE_CACHE_LINE_MIN_SIZE: ::std::os::raw::c_uint = 64;
pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_kni_mbuf {
pub buf_addr: *mut ::std::os::raw::c_void,
pub buf_physaddr: u64,
pub pad0: [::std::os::raw::c_char; 2usize],
/**< Start address of data in segment buffer. */
pub data_off: u16,
pub pad1: [::std::os::raw::c_char; 2usize],
/**< Number of segments. */
pub nb_segs: u8,
pub pad4: [::std::os::raw::c_char; 1usize],
/**< Offload features. */
pub ol_flags: u64,
pub pad2: [::std::os::raw::c_char; 4usize],
/**< Total pkt len: sum of all segment data_len. */
pub pkt_len: u32,
/**< Amount of data in segment buffer. */
pub data_len: u16,
- pub __bindgen_padding_0: [u8; 22usize],
pub pad3: [::std::os::raw::c_char; 8usize],
pub pool: *mut ::std::os::raw::c_void,
pub next: *mut ::std::os::raw::c_void,
- pub __bindgen_padding_1: [u64; 5usize],
+ pub __bindgen_padding_0: [u64; 7usize],
}
#[test]
fn bindgen_test_layout_rte_kni_mbuf() {
assert_eq!(::std::mem::size_of::<rte_kni_mbuf>() , 128usize , concat ! (
"Size of: " , stringify ! ( rte_kni_mbuf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . buf_addr as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( buf_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . buf_physaddr as *
- const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( buf_physaddr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pad0 as * const _ as
- usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pad0 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . data_off as * const _
- as usize } , 18usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( data_off ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pad1 as * const _ as
- usize } , 20usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pad1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . nb_segs as * const _
- as usize } , 22usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( nb_segs ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pad4 as * const _ as
- usize } , 23usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pad4 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . ol_flags as * const _
- as usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( ol_flags ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pad2 as * const _ as
- usize } , 32usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pad2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pkt_len as * const _
- as usize } , 36usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pkt_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . data_len as * const _
- as usize } , 40usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( data_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pad3 as * const _ as
- usize } , 64usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pad3 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . pool as * const _ as
- usize } , 72usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( pool ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_kni_mbuf ) ) . next as * const _ as
- usize } , 80usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_kni_mbuf ) , "::" ,
- stringify ! ( next ) ));
}
impl Clone for rte_kni_mbuf {
fn clone(&self) -> Self { *self }
}
impl Default for rte_kni_mbuf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_layout_kni_mbuf_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:68
---- header_layout_cmdline_token_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/layout_cmdline_token.rs"
+++ generated from: "/bindgen/tests/headers/layout_cmdline_token.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
/**
* Stores a pointer to the ops struct, and the offset: the place to
* write the parsed result in the destination structure.
*/
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_hdr {
pub ops: *mut cmdline_token_hdr_cmdline_token_ops,
pub offset: ::std::os::raw::c_uint,
}
/**
* A token is defined by this structure.
*
* parse() takes the token as first argument, then the source buffer
* starting at the token we want to parse. The 3rd arg is a pointer
* where we store the parsed data (as binary). It returns the number of
* parsed chars on success and a negative value on error.
*
* complete_get_nb() returns the number of possible values for this
* token if completion is possible. If it is NULL or if it returns 0,
* no completion is possible.
*
* complete_get_elt() copy in dstbuf (the size is specified in the
* parameter) the i-th possible completion for this token. returns 0
* on success or and a negative value on error.
*
* get_help() fills the dstbuf with the help for the token. It returns
* -1 on error and 0 on success.
*/
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_hdr_cmdline_token_ops {
/** parse(token ptr, buf, res pts, buf len) */
pub parse: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
*const ::std::os::raw::c_char,
arg3:
*mut ::std::os::raw::c_void,
arg4:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
/** return the num of possible choices for this token */
pub complete_get_nb: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t)
-> ::std::os::raw::c_int>,
/** return the elt x for this token (token, idx, dstbuf, size) */
pub complete_get_elt: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
::std::os::raw::c_int,
arg3:
*mut ::std::os::raw::c_char,
arg4:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
/** get help for this token (token, dstbuf, size) */
pub get_help: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
*mut ::std::os::raw::c_char,
arg3:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
}
#[test]
fn bindgen_test_layout_cmdline_token_hdr_cmdline_token_ops() {
assert_eq!(::std::mem::size_of::<cmdline_token_hdr_cmdline_token_ops>() ,
32usize , concat ! (
"Size of: " , stringify ! ( cmdline_token_hdr_cmdline_token_ops
) ));
assert_eq! (::std::mem::align_of::<cmdline_token_hdr_cmdline_token_ops>()
, 8usize , concat ! (
"Alignment of " , stringify ! (
cmdline_token_hdr_cmdline_token_ops ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- parse as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- parse ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- complete_get_nb as * const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- complete_get_nb ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- complete_get_elt as * const _ as usize } , 16usize , concat !
- (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- complete_get_elt ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- get_help as * const _ as usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- get_help ) ));
}
impl Clone for cmdline_token_hdr_cmdline_token_ops {
fn clone(&self) -> Self { *self }
}
impl Default for cmdline_token_hdr_cmdline_token_ops {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[test]
fn bindgen_test_layout_cmdline_token_hdr() {
assert_eq!(::std::mem::size_of::<cmdline_token_hdr>() , 16usize , concat !
( "Size of: " , stringify ! ( cmdline_token_hdr ) ));
assert_eq! (::std::mem::align_of::<cmdline_token_hdr>() , 8usize , concat
! ( "Alignment of " , stringify ! ( cmdline_token_hdr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr ) ) . ops as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_hdr ) ,
- "::" , stringify ! ( ops ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr ) ) . offset as * const
- _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_hdr ) ,
- "::" , stringify ! ( offset ) ));
}
impl Clone for cmdline_token_hdr {
fn clone(&self) -> Self { *self }
}
impl Default for cmdline_token_hdr {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
pub type cmdline_parse_token_hdr_t = cmdline_token_hdr;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum cmdline_numtype {
UINT8 = 0,
UINT16 = 1,
UINT32 = 2,
UINT64 = 3,
INT8 = 4,
INT16 = 5,
INT32 = 6,
INT64 = 7,
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_num_data {
pub type_: cmdline_numtype,
}
#[test]
fn bindgen_test_layout_cmdline_token_num_data() {
assert_eq!(::std::mem::size_of::<cmdline_token_num_data>() , 4usize ,
concat ! ( "Size of: " , stringify ! ( cmdline_token_num_data )
));
assert_eq! (::std::mem::align_of::<cmdline_token_num_data>() , 4usize ,
concat ! (
"Alignment of " , stringify ! ( cmdline_token_num_data ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_num_data ) ) . type_ as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_num_data
- ) , "::" , stringify ! ( type_ ) ));
}
impl Clone for cmdline_token_num_data {
fn clone(&self) -> Self { *self }
}
impl Default for cmdline_token_num_data {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_num {
pub hdr: cmdline_token_hdr,
pub num_data: cmdline_token_num_data,
}
#[test]
fn bindgen_test_layout_cmdline_token_num() {
assert_eq!(::std::mem::size_of::<cmdline_token_num>() , 24usize , concat !
( "Size of: " , stringify ! ( cmdline_token_num ) ));
assert_eq! (::std::mem::align_of::<cmdline_token_num>() , 8usize , concat
! ( "Alignment of " , stringify ! ( cmdline_token_num ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_num ) ) . hdr as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_num ) ,
- "::" , stringify ! ( hdr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_num ) ) . num_data as *
- const _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_num ) ,
- "::" , stringify ! ( num_data ) ));
}
impl Clone for cmdline_token_num {
fn clone(&self) -> Self { *self }
}
impl Default for cmdline_token_num {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
pub type cmdline_parse_token_num_t = cmdline_token_num;
thread 'header_layout_cmdline_token_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:44
---- header_layout_array_h stdout ----
/bindgen/tests/headers/layout_array.h:32:43: warning: declaration of 'struct rte_mempool' will not be visible outside of this function [-Wvisibility], err: false
/bindgen/tests/headers/layout_array.h:37:43: warning: declaration of 'struct rte_mempool' will not be visible outside of this function [-Wvisibility], err: false
/bindgen/tests/headers/layout_array.h:42:45: warning: declaration of 'struct rte_mempool' will not be visible outside of this function [-Wvisibility], err: false
/bindgen/tests/headers/layout_array.h:48:45: warning: declaration of 'struct rte_mempool' will not be visible outside of this function [-Wvisibility], err: false
/bindgen/tests/headers/layout_array.h:54:56: warning: declaration of 'struct rte_mempool' will not be visible outside of this function [-Wvisibility], err: false
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/layout_array.rs"
+++ generated from: "/bindgen/tests/headers/layout_array.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
pub const RTE_MEMPOOL_OPS_NAMESIZE: ::std::os::raw::c_uint = 32;
pub const RTE_MEMPOOL_MAX_OPS_IDX: ::std::os::raw::c_uint = 16;
pub const RTE_HEAP_NUM_FREELISTS: ::std::os::raw::c_uint = 13;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rte_mempool([u8; 0]);
/**
* Prototype for implementation specific data provisioning function.
*
* The function should provide the implementation specific memory for
* for use by the other mempool ops functions in a given mempool ops struct.
* E.g. the default ops provides an instance of the rte_ring for this purpose.
* it will most likely point to a different type of data structure, and
* will be transparent to the application programmer.
* This function should set mp->pool_data.
*/
pub type rte_mempool_alloc_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool)
-> ::std::os::raw::c_int>;
/**
* Free the opaque private data pointed to by mp->pool_data pointer.
*/
pub type rte_mempool_free_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool)>;
/**
* Enqueue an object into the external pool.
*/
pub type rte_mempool_enqueue_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool,
obj_table:
*const *const ::std::os::raw::c_void,
n: ::std::os::raw::c_uint)
-> ::std::os::raw::c_int>;
/**
* Dequeue an object from the external pool.
*/
pub type rte_mempool_dequeue_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool,
obj_table:
*mut *mut ::std::os::raw::c_void,
n: ::std::os::raw::c_uint)
-> ::std::os::raw::c_int>;
/**
* Return the number of available objects in the external pool.
*/
pub type rte_mempool_get_count =
::std::option::Option<unsafe extern "C" fn(mp: *const rte_mempool)
-> ::std::os::raw::c_uint>;
/** Structure defining mempool operations structure */
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_mempool_ops {
/**< Name of mempool ops struct. */
pub name: [::std::os::raw::c_char; 32usize],
/**< Allocate private data. */
pub alloc: rte_mempool_alloc_t,
/**< Free the external pool. */
pub free: rte_mempool_free_t,
/**< Enqueue an object. */
pub enqueue: rte_mempool_enqueue_t,
/**< Dequeue an object. */
pub dequeue: rte_mempool_dequeue_t,
/**< Get qty of available objs. */
pub get_count: rte_mempool_get_count,
pub __bindgen_padding_0: [u64; 7usize],
}
#[test]
fn bindgen_test_layout_rte_mempool_ops() {
assert_eq!(::std::mem::size_of::<rte_mempool_ops>() , 128usize , concat !
( "Size of: " , stringify ! ( rte_mempool_ops ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops ) ) . name as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops ) ,
- "::" , stringify ! ( name ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops ) ) . alloc as * const _
- as usize } , 32usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops ) ,
- "::" , stringify ! ( alloc ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops ) ) . free as * const _
- as usize } , 40usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops ) ,
- "::" , stringify ! ( free ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops ) ) . enqueue as * const
- _ as usize } , 48usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops ) ,
- "::" , stringify ! ( enqueue ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops ) ) . dequeue as * const
- _ as usize } , 56usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops ) ,
- "::" , stringify ! ( dequeue ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops ) ) . get_count as *
- const _ as usize } , 64usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops ) ,
- "::" , stringify ! ( get_count ) ));
}
impl Clone for rte_mempool_ops {
fn clone(&self) -> Self { *self }
}
impl Default for rte_mempool_ops {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
/**
* The rte_spinlock_t type.
*/
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct _bindgen_ty_1 {
/**< lock status 0 = unlocked, 1 = locked */
pub locked: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 4usize , concat ! (
"Size of: " , stringify ! ( _bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<_bindgen_ty_1>() , 4usize , concat ! (
"Alignment of " , stringify ! ( _bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) . locked as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( locked ) ));
}
impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
pub type rte_spinlock_t = _bindgen_ty_1;
/**
* Structure storing the table of registered ops structs, each of which contain
* the function pointers for the mempool ops functions.
* Each process has its own storage for this ops struct array so that
* the mempools can be shared across primary and secondary processes.
* The indices used to access the array are valid across processes, whereas
* any function pointers stored directly in the mempool struct would not be.
* This results in us simply having "ops_index" in the mempool struct.
*/
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_mempool_ops_table {
/**< Spinlock for add/delete. */
pub sl: rte_spinlock_t,
/**< Number of used ops structs in the table. */
pub num_ops: u32,
pub __bindgen_padding_0: [u64; 7usize],
/**
* Storage for all possible ops structs.
*/
pub ops: [rte_mempool_ops; 16usize],
}
#[test]
fn bindgen_test_layout_rte_mempool_ops_table() {
assert_eq!(::std::mem::size_of::<rte_mempool_ops_table>() , 2112usize ,
concat ! ( "Size of: " , stringify ! ( rte_mempool_ops_table )
));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops_table ) ) . sl as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops_table )
- , "::" , stringify ! ( sl ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops_table ) ) . num_ops as *
- const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops_table )
- , "::" , stringify ! ( num_ops ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mempool_ops_table ) ) . ops as *
- const _ as usize } , 64usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mempool_ops_table )
- , "::" , stringify ! ( ops ) ));
}
impl Clone for rte_mempool_ops_table {
fn clone(&self) -> Self { *self }
}
impl Default for rte_mempool_ops_table {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
/**
* Structure to hold malloc heap
*/
#[repr(C)]
#[derive(Debug, Copy)]
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,
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct malloc_heap__bindgen_ty_1 {
pub lh_first: *mut malloc_heap__bindgen_ty_1_malloc_elem,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct malloc_heap__bindgen_ty_1_malloc_elem([u8; 0]);
#[test]
fn bindgen_test_layout_malloc_heap__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<malloc_heap__bindgen_ty_1>() , 8usize ,
concat ! (
"Size of: " , stringify ! ( malloc_heap__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<malloc_heap__bindgen_ty_1>() , 8usize ,
concat ! (
"Alignment of " , stringify ! ( malloc_heap__bindgen_ty_1 )
));
- assert_eq! (unsafe {
- & ( * ( 0 as * const malloc_heap__bindgen_ty_1 ) ) . lh_first
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- malloc_heap__bindgen_ty_1 ) , "::" , stringify ! ( lh_first )
- ));
}
impl Clone for malloc_heap__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
impl Default for malloc_heap__bindgen_ty_1 {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[test]
fn bindgen_test_layout_malloc_heap() {
assert_eq!(::std::mem::size_of::<malloc_heap>() , 128usize , concat ! (
"Size of: " , stringify ! ( malloc_heap ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const malloc_heap ) ) . lock as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( malloc_heap ) , "::" ,
- stringify ! ( lock ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const malloc_heap ) ) . free_head as * const _
- as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( malloc_heap ) , "::" ,
- stringify ! ( free_head ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const malloc_heap ) ) . alloc_count as * const
- _ as usize } , 112usize , concat ! (
- "Alignment of field: " , stringify ! ( malloc_heap ) , "::" ,
- stringify ! ( alloc_count ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const malloc_heap ) ) . total_size as * const _
- as usize } , 120usize , concat ! (
- "Alignment of field: " , stringify ! ( malloc_heap ) , "::" ,
- stringify ! ( total_size ) ));
}
impl Clone for malloc_heap {
fn clone(&self) -> Self { *self }
}
impl Default for malloc_heap {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_layout_array_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:7
---- header_no_comments_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/no-comments.rs"
+++ generated from: "/bindgen/tests/headers/no-comments.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct Foo {
pub s: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( Foo ) ));
assert_eq! (::std::mem::align_of::<Foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( Foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Foo ) ) . s as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Foo ) , "::" ,
- stringify ! ( s ) ));
}
impl Clone for Foo {
fn clone(&self) -> Self { *self }
}
thread 'header_no_comments_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:32
---- header_no_derive_debug_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/no-derive-debug.rs"
+++ generated from: "/bindgen/tests/headers/no-derive-debug.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)] #[derive(Copy, Clone, Default)] pub struct foo { bar: ::std::os::raw::c_int, }
/**
* bar should compile. It will normally derive debug, but our blacklist of foo
* and replacement for another type that doesn't implement it would prevent it
* from building if --no-derive-debug didn't work.
*/
#[repr(C)]
#[derive(Default, Copy)]
pub struct bar {
pub foo: foo,
pub baz: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_bar() {
assert_eq!(::std::mem::size_of::<bar>() , 8usize , concat ! (
"Size of: " , stringify ! ( bar ) ));
assert_eq! (::std::mem::align_of::<bar>() , 4usize , concat ! (
"Alignment of " , stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bar ) ) . foo as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( bar ) , "::" ,
- stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bar ) ) . baz as * const _ as usize } ,
- 4usize , concat ! (
- "Alignment of field: " , stringify ! ( bar ) , "::" ,
- stringify ! ( baz ) ));
}
impl Clone for bar {
fn clone(&self) -> Self { *self }
}
thread 'header_no_derive_debug_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:27
---- header_no_derive_default_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/no-derive-default.rs"
+++ generated from: "/bindgen/tests/headers/no-derive-default.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)] #[derive(Copy, Clone, Debug)] pub struct foo { bar: ::std::os::raw::c_int, }
/**
* bar should compile. It will normally derive default, but our blacklist of foo
* and replacement for another type that doesn't implement it would prevent it
* from building if --no-derive-default didn't work.
*/
#[repr(C)]
#[derive(Debug, Copy)]
pub struct bar {
pub foo: foo,
pub baz: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_bar() {
assert_eq!(::std::mem::size_of::<bar>() , 8usize , concat ! (
"Size of: " , stringify ! ( bar ) ));
assert_eq! (::std::mem::align_of::<bar>() , 4usize , concat ! (
"Alignment of " , stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bar ) ) . foo as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( bar ) , "::" ,
- stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bar ) ) . baz as * const _ as usize } ,
- 4usize , concat ! (
- "Alignment of field: " , stringify ! ( bar ) , "::" ,
- stringify ! ( baz ) ));
}
impl Clone for bar {
fn clone(&self) -> Self { *self }
}
thread 'header_no_derive_default_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:34
---- header_no_recursive_whitelisting_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/no-recursive-whitelisting.rs"
+++ generated from: "/bindgen/tests/headers/no-recursive-whitelisting.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
pub enum Bar {}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
pub baz: *mut Bar,
}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( Foo ) ));
assert_eq! (::std::mem::align_of::<Foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( Foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Foo ) ) . baz as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Foo ) , "::" ,
- stringify ! ( baz ) ));
}
impl Clone for Foo {
fn clone(&self) -> Self { *self }
}
impl Default for Foo {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_no_recursive_whitelisting_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:49
---- header_no_std_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/no-std.rs"
+++ generated from: "/bindgen/tests/headers/no-std.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#![no_std]
mod libc { pub type c_int = i32; pub enum c_void {} }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
pub a: libc::c_int,
pub b: libc::c_int,
pub bar: *mut libc::c_void,
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::core::mem::size_of::<foo>() , 16usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::core::mem::align_of::<foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . b as * const _ as usize } ,
- 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 8usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
impl Default for foo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
thread 'header_no_std_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:60
---- header_objc_interface_type_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/objc_interface_type.rs"
+++ generated from: "/bindgen/tests/headers/objc_interface_type.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#![cfg(target_os="macos")]
#[macro_use]
extern crate objc;
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
pub trait Foo { }
impl Foo for id { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct FooStruct {
pub foo: *mut id,
}
#[test]
fn bindgen_test_layout_FooStruct() {
assert_eq!(::std::mem::size_of::<FooStruct>() , 8usize , concat ! (
"Size of: " , stringify ! ( FooStruct ) ));
assert_eq! (::std::mem::align_of::<FooStruct>() , 8usize , concat ! (
"Alignment of " , stringify ! ( FooStruct ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const FooStruct ) ) . foo as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( FooStruct ) , "::" ,
- stringify ! ( foo ) ));
}
impl Clone for FooStruct {
fn clone(&self) -> Self { *self }
}
impl Default for FooStruct {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
pub fn fooFunc(foo: id);
}
extern "C" {
#[link_name = "kFoo"]
pub static mut kFoo: *const id;
}
thread 'header_objc_interface_type_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:47
---- header_struct_containing_forward_declared_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_containing_forward_declared_struct.rs"
+++ generated from: "/bindgen/tests/headers/struct_containing_forward_declared_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Copy)]
pub struct a {
pub val_a: *mut a_b,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct a_b {
pub val_b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_a_b() {
assert_eq!(::std::mem::size_of::<a_b>() , 4usize , concat ! (
"Size of: " , stringify ! ( a_b ) ));
assert_eq! (::std::mem::align_of::<a_b>() , 4usize , concat ! (
"Alignment of " , stringify ! ( a_b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const a_b ) ) . val_b as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( a_b ) , "::" ,
- stringify ! ( val_b ) ));
}
impl Clone for a_b {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_a() {
assert_eq!(::std::mem::size_of::<a>() , 8usize , concat ! (
"Size of: " , stringify ! ( a ) ));
assert_eq! (::std::mem::align_of::<a>() , 8usize , concat ! (
"Alignment of " , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const a ) ) . val_a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( a ) , "::" , stringify
- ! ( val_a ) ));
}
impl Clone for a {
fn clone(&self) -> Self { *self }
}
impl Default for a {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_struct_containing_forward_declared_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:13
---- header_struct_with_anon_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_anon_struct.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_anon_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_anon_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:61
---- header_struct_with_anon_struct_array_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_anon_struct_array.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_anon_struct_array.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: [foo__bindgen_ty_1; 2usize],
pub baz: [[[foo__bindgen_ty_2; 4usize]; 3usize]; 2usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_2 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_2() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_2>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_2 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_2>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_2 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_2 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_2 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_2 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 208usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . baz as * const _ as usize } ,
- 16usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( baz ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_anon_struct_array_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:51
---- header_struct_with_anon_struct_pointer_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_anon_struct_pointer.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_anon_struct_pointer.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
pub bar: *mut foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
impl Default for foo {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_struct_with_anon_struct_pointer_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:16
---- header_struct_with_anon_union_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_anon_union.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_anon_union.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_anon_union_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:54
---- header_struct_with_anon_unnamed_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_anon_unnamed_struct.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_anon_unnamed_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_anon_unnamed_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:35
---- header_struct_with_anon_unnamed_union_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_anon_unnamed_union.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_anon_unnamed_union.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_anon_unnamed_union_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:20
---- header_struct_with_bitfields_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_bitfields.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_bitfields.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct bitfield {
pub _bitfield_1: u8,
pub e: ::std::os::raw::c_int,
pub _bitfield_2: u8,
pub _bitfield_3: u32,
}
#[test]
fn bindgen_test_layout_bitfield() {
assert_eq!(::std::mem::size_of::<bitfield>() , 16usize , concat ! (
"Size of: " , stringify ! ( bitfield ) ));
assert_eq! (::std::mem::align_of::<bitfield>() , 4usize , concat ! (
"Alignment of " , stringify ! ( bitfield ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bitfield ) ) . e as * const _ as usize }
- , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( bitfield ) , "::" ,
- stringify ! ( e ) ));
}
impl Clone for bitfield {
fn clone(&self) -> Self { *self }
}
impl bitfield {
#[inline]
pub fn a(&self) -> ::std::os::raw::c_ushort {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (1usize as u8)) >>
0u32) as u16)
}
}
#[inline]
pub fn set_a(&mut self, val: ::std::os::raw::c_ushort) {
self._bitfield_1 &= !(1usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 0u32) & (1usize as u8);
}
#[inline]
pub fn b(&self) -> ::std::os::raw::c_ushort {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (2usize as u8)) >>
1u32) as u16)
}
}
#[inline]
pub fn set_b(&mut self, val: ::std::os::raw::c_ushort) {
self._bitfield_1 &= !(2usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 1u32) & (2usize as u8);
}
#[inline]
pub fn c(&self) -> ::std::os::raw::c_ushort {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (4usize as u8)) >>
2u32) as u16)
}
}
#[inline]
pub fn set_c(&mut self, val: ::std::os::raw::c_ushort) {
self._bitfield_1 &= !(4usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 2u32) & (4usize as u8);
}
#[inline]
pub fn at_offset_3(&self) -> ::std::os::raw::c_ushort {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (8usize as u8)) >>
3u32) as u16)
}
}
#[inline]
pub fn set_at_offset_3(&mut self, val: ::std::os::raw::c_ushort) {
self._bitfield_1 &= !(8usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 3u32) & (8usize as u8);
}
#[inline]
pub fn at_offset_4(&self) -> ::std::os::raw::c_ushort {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (48usize as u8)) >>
4u32) as u16)
}
}
#[inline]
pub fn set_at_offset_4(&mut self, val: ::std::os::raw::c_ushort) {
self._bitfield_1 &= !(48usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 4u32) & (48usize as u8);
}
#[inline]
pub fn d(&self) -> ::std::os::raw::c_ushort {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (192usize as u8)) >>
6u32) as u16)
}
}
#[inline]
pub fn set_d(&mut self, val: ::std::os::raw::c_ushort) {
self._bitfield_1 &= !(192usize as u8);
self._bitfield_1 |= ((val as u16 as u8) << 6u32) & (192usize as u8);
}
#[inline]
pub fn f(&self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(((self._bitfield_2 & (3usize as u8)) >>
0u32) as u32)
}
}
#[inline]
pub fn set_f(&mut self, val: ::std::os::raw::c_uint) {
self._bitfield_2 &= !(3usize as u8);
self._bitfield_2 |= ((val as u32 as u8) << 0u32) & (3usize as u8);
}
#[inline]
pub fn g(&self) -> ::std::os::raw::c_uint {
unsafe {
::std::mem::transmute(((self._bitfield_3 &
(4294967295usize as u32)) >> 0u32) as
u32)
}
}
#[inline]
pub fn set_g(&mut self, val: ::std::os::raw::c_uint) {
self._bitfield_3 &= !(4294967295usize as u32);
self._bitfield_3 |=
((val as u32 as u32) << 0u32) & (4294967295usize as u32);
}
}
thread 'header_struct_with_bitfields_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:40
---- header_struct_with_derive_debug_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_derive_debug.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_derive_debug.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct LittleArray {
pub a: [::std::os::raw::c_int; 32usize],
}
#[test]
fn bindgen_test_layout_LittleArray() {
assert_eq!(::std::mem::size_of::<LittleArray>() , 128usize , concat ! (
"Size of: " , stringify ! ( LittleArray ) ));
assert_eq! (::std::mem::align_of::<LittleArray>() , 4usize , concat ! (
"Alignment of " , stringify ! ( LittleArray ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const LittleArray ) ) . a as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( LittleArray ) , "::" ,
- stringify ! ( a ) ));
}
impl Clone for LittleArray {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
pub struct BigArray {
pub a: [::std::os::raw::c_int; 33usize],
}
#[test]
fn bindgen_test_layout_BigArray() {
assert_eq!(::std::mem::size_of::<BigArray>() , 132usize , concat ! (
"Size of: " , stringify ! ( BigArray ) ));
assert_eq! (::std::mem::align_of::<BigArray>() , 4usize , concat ! (
"Alignment of " , stringify ! ( BigArray ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const BigArray ) ) . a as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( BigArray ) , "::" ,
- stringify ! ( a ) ));
}
impl Default for BigArray {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct WithLittleArray {
pub a: LittleArray,
}
#[test]
fn bindgen_test_layout_WithLittleArray() {
assert_eq!(::std::mem::size_of::<WithLittleArray>() , 128usize , concat !
( "Size of: " , stringify ! ( WithLittleArray ) ));
assert_eq! (::std::mem::align_of::<WithLittleArray>() , 4usize , concat !
( "Alignment of " , stringify ! ( WithLittleArray ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithLittleArray ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithLittleArray ) ,
- "::" , stringify ! ( a ) ));
}
impl Clone for WithLittleArray {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
pub struct WithBigArray {
pub a: BigArray,
}
#[test]
fn bindgen_test_layout_WithBigArray() {
assert_eq!(::std::mem::size_of::<WithBigArray>() , 132usize , concat ! (
"Size of: " , stringify ! ( WithBigArray ) ));
assert_eq! (::std::mem::align_of::<WithBigArray>() , 4usize , concat ! (
"Alignment of " , stringify ! ( WithBigArray ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray ) , "::" ,
- stringify ! ( a ) ));
}
impl Default for WithBigArray {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_struct_with_derive_debug_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:10
---- header_struct_with_packing_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_packing.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_packing.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct a {
pub b: ::std::os::raw::c_char,
pub c: ::std::os::raw::c_short,
}
#[test]
fn bindgen_test_layout_a() {
assert_eq!(::std::mem::size_of::<a>() , 3usize , concat ! (
"Size of: " , stringify ! ( a ) ));
assert_eq! (::std::mem::align_of::<a>() , 1usize , concat ! (
"Alignment of " , stringify ! ( a ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const a ) ) . b as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( a ) , "::" , stringify
- ! ( b ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const a ) ) . c as * const _ as usize
- } , 1usize , concat ! (
- "Alignment of field: " , stringify ! ( a ) , "::" , stringify
- ! ( c ) ));
}
impl Clone for a {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_packing_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:25
---- header_struct_with_nesting_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_nesting.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_nesting.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub a: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub b: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_1>,
pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_2>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1__bindgen_ty_1 {
pub c1: ::std::os::raw::c_ushort,
pub c2: ::std::os::raw::c_ushort,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
4usize , concat ! (
"Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_1 )
));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
2usize , concat ! (
"Alignment of " , stringify ! (
foo__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . c1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( c1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . c2
- as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( c2 )
- ));
}
impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1__bindgen_ty_2 {
pub d1: ::std::os::raw::c_uchar,
pub d2: ::std::os::raw::c_uchar,
pub d3: ::std::os::raw::c_uchar,
pub d4: ::std::os::raw::c_uchar,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
4usize , concat ! (
"Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_2 )
));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
1usize , concat ! (
"Alignment of " , stringify ! (
foo__bindgen_ty_1__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d2
- as * const _ as usize } , 1usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d2 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d3
- as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d3 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d4
- as * const _ as usize } , 3usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d4 )
- ));
}
impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_nesting_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:37
---- header_struct_with_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/struct_with_struct.rs"
+++ generated from: "/bindgen/tests/headers/struct_with_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub x: ::std::os::raw::c_uint,
pub y: ::std::os::raw::c_uint,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . x as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( x ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . y as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( y ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_struct_with_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:17
---- header_type_referenced_by_whitelisted_function_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/type-referenced-by-whitelisted-function.rs"
+++ generated from: "/bindgen/tests/headers/type-referenced-by-whitelisted-function.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct dl_phdr_info {
pub x: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_dl_phdr_info() {
assert_eq!(::std::mem::size_of::<dl_phdr_info>() , 4usize , concat ! (
"Size of: " , stringify ! ( dl_phdr_info ) ));
assert_eq! (::std::mem::align_of::<dl_phdr_info>() , 4usize , concat ! (
"Alignment of " , stringify ! ( dl_phdr_info ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const dl_phdr_info ) ) . x as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( dl_phdr_info ) , "::" ,
- stringify ! ( x ) ));
}
impl Clone for dl_phdr_info {
fn clone(&self) -> Self { *self }
}
extern "C" {
pub fn dl_iterate_phdr(arg1: *mut dl_phdr_info) -> ::std::os::raw::c_int;
}
thread 'header_type_referenced_by_whitelisted_function_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:67
---- header_union_with_anon_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_anon_struct.rs"
+++ generated from: "/bindgen/tests/headers/union_with_anon_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_union_with_anon_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:2
---- header_union_with_anon_struct_bitfield_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_anon_struct_bitfield.rs"
+++ generated from: "/bindgen/tests/headers/union_with_anon_struct_bitfield.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub _bitfield_1: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
impl foo__bindgen_ty_1 {
#[inline]
pub fn b(&self) -> ::std::os::raw::c_int {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (127usize as u32)) >>
0u32) as u32)
}
}
#[inline]
pub fn set_b(&mut self, val: ::std::os::raw::c_int) {
self._bitfield_1 &= !(127usize as u32);
self._bitfield_1 |= ((val as u32 as u32) << 0u32) & (127usize as u32);
}
#[inline]
pub fn c(&self) -> ::std::os::raw::c_int {
unsafe {
::std::mem::transmute(((self._bitfield_1 &
(4294967168usize as u32)) >> 7u32) as
u32)
}
}
#[inline]
pub fn set_c(&mut self, val: ::std::os::raw::c_int) {
self._bitfield_1 &= !(4294967168usize as u32);
self._bitfield_1 |=
((val as u32 as u32) << 7u32) & (4294967168usize as u32);
}
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_union_with_anon_struct_bitfield_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:65
---- header_union_with_anon_union_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_anon_union.rs"
+++ generated from: "/bindgen/tests/headers/union_with_anon_union.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_union_with_anon_union_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:12
---- header_union_with_anon_unnamed_struct_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_anon_unnamed_struct.rs"
+++ generated from: "/bindgen/tests/headers/union_with_anon_unnamed_struct.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct pixel {
pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct pixel__bindgen_ty_1 {
pub r: ::std::os::raw::c_uchar,
pub g: ::std::os::raw::c_uchar,
pub b: ::std::os::raw::c_uchar,
pub a: ::std::os::raw::c_uchar,
}
#[test]
fn bindgen_test_layout_pixel__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<pixel__bindgen_ty_1>() , 4usize , concat
! ( "Size of: " , stringify ! ( pixel__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<pixel__bindgen_ty_1>() , 1usize ,
concat ! (
"Alignment of " , stringify ! ( pixel__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . r as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( r ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . g as * const _
- as usize } , 1usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( g ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . b as * const _
- as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . a as * const _
- as usize } , 3usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
}
impl Clone for pixel__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_pixel() {
assert_eq!(::std::mem::size_of::<pixel>() , 4usize , concat ! (
"Size of: " , stringify ! ( pixel ) ));
assert_eq! (::std::mem::align_of::<pixel>() , 4usize , concat ! (
"Alignment of " , stringify ! ( pixel ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel ) ) . rgba as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel ) , "::" ,
- stringify ! ( rgba ) ));
}
impl Clone for pixel {
fn clone(&self) -> Self { *self }
}
thread 'header_union_with_anon_unnamed_struct_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:48
---- header_union_with_anon_unnamed_union_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_anon_unnamed_union.rs"
+++ generated from: "/bindgen/tests/headers/union_with_anon_unnamed_union.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 2usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . c as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( c ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_union_with_anon_unnamed_union_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:28
---- header_union_with_big_member_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_big_member.rs"
+++ generated from: "/bindgen/tests/headers/union_with_big_member.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Copy)]
pub struct WithBigArray {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub b: __BindgenUnionField<[::std::os::raw::c_int; 33usize]>,
pub bindgen_union_field: [u32; 33usize],
}
#[test]
fn bindgen_test_layout_WithBigArray() {
assert_eq!(::std::mem::size_of::<WithBigArray>() , 132usize , concat ! (
"Size of: " , stringify ! ( WithBigArray ) ));
assert_eq! (::std::mem::align_of::<WithBigArray>() , 4usize , concat ! (
"Alignment of " , stringify ! ( WithBigArray ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray ) , "::" ,
- stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray ) , "::" ,
- stringify ! ( b ) ));
}
impl Clone for WithBigArray {
fn clone(&self) -> Self { *self }
}
impl Default for WithBigArray {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct WithBigArray2 {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
pub bindgen_union_field: [u32; 9usize],
}
#[test]
fn bindgen_test_layout_WithBigArray2() {
assert_eq!(::std::mem::size_of::<WithBigArray2>() , 36usize , concat ! (
"Size of: " , stringify ! ( WithBigArray2 ) ));
assert_eq! (::std::mem::align_of::<WithBigArray2>() , 4usize , concat ! (
"Alignment of " , stringify ! ( WithBigArray2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray2 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray2 ) , "::"
- , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray2 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray2 ) , "::"
- , stringify ! ( b ) ));
}
impl Clone for WithBigArray2 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Copy)]
pub struct WithBigMember {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub b: __BindgenUnionField<WithBigArray>,
pub bindgen_union_field: [u32; 33usize],
}
#[test]
fn bindgen_test_layout_WithBigMember() {
assert_eq!(::std::mem::size_of::<WithBigMember>() , 132usize , concat ! (
"Size of: " , stringify ! ( WithBigMember ) ));
assert_eq! (::std::mem::align_of::<WithBigMember>() , 4usize , concat ! (
"Alignment of " , stringify ! ( WithBigMember ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigMember ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigMember ) , "::"
- , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigMember ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigMember ) , "::"
- , stringify ! ( b ) ));
}
impl Clone for WithBigMember {
fn clone(&self) -> Self { *self }
}
impl Default for WithBigMember {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
thread 'header_union_with_big_member_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:43
---- header_unknown_attr_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/unknown_attr.rs"
+++ generated from: "/bindgen/tests/headers/unknown_attr.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct _bindgen_ty_1 {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
pub __bindgen_padding_0: u64,
pub __clang_max_align_nonce2: f64,
pub __bindgen_padding_1: u64,
}
#[test]
fn bindgen_test_layout__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 32usize , concat ! (
"Size of: " , stringify ! ( _bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) .
- __clang_max_align_nonce1 as * const _ as usize } , 0usize ,
- concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( __clang_max_align_nonce1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) .
- __clang_max_align_nonce2 as * const _ as usize } , 16usize ,
- concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( __clang_max_align_nonce2 ) ));
}
impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
pub type max_align_t = _bindgen_ty_1;
thread 'header_unknown_attr_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:24
---- header_union_with_nesting_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/union_with_nesting.rs"
+++ generated from: "/bindgen/tests/headers/union_with_nesting.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1__bindgen_ty_1 {
pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
2usize , concat ! (
"Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_1 )
));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
2usize , concat ! (
"Alignment of " , stringify ! (
foo__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . b1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( b1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . b2
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( b2 )
- ));
}
impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1__bindgen_ty_2 {
pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
2usize , concat ! (
"Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_2 )
));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
2usize , concat ! (
"Alignment of " , stringify ! (
foo__bindgen_ty_1__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . c1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( c1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . c2
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( c2 )
- ));
}
impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize , concat
! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
}
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
thread 'header_union_with_nesting_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:26
---- header_use_core_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/use-core.rs"
+++ generated from: "/bindgen/tests/headers/use-core.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
extern crate core;
#[repr(C)]
pub struct __BindgenUnionField<T>(::core::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::core::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::core::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::core::mem::transmute(self) }
}
impl <T> ::core::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::core::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::core::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::core::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
pub bar: *mut ::std::os::raw::c_void,
}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::core::mem::size_of::<foo>() , 16usize , concat ! (
"Size of: " , stringify ! ( foo ) ));
assert_eq! (::core::mem::align_of::<foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . b as * const _ as usize } ,
- 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 8usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
}
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
impl Default for foo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct _bindgen_ty_1 {
pub bar: __BindgenUnionField<::std::os::raw::c_int>,
pub baz: __BindgenUnionField<::std::os::raw::c_long>,
pub bindgen_union_field: u64,
}
#[test]
fn bindgen_test_layout__bindgen_ty_1() {
assert_eq!(::core::mem::size_of::<_bindgen_ty_1>() , 8usize , concat ! (
"Size of: " , stringify ! ( _bindgen_ty_1 ) ));
assert_eq! (::core::mem::align_of::<_bindgen_ty_1>() , 8usize , concat ! (
"Alignment of " , stringify ! ( _bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) . bar as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) . baz as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( baz ) ));
}
impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
extern "C" {
#[link_name = "bazz"]
pub static mut bazz: _bindgen_ty_1;
}
pub type fooFunction =
::core::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)>;
thread 'header_use_core_h' panicked at 'Header and binding differ!', /bindgen/target/debug/build/bindgen-f6fdd37f3e51109e/out/tests.rs:6
---- header_layout_mbuf_h stdout ----
diff expected generated
--- expected: "/bindgen/tests/expectations/tests/layout_mbuf.rs"
+++ generated from: "/bindgen/tests/headers/layout_mbuf.h"
/* automatically generated by rust-bindgen */
#![allow(non_snake_case)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) }
#[inline]
pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) }
#[inline]
pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) }
}
impl <T> ::std::default::Default for __BindgenUnionField<T> {
#[inline]
fn default() -> Self { Self::new() }
}
impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
pub const RTE_CACHE_LINE_MIN_SIZE: ::std::os::raw::c_uint = 64;
pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
pub type phys_addr_t = u64;
pub type MARKER = [*mut ::std::os::raw::c_void; 0usize];
pub type MARKER8 = [u8; 0usize];
pub type MARKER64 = [u64; 0usize];
/**
* The atomic counter structure.
*/
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct _bindgen_ty_1 {
/**< An internal counter value. */
pub cnt: i16,
}
#[test]
fn bindgen_test_layout__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 2usize , concat ! (
"Size of: " , stringify ! ( _bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<_bindgen_ty_1>() , 2usize , concat ! (
"Alignment of " , stringify ! ( _bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) . cnt as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( cnt ) ));
}
impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
pub type rte_atomic16_t = _bindgen_ty_1;
/**
* The generic rte_mbuf, containing a packet mbuf.
*/
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_mbuf {
pub cacheline0: MARKER,
/**< Virtual address of segment buffer. */
pub buf_addr: *mut ::std::os::raw::c_void,
/**< Physical address of segment buffer. */
pub buf_physaddr: phys_addr_t,
/**< Length of segment buffer. */
pub buf_len: u16,
pub rearm_data: MARKER8,
pub data_off: u16,
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1,
/**< Number of segments. */
pub nb_segs: u8,
/**< Input port. */
pub port: u8,
/**< Offload features. */
pub ol_flags: u64,
pub rx_descriptor_fields1: MARKER,
pub __bindgen_anon_2: rte_mbuf__bindgen_ty_2,
/**< Total pkt len: sum of all segments. */
pub pkt_len: u32,
/**< Amount of data in segment buffer. */
pub data_len: u16,
/** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */
pub vlan_tci: u16,
/**< hash information */
pub hash: rte_mbuf__bindgen_ty_3,
/**< Sequence number. See also rte_reorder_insert() */
pub seqn: u32,
/** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. */
pub vlan_tci_outer: u16,
pub cacheline1: MARKER,
pub __bindgen_anon_3: rte_mbuf__bindgen_ty_4,
/**< Pool from which mbuf was allocated. */
pub pool: *mut rte_mbuf_rte_mempool,
/**< Next segment of scattered packet. */
pub next: *mut rte_mbuf,
pub __bindgen_anon_4: rte_mbuf__bindgen_ty_5,
/** Size of the application private data. In case of an indirect
* mbuf, it stores the direct mbuf private data size. */
pub priv_size: u16,
/** Timesync flags for use with IEEE1588. */
pub timesync: u16,
pub __bindgen_padding_0: [u32; 7usize],
}
/**
* 16-bit Reference counter.
* It should only be accessed using the following functions:
* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
* rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
* or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
* config option.
*/
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_1 {
/**< Atomically accessed refcnt */
pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>,
/**< Non-atomically accessed refcnt */
pub refcnt: __BindgenUnionField<u16>,
pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_1>() , 2usize ,
concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_1 )
));
assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_1>() , 2usize ,
concat ! (
"Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_1 ) ) .
- refcnt_atomic as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_1
- ) , "::" , stringify ! ( refcnt_atomic ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_1 ) ) . refcnt as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_1
- ) , "::" , stringify ! ( refcnt ) ));
}
impl Clone for rte_mbuf__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_2 {
/**< L2/L3/L4 and tunnel information. */
pub packet_type: __BindgenUnionField<u32>,
pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_2__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
pub _bitfield_1: u32,
}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_2__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_2__bindgen_ty_1>() ,
4usize , concat ! (
"Size of: " , stringify ! (
rte_mbuf__bindgen_ty_2__bindgen_ty_1 ) ));
assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_2__bindgen_ty_1>()
, 4usize , concat ! (
"Alignment of " , stringify ! (
rte_mbuf__bindgen_ty_2__bindgen_ty_1 ) ));
}
impl Clone for rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
#[inline]
pub fn l2_type(&self) -> u32 {
unsafe {
::std::mem::transmute(((self._bitfield_1 & (15usize as u32)) >>