Update default rust target to 1.33.

Closes #1529.
This commit is contained in:
Emilio Cobos Álvarez 2019-03-04 03:00:53 +01:00
parent 1cd8301274
commit ed6e1bbec4
74 changed files with 528 additions and 129 deletions

View File

@ -89,6 +89,20 @@ Released YYYY/MM/DD
* TODO (or remove section if none)
--------------------------------------------------------------------------------
# 0.48.0
Released 2019/03/04
## Changed
* Default rust target was changed to 1.33, which means that bindgen can get much
more often the layout of structs right. [#1529][]
[#1529]: https://github.com/rust-lang-nursery/rust-bindgen/issues/1529
--------------------------------------------------------------------------------
# 0.47.3

2
Cargo.lock generated
View File

@ -49,7 +49,7 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.47.3"
version = "0.48.0"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -14,7 +14,7 @@ readme = "README.md"
repository = "https://github.com/rust-lang/rust-bindgen"
documentation = "https://docs.rs/bindgen"
homepage = "https://rust-lang.github.io/rust-bindgen/"
version = "0.47.3"
version = "0.48.0"
build = "build.rs"
include = [

View File

@ -114,7 +114,7 @@ rust_target_base!(rust_target_def);
rust_target_base!(rust_target_values_def);
/// Latest stable release of Rust
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_21;
pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_33;
/// Create RustFeatures struct definition, new(), and a getter for each field
macro_rules! rust_feature_def {

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -12,6 +15,7 @@ pub struct rte_ipv4_tuple {
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union rte_ipv4_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
@ -145,6 +149,7 @@ pub struct rte_ipv6_tuple {
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union rte_ipv6_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
@ -271,11 +276,12 @@ impl Default for rte_ipv6_tuple {
}
}
#[repr(C)]
#[repr(align(16))]
#[derive(Copy, Clone)]
pub union rte_thash_tuple {
pub v4: rte_ipv4_tuple,
pub v6: rte_ipv6_tuple,
_bindgen_union_align: [u8; 48usize],
_bindgen_union_align: [u128; 3usize],
}
#[test]
fn bindgen_test_layout_rte_thash_tuple() {
@ -284,6 +290,11 @@ fn bindgen_test_layout_rte_thash_tuple() {
48usize,
concat!("Size of: ", stringify!(rte_thash_tuple))
);
assert_eq!(
::std::mem::align_of::<rte_thash_tuple>(),
16usize,
concat!("Alignment of ", stringify!(rte_thash_tuple))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_thash_tuple>())).v4 as *const _ as usize },
0usize,

View File

@ -9,6 +9,7 @@
/// <div rustbindgen opaque></div>
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct D {
pub _bindgen_opaque_blob: u32,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -10,6 +13,7 @@ pub struct s {
pub u: s__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union s__bindgen_ty_1 {
pub field: s__bindgen_ty_1_inner,

View File

@ -33,6 +33,7 @@ pub struct TErrorResult_DOMExceptionInfo {
_unused: [u8; 0],
}
#[repr(C)]
#[repr(align(8))]
pub union TErrorResult__bindgen_ty_1 {
pub mMessage: *mut TErrorResult_Message,
pub mDOMExceptionInfo: *mut TErrorResult_DOMExceptionInfo,

View File

@ -45,7 +45,7 @@ impl ::std::ops::BitAndAssign for Foo {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Foo(pub i32);
impl Buz {
@ -86,7 +86,7 @@ impl ::std::ops::BitAndAssign for Buz {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Buz(pub i8);
pub const NS_FOO: _bindgen_ty_1 = _bindgen_ty_1(1);
@ -117,7 +117,7 @@ impl ::std::ops::BitAndAssign for _bindgen_ty_1 {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct _bindgen_ty_1(pub u32);
#[repr(C)]
@ -153,7 +153,7 @@ impl ::std::ops::BitAndAssign for Dummy__bindgen_ty_1 {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Dummy__bindgen_ty_1(pub u32);
#[test]

View File

@ -90,6 +90,7 @@ where
}
}
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Default, Copy, Clone)]
pub struct HasBigBitfield {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize], u64>,
@ -101,8 +102,37 @@ fn bindgen_test_layout_HasBigBitfield() {
16usize,
concat!("Size of: ", stringify!(HasBigBitfield))
);
assert_eq!(
::std::mem::align_of::<HasBigBitfield>(),
16usize,
concat!("Alignment of ", stringify!(HasBigBitfield))
);
}
impl HasBigBitfield {
#[inline]
pub fn x(&self) -> i128 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 128u8) as u128) }
}
#[inline]
pub fn set_x(&mut self, val: i128) {
unsafe {
let val: u128 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 128u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(x: i128) -> __BindgenBitfieldUnit<[u8; 16usize], u64> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize], u64> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 128u8, {
let x: u128 = unsafe { ::std::mem::transmute(x) };
x as u64
});
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Default, Copy, Clone)]
pub struct HasTwoBigBitfields {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize], u64>,
@ -114,4 +144,47 @@ fn bindgen_test_layout_HasTwoBigBitfields() {
16usize,
concat!("Size of: ", stringify!(HasTwoBigBitfields))
);
assert_eq!(
::std::mem::align_of::<HasTwoBigBitfields>(),
16usize,
concat!("Alignment of ", stringify!(HasTwoBigBitfields))
);
}
impl HasTwoBigBitfields {
#[inline]
pub fn x(&self) -> i128 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 80u8) as u128) }
}
#[inline]
pub fn set_x(&mut self, val: i128) {
unsafe {
let val: u128 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 80u8, val as u64)
}
}
#[inline]
pub fn y(&self) -> i128 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 48u8) as u128) }
}
#[inline]
pub fn set_y(&mut self, val: i128) {
unsafe {
let val: u128 = ::std::mem::transmute(val);
self._bitfield_1.set(80usize, 48u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(x: i128, y: i128) -> __BindgenBitfieldUnit<[u8; 16usize], u64> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize], u64> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 80u8, {
let x: u128 = unsafe { ::std::mem::transmute(x) };
x as u64
});
__bindgen_bitfield_unit.set(80usize, 48u8, {
let y: u128 = unsafe { ::std::mem::transmute(y) };
y as u64
});
__bindgen_bitfield_unit
}
}

View File

@ -90,12 +90,12 @@ where
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct A {
pub x: ::std::os::raw::c_uchar,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>,
pub y: ::std::os::raw::c_uchar,
pub __bindgen_align: [u32; 0usize],
}
#[test]
fn bindgen_test_layout_A() {
@ -290,10 +290,10 @@ impl A {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct B {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,
pub __bindgen_align: [u32; 0usize],
}
#[test]
fn bindgen_test_layout_B() {
@ -421,11 +421,11 @@ impl C {
}
}
#[repr(C)]
#[repr(align(2))]
#[derive(Debug, Default, Copy, Clone)]
pub struct Date1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize], u8>,
pub __bindgen_padding_0: u8,
pub __bindgen_align: [u16; 0usize],
}
#[test]
fn bindgen_test_layout_Date1() {
@ -514,10 +514,10 @@ impl Date1 {
}
}
#[repr(C)]
#[repr(align(2))]
#[derive(Debug, Default, Copy, Clone)]
pub struct Date2 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u8>,
pub __bindgen_align: [u16; 0usize],
}
#[test]
fn bindgen_test_layout_Date2() {
@ -622,11 +622,11 @@ impl Date2 {
}
}
#[repr(C)]
#[repr(align(2))]
#[derive(Debug, Default, Copy, Clone)]
pub struct Date3 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize], u8>,
pub byte: ::std::os::raw::c_uchar,
pub __bindgen_align: [u16; 0usize],
}
#[test]
fn bindgen_test_layout_Date3() {

View File

@ -98,10 +98,10 @@ pub enum MyEnum {
FOUR = 3,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct TaggedPtr {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize], u64>,
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_TaggedPtr() {

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone)]
pub struct _bindgen_ty_1 {
pub _bindgen_opaque_blob: [u64; 10usize],

View File

@ -90,10 +90,10 @@ where
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct mach_msg_type_descriptor_t {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,
pub __bindgen_align: [u32; 0usize],
}
#[test]
fn bindgen_test_layout_mach_msg_type_descriptor_t() {

View File

@ -335,6 +335,7 @@ impl Default for IncompleteArrayNonCopiable {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union Union {
pub d: f32,

View File

@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -49,6 +54,7 @@ fn bindgen_test_layout_A_Segment() {
);
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union A__bindgen_ty_1 {
pub f: ::std::os::raw::c_int,
@ -83,6 +89,7 @@ impl Default for A__bindgen_ty_1 {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union A__bindgen_ty_2 {
pub d: ::std::os::raw::c_int,
@ -226,6 +233,7 @@ pub struct C {
pub __bindgen_anon_1: C__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union C__bindgen_ty_1 {
pub mFunc: C__bindgen_ty_1__bindgen_ty_1,

View File

@ -19,7 +19,7 @@ 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 f64,
pub bazzz: *mut u128,
pub complexFloat: __BindgenComplex<::std::os::raw::c_float>,
pub complexDouble: __BindgenComplex<::std::os::raw::c_double>,
}

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -12,6 +15,7 @@ pub struct perf_event_attr {
pub __bindgen_anon_1: perf_event_attr__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union perf_event_attr__bindgen_ty_1 {
pub b: ::std::os::raw::c_int,
@ -104,9 +108,7 @@ impl ::std::fmt::Debug for perf_event_attr {
write!(
f,
"perf_event_attr {{ type: {:?}, a: {:?}, __bindgen_anon_1: {:?} }}",
self.type_,
self.a,
self.__bindgen_anon_1
self.type_, self.a, self.__bindgen_anon_1
)
}
}

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
pub struct Opaque {
pub _bindgen_opaque_blob: [u32; 41usize],
}

View File

@ -1,15 +1,20 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct rte_mbuf {
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(1))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_1 {
_bindgen_union_align: [u8; 0usize],
@ -39,6 +44,11 @@ fn bindgen_test_layout_rte_mbuf() {
0usize,
concat!("Size of: ", stringify!(rte_mbuf))
);
assert_eq!(
::std::mem::align_of::<rte_mbuf>(),
64usize,
concat!("Alignment of ", stringify!(rte_mbuf))
);
}
impl Default for rte_mbuf {
fn default() -> Self {

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@ -38,6 +41,7 @@ pub struct c {
pub __bindgen_anon_1: c__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(1))]
#[derive(Copy, Clone)]
pub union c__bindgen_ty_1 {
_bindgen_union_align: u8,

View File

@ -9,6 +9,7 @@
/// Deriving PartialEq for rust unions is not supported.
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union ShouldNotDerivePartialEq {
pub a: ::std::os::raw::c_char,

View File

@ -55,6 +55,7 @@ fn bindgen_test_layout_Null() {
/// probably emit an opaque struct for opaque unions... but until then, we have
/// this test to make sure that opaque unions don't derive and still compile.
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union DoggoOrNull {
pub _bindgen_opaque_blob: u32,

View File

@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl Foo {
pub const Bar: Foo = Foo(0);
@ -34,7 +39,7 @@ impl ::std::ops::BitAndAssign for Foo {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Foo(pub u32);
pub mod Neg {

View File

@ -60,7 +60,7 @@ impl ::std::ops::BitAndAssign for B {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
/// Document enum
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct B(pub u32);

View File

@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl MyDupeEnum {
pub const A: MyDupeEnum = MyDupeEnum(0);
@ -37,7 +42,7 @@ impl ::std::ops::BitAndAssign for MyDupeEnum {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct MyDupeEnum(pub u32);
impl MyOtherDupeEnum {
@ -75,6 +80,6 @@ impl ::std::ops::BitAndAssign for MyOtherDupeEnum {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct MyOtherDupeEnum(pub u32);

View File

@ -1,12 +1,18 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_ushort,

View File

@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
@ -78,6 +83,7 @@ pub struct basic_string___short {
pub __data_: *mut basic_string_value_type,
}
#[repr(C)]
#[repr(align(1))]
pub union basic_string___short__bindgen_ty_1 {
pub __size_: ::std::os::raw::c_uchar,
pub __lx: basic_string_value_type,

View File

@ -39,10 +39,10 @@ fn bindgen_test_layout_AlignedToOne() {
}
/// This should be opaque because although we can see the attributes, Rust before
/// 1.33 doesn't have `#[repr(packed(N))]`.
#[repr(C)]
#[repr(C, packed(2))]
#[derive(Debug, Default, Copy, Clone)]
pub struct AlignedToTwo {
pub _bindgen_opaque_blob: [u16; 2usize],
pub i: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_AlignedToTwo() {
@ -56,6 +56,16 @@ fn bindgen_test_layout_AlignedToTwo() {
2usize,
concat!("Alignment of ", stringify!(AlignedToTwo))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<AlignedToTwo>())).i as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(AlignedToTwo),
"::",
stringify!(i)
)
);
}
/// This should not be opaque because although `libclang` doesn't give us the
/// `#pragma pack(1)`, we can detect that alignment is 1 and add
@ -102,10 +112,11 @@ fn bindgen_test_layout_PackedToOne() {
/// In this case, even if we can detect the weird alignment triggered by
/// `#pragma pack(2)`, we can't do anything about it because Rust before 1.33
/// doesn't have `#[repr(packed(N))]`. Therefore, we must make it opaque.
#[repr(C)]
#[repr(C, packed(2))]
#[derive(Debug, Default, Copy, Clone)]
pub struct PackedToTwo {
pub _bindgen_opaque_blob: [u16; 4usize],
pub x: ::std::os::raw::c_int,
pub y: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_PackedToTwo() {
@ -119,4 +130,24 @@ fn bindgen_test_layout_PackedToTwo() {
2usize,
concat!("Alignment of ", stringify!(PackedToTwo))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<PackedToTwo>())).x as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(PackedToTwo),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<PackedToTwo>())).y as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(PackedToTwo),
"::",
stringify!(y)
)
);
}

View File

@ -12,6 +12,7 @@
/// up with the reight alignment, we're waiting on `#[repr(align="N")]` to land
/// in rustc).
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct NoDebug {
pub c: ::std::os::raw::c_char,
@ -24,6 +25,11 @@ fn bindgen_test_layout_NoDebug() {
64usize,
concat!("Size of: ", stringify!(NoDebug))
);
assert_eq!(
::std::mem::align_of::<NoDebug>(),
64usize,
concat!("Alignment of ", stringify!(NoDebug))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<NoDebug>())).c as *const _ as usize },
0usize,
@ -50,6 +56,7 @@ impl ::std::cmp::PartialEq for NoDebug {
/// we determine Debug derive-ability before we compute padding, which happens at
/// codegen. (Again, we expect to get the alignment wrong for similar reasons.)
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct ShouldDeriveDebugButDoesNot {
pub c: [::std::os::raw::c_char; 32usize],
@ -63,6 +70,11 @@ fn bindgen_test_layout_ShouldDeriveDebugButDoesNot() {
64usize,
concat!("Size of: ", stringify!(ShouldDeriveDebugButDoesNot))
);
assert_eq!(
::std::mem::align_of::<ShouldDeriveDebugButDoesNot>(),
64usize,
concat!("Alignment of ", stringify!(ShouldDeriveDebugButDoesNot))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ShouldDeriveDebugButDoesNot>())).c as *const _ as usize },
0usize,

View File

@ -90,10 +90,10 @@ where
}
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 32usize], u64>,
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_Foo() {

View File

@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@ -8,6 +13,7 @@ pub struct A {
_unused: [u8; 0],
}
#[repr(C)]
#[repr(align(1))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct B {
pub _bindgen_opaque_blob: u8,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@ -59,6 +62,7 @@ fn bindgen_test_layout_SuchWow() {
);
}
#[repr(C)]
#[repr(align(1))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Opaque {
pub _bindgen_opaque_blob: u8,

View File

@ -90,10 +90,10 @@ where
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct capabilities {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize], u8>,
pub __bindgen_align: [u32; 0usize],
}
#[test]
fn bindgen_test_layout_capabilities() {

View File

@ -176,6 +176,7 @@ pub enum JSWhyMagic {
JS_WHY_MAGIC_COUNT = 18,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Copy, Clone)]
pub union jsval_layout {
pub asBits: u64,
@ -188,10 +189,10 @@ pub union jsval_layout {
_bindgen_union_align: u64,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct jsval_layout__bindgen_ty_1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize], u64>,
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
@ -258,6 +259,7 @@ pub struct jsval_layout__bindgen_ty_2 {
pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union jsval_layout__bindgen_ty_2__bindgen_ty_1 {
pub i32: i32,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct header {

View File

@ -126,6 +126,7 @@ impl<T> ::std::clone::Clone for __IncompleteArrayField<T> {
}
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug)]
pub struct rte_kni_fifo {
///< Next position to be written
@ -138,7 +139,6 @@ pub struct rte_kni_fifo {
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() {
@ -159,13 +159,13 @@ impl Default for rte_kni_fifo {
}
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone)]
pub struct rte_eth_link {
///< ETH_SPEED_NUM_
pub link_speed: u32,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 3usize],
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_rte_eth_link() {

View File

@ -49,6 +49,7 @@ 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)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct rte_mempool_ops {
///< Name of mempool ops struct.
@ -72,6 +73,11 @@ fn bindgen_test_layout_rte_mempool_ops() {
128usize,
concat!("Size of: ", stringify!(rte_mempool_ops))
);
assert_eq!(
::std::mem::align_of::<rte_mempool_ops>(),
64usize,
concat!("Alignment of ", stringify!(rte_mempool_ops))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_mempool_ops>())).name as *const _ as usize },
0usize,
@ -186,6 +192,7 @@ fn bindgen_test_layout_rte_spinlock_t() {
/// 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)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct rte_mempool_ops_table {
///< Spinlock for add/delete.
@ -203,6 +210,11 @@ fn bindgen_test_layout_rte_mempool_ops_table() {
2112usize,
concat!("Size of: ", stringify!(rte_mempool_ops_table))
);
assert_eq!(
::std::mem::align_of::<rte_mempool_ops_table>(),
64usize,
concat!("Alignment of ", stringify!(rte_mempool_ops_table))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_mempool_ops_table>())).sl as *const _ as usize },
0usize,
@ -241,6 +253,7 @@ impl Default for rte_mempool_ops_table {
}
/// Structure to hold malloc heap
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct malloc_heap {
pub lock: rte_spinlock_t,
@ -290,6 +303,11 @@ fn bindgen_test_layout_malloc_heap() {
128usize,
concat!("Size of: ", stringify!(malloc_heap))
);
assert_eq!(
::std::mem::align_of::<malloc_heap>(),
64usize,
concat!("Alignment of ", stringify!(malloc_heap))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<malloc_heap>())).lock as *const _ as usize },
0usize,

View File

@ -140,6 +140,7 @@ fn bindgen_test_layout_ip_frag_key() {
/// @internal Fragmented packet to reassemble.
/// First two entries in the frags[] array are for the last and first fragments.
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct ip_frag_pkt {
///< LRU list
@ -213,6 +214,11 @@ fn bindgen_test_layout_ip_frag_pkt() {
192usize,
concat!("Size of: ", stringify!(ip_frag_pkt))
);
assert_eq!(
::std::mem::align_of::<ip_frag_pkt>(),
64usize,
concat!("Alignment of ", stringify!(ip_frag_pkt))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ip_frag_pkt>())).lru as *const _ as usize },
0usize,

View File

@ -1830,6 +1830,7 @@ impl Default for rte_eth_conf__bindgen_ty_1 {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union rte_eth_conf__bindgen_ty_2 {
pub vmdq_dcb_tx_conf: rte_eth_vmdq_dcb_tx_conf,

View File

@ -10,6 +10,7 @@
pub const RTE_CACHE_LINE_MIN_SIZE: u32 = 64;
pub const RTE_CACHE_LINE_SIZE: u32 = 64;
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct rte_kni_mbuf {
pub buf_addr: *mut ::std::os::raw::c_void,
@ -41,6 +42,11 @@ fn bindgen_test_layout_rte_kni_mbuf() {
128usize,
concat!("Size of: ", stringify!(rte_kni_mbuf))
);
assert_eq!(
::std::mem::align_of::<rte_kni_mbuf>(),
64usize,
concat!("Alignment of ", stringify!(rte_kni_mbuf))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_kni_mbuf>())).buf_addr as *const _ as usize },
0usize,

View File

@ -176,6 +176,7 @@ fn bindgen_test_layout_ip_frag_key() {
/// @internal Fragmented packet to reassemble.
/// First two entries in the frags[] array are for the last and first fragments.
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct ip_frag_pkt {
///< LRU list
@ -249,6 +250,11 @@ fn bindgen_test_layout_ip_frag_pkt() {
192usize,
concat!("Size of: ", stringify!(ip_frag_pkt))
);
assert_eq!(
::std::mem::align_of::<ip_frag_pkt>(),
64usize,
concat!("Alignment of ", stringify!(ip_frag_pkt))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ip_frag_pkt>())).lru as *const _ as usize },
0usize,
@ -371,6 +377,7 @@ impl Default for ip_pkt_list {
}
/// fragmentation table statistics
#[repr(C)]
#[repr(align(64))]
#[derive(Copy, Clone)]
pub struct ip_frag_tbl_stat {
///< total # of find/insert attempts.
@ -394,6 +401,11 @@ fn bindgen_test_layout_ip_frag_tbl_stat() {
64usize,
concat!("Size of: ", stringify!(ip_frag_tbl_stat))
);
assert_eq!(
::std::mem::align_of::<ip_frag_tbl_stat>(),
64usize,
concat!("Alignment of ", stringify!(ip_frag_tbl_stat))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ip_frag_tbl_stat>())).find_num as *const _ as usize },
0usize,
@ -462,6 +474,7 @@ impl Default for ip_frag_tbl_stat {
}
/// fragmentation table
#[repr(C)]
#[repr(align(64))]
pub struct rte_ip_frag_tbl {
///< ttl for table entries.
pub max_cycles: u64,
@ -494,6 +507,11 @@ fn bindgen_test_layout_rte_ip_frag_tbl() {
128usize,
concat!("Size of: ", stringify!(rte_ip_frag_tbl))
);
assert_eq!(
::std::mem::align_of::<rte_ip_frag_tbl>(),
64usize,
concat!("Alignment of ", stringify!(rte_ip_frag_tbl))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_ip_frag_tbl>())).max_cycles as *const _ as usize },
0usize,

View File

@ -127,6 +127,7 @@ fn bindgen_test_layout_rte_atomic16_t() {
}
/// The generic rte_mbuf, containing a packet mbuf.
#[repr(C)]
#[repr(align(64))]
pub struct rte_mbuf {
pub cacheline0: MARKER,
///< Virtual address of segment buffer.
@ -179,6 +180,7 @@ pub struct rte_mbuf {
/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
/// config option.
#[repr(C)]
#[repr(align(2))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_1 {
///< Atomically accessed refcnt
@ -228,6 +230,7 @@ impl Default for rte_mbuf__bindgen_ty_1 {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_2 {
///< L2/L3/L4 and tunnel information.
@ -236,10 +239,10 @@ pub union rte_mbuf__bindgen_ty_2 {
_bindgen_union_align: u32,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u8>,
pub __bindgen_align: [u32; 0usize],
}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_2__bindgen_ty_1() {
@ -412,6 +415,7 @@ impl Default for rte_mbuf__bindgen_ty_2 {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_3 {
///< RSS hash result if RSS enabled
@ -431,6 +435,7 @@ pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
pub hi: u32,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1,
@ -667,6 +672,7 @@ impl Default for rte_mbuf__bindgen_ty_3 {
}
}
#[repr(C)]
#[repr(align(8))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_4 {
///< Can be used for external metadata
@ -714,6 +720,7 @@ impl Default for rte_mbuf__bindgen_ty_4 {
}
}
#[repr(C)]
#[repr(align(8))]
#[derive(Copy, Clone)]
pub union rte_mbuf__bindgen_ty_5 {
///< combined for easy fetch
@ -722,10 +729,10 @@ pub union rte_mbuf__bindgen_ty_5 {
_bindgen_union_align: u64,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize], u16>,
pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_5__bindgen_ty_1() {
@ -888,6 +895,11 @@ fn bindgen_test_layout_rte_mbuf() {
128usize,
concat!("Size of: ", stringify!(rte_mbuf))
);
assert_eq!(
::std::mem::align_of::<rte_mbuf>(),
64usize,
concat!("Alignment of ", stringify!(rte_mbuf))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_mbuf>())).cacheline0 as *const _ as usize },
0usize,

View File

@ -6,5 +6,6 @@
non_camel_case_types,
non_upper_case_globals
)]
#![allow(overflowing_literals)]
pub const a: u32 = 18446744073709551611;

View File

@ -6,5 +6,6 @@
non_camel_case_types,
non_upper_case_globals
)]
#![allow(overflowing_literals)]
pub const a: u32 = 18446744073709551611;

View File

@ -6,5 +6,6 @@
non_camel_case_types,
non_upper_case_globals
)]
#![allow(overflowing_literals)]
pub const a: u32 = 4294967291;

View File

@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![cfg(not(test))]
#[repr(C)]
@ -19,6 +24,11 @@ fn bindgen_test_layout_JNINativeInterface_() {
16usize,
concat!("Size of: ", stringify!(JNINativeInterface_))
);
assert_eq!(
::std::mem::align_of::<JNINativeInterface_>(),
8usize,
concat!("Alignment of ", stringify!(JNINativeInterface_))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion as *const _ as usize },
0usize,

View File

@ -6,5 +6,6 @@
non_camel_case_types,
non_upper_case_globals
)]
#![allow(overflowing_literals)]
pub const a: u32 = 4294967291;

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct NoHash {
pub _bindgen_opaque_blob: u32,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct NoPartialEq {
pub _bindgen_opaque_blob: u32,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default)]
pub struct NoCopy {
pub _bindgen_opaque_blob: u32,

View File

@ -1,14 +1,18 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
extern "C" {
#[link_name = "\u{1}_Z3fooP9Container"]
pub fn foo(c: *mut Container);
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Container {
pub _bindgen_opaque_blob: [u32; 2usize],

View File

@ -9,6 +9,7 @@
/// <div rustbindgen opaque>
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct opaque {
pub _bindgen_opaque_blob: u32,

View File

@ -9,6 +9,7 @@
/// <div rustbindgen opaque></div>
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OtherOpaque {
pub _bindgen_opaque_blob: u32,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -10,6 +13,7 @@ pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -10,6 +13,7 @@ pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
@ -11,6 +14,7 @@ pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub b: ::std::os::raw::c_uint,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
@ -57,6 +60,7 @@ pub struct mozilla_StyleShapeSource {
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
}
#[repr(C)]
#[repr(align(8))]
pub union mozilla_StyleShapeSource__bindgen_ty_1 {
pub mPosition: *mut mozilla_Position,
pub mFragmentOrURL: *mut mozilla_FragmentOrURL,

View File

@ -1,14 +1,18 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union bar {
pub baz: ::std::os::raw::c_int,

View File

@ -90,6 +90,7 @@ where
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union U4 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
@ -137,6 +138,7 @@ impl U4 {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union B {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(8))]
pub union UnionWithDtor {
pub mFoo: ::std::os::raw::c_int,
pub mBar: *mut ::std::os::raw::c_void,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(8))]
#[derive(Copy, Clone)]
pub union nsStyleUnion {
pub mInt: ::std::os::raw::c_int,

View File

@ -1,8 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct NastyStruct {
@ -11,6 +14,7 @@ pub struct NastyStruct {
pub __bindgen_anon_1: NastyStruct__bindgen_ty_2,
}
#[repr(C)]
#[repr(align(8))]
pub union NastyStruct__bindgen_ty_1 {
pub mFoo: *mut ::std::os::raw::c_void,
pub mDummy: ::std::os::raw::c_ulong,
@ -22,6 +26,7 @@ impl Default for NastyStruct__bindgen_ty_1 {
}
}
#[repr(C)]
#[repr(align(8))]
pub union NastyStruct__bindgen_ty_2 {
pub wat: ::std::os::raw::c_short,
pub wut: *mut ::std::os::raw::c_int,
@ -38,6 +43,7 @@ impl Default for NastyStruct {
}
}
#[repr(C)]
#[repr(align(8))]
pub union Whatever {
pub mTPtr: *mut ::std::os::raw::c_void,
pub mInt: ::std::os::raw::c_int,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo {
pub bar: foo__bindgen_ty_1,

View File

@ -90,6 +90,7 @@ where
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo {
pub a: ::std::os::raw::c_int,
@ -97,10 +98,10 @@ pub union foo {
_bindgen_union_align: u32,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct foo__bindgen_ty_1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,
pub __bindgen_align: [u32; 0usize],
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {

View File

@ -1,16 +1,21 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo {
pub bar: foo__bindgen_ty_1,
_bindgen_union_align: u32,
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union pixel {
pub rgba: ::std::os::raw::c_uint,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo {
pub a: ::std::os::raw::c_uint,
@ -12,6 +16,7 @@ pub union foo {
_bindgen_union_align: u32,
}
#[repr(C)]
#[repr(align(2))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1 {
pub b: ::std::os::raw::c_ushort,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union WithBigArray {
pub a: ::std::os::raw::c_int,
@ -50,6 +54,7 @@ impl Default for WithBigArray {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union WithBigArray2 {
pub a: ::std::os::raw::c_int,
@ -95,6 +100,7 @@ impl Default for WithBigArray2 {
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union WithBigMember {
pub a: ::std::os::raw::c_int,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(4))]
#[derive(Copy, Clone)]
pub union foo {
pub a: ::std::os::raw::c_uint,
@ -18,6 +22,7 @@ pub struct foo__bindgen_ty_1 {
pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
#[repr(align(2))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1__bindgen_ty_1 {
pub b1: ::std::os::raw::c_ushort,
@ -67,6 +72,7 @@ impl Default for foo__bindgen_ty_1__bindgen_ty_1 {
}
}
#[repr(C)]
#[repr(align(2))]
#[derive(Copy, Clone)]
pub union foo__bindgen_ty_1__bindgen_ty_2 {
pub c1: ::std::os::raw::c_ushort,

View File

@ -1,10 +1,14 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Default, Copy, Clone)]
pub struct max_align_t {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
@ -19,6 +23,11 @@ fn bindgen_test_layout_max_align_t() {
32usize,
concat!("Size of: ", stringify!(max_align_t))
);
assert_eq!(
::std::mem::align_of::<max_align_t>(),
16usize,
concat!("Alignment of ", stringify!(max_align_t))
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce1 as *const _ as usize

View File

@ -1,7 +1,11 @@
/* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
extern crate core;
@ -46,6 +50,7 @@ impl Default for foo {
}
}
#[repr(C)]
#[repr(align(8))]
#[derive(Copy, Clone)]
pub union _bindgen_ty_1 {
pub bar: ::std::os::raw::c_int,

View File

@ -1,3 +1,5 @@
// bindgen-flags: --raw-line "#![allow(overflowing_literals)]"
typedef unsigned int uint32_t;
uint32_t a = 18446744073709551611;

View File

@ -1,6 +1,10 @@
// bindgen-flags: --rust-target 1.21
//
// FIXME: https://github.com/rust-lang/rust-bindgen/issues/1498
struct header
{
char proto;
unsigned int size __attribute__ ((packed));
unsigned char data[] __attribute__ ((aligned(8)));
} __attribute__ ((aligned, packed));
} __attribute__ ((aligned, packed));