diff options
author | Jeff Waugh <jdub@bethesignal.org> | 2016-11-15 14:37:20 +1100 |
---|---|---|
committer | Jeff Waugh <jdub@bethesignal.org> | 2016-11-16 05:31:02 +1100 |
commit | 8270a0ca766ea834032daeb67c7f32a1947ab3bd (patch) | |
tree | b3bbdb0f98e5da995f91c89fbf5b10ecb8290bde /tests | |
parent | 6e78bb8d56d875619d20e343d0f3109e2d6b6841 (diff) |
Transition to libbindgen sub-crate
- The root crate is the `bindgen` binary
- Rust-ify the test suite, no more subprocesses!
- Update Travis config to test both crates
Diffstat (limited to 'tests')
247 files changed, 0 insertions, 7069 deletions
diff --git a/tests/expectations/Cargo.toml b/tests/expectations/Cargo.toml deleted file mode 100644 index 53f1b14f..00000000 --- a/tests/expectations/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "tests_expectations" -description = "bindgen results when ran on ../headers/*" -version = "0.1.0" -authors = [ - "Jyun-Yan You <jyyou.tw@gmail.com>", - "Emilio Cobos Álvarez <ecoal95@gmail.com>", - "The Servo project developers", -] - -[dependencies] diff --git a/tests/expectations/src/lib.rs b/tests/expectations/src/lib.rs deleted file mode 100644 index e69de29b..00000000 --- a/tests/expectations/src/lib.rs +++ /dev/null diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs deleted file mode 100644 index b721980c..00000000 --- a/tests/expectations/tests/accessors.rs +++ /dev/null @@ -1,204 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct SomeAccessors { - pub mNoAccessor: ::std::os::raw::c_int, - /** <div rustbindgen accessor></div> */ - pub mBothAccessors: ::std::os::raw::c_int, - /** <div rustbindgen accessor="unsafe"></div> */ - pub mUnsafeAccessors: ::std::os::raw::c_int, - /** <div rustbindgen accessor="immutable"></div> */ - pub mImmutableAccessor: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_SomeAccessors() { - assert_eq!(::std::mem::size_of::<SomeAccessors>() , 16usize); - assert_eq!(::std::mem::align_of::<SomeAccessors>() , 4usize); -} -impl Clone for SomeAccessors { - fn clone(&self) -> Self { *self } -} -impl SomeAccessors { - #[inline] - pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int { - &self.mBothAccessors - } - #[inline] - pub fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { - &mut self.mBothAccessors - } - #[inline] - pub unsafe fn get_mUnsafeAccessors(&self) -> &::std::os::raw::c_int { - &self.mUnsafeAccessors - } - #[inline] - pub unsafe fn get_mUnsafeAccessors_mut(&mut self) - -> &mut ::std::os::raw::c_int { - &mut self.mUnsafeAccessors - } - #[inline] - pub fn get_mImmutableAccessor(&self) -> &::std::os::raw::c_int { - &self.mImmutableAccessor - } -} -/** <div rustbindgen accessor></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct AllAccessors { - pub mBothAccessors: ::std::os::raw::c_int, - pub mAlsoBothAccessors: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_AllAccessors() { - assert_eq!(::std::mem::size_of::<AllAccessors>() , 8usize); - assert_eq!(::std::mem::align_of::<AllAccessors>() , 4usize); -} -impl Clone for AllAccessors { - fn clone(&self) -> Self { *self } -} -impl AllAccessors { - #[inline] - pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int { - &self.mBothAccessors - } - #[inline] - pub fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { - &mut self.mBothAccessors - } - #[inline] - pub fn get_mAlsoBothAccessors(&self) -> &::std::os::raw::c_int { - &self.mAlsoBothAccessors - } - #[inline] - pub fn get_mAlsoBothAccessors_mut(&mut self) - -> &mut ::std::os::raw::c_int { - &mut self.mAlsoBothAccessors - } -} -/** <div rustbindgen accessor="unsafe"></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct AllUnsafeAccessors { - pub mBothAccessors: ::std::os::raw::c_int, - pub mAlsoBothAccessors: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_AllUnsafeAccessors() { - assert_eq!(::std::mem::size_of::<AllUnsafeAccessors>() , 8usize); - assert_eq!(::std::mem::align_of::<AllUnsafeAccessors>() , 4usize); -} -impl Clone for AllUnsafeAccessors { - fn clone(&self) -> Self { *self } -} -impl AllUnsafeAccessors { - #[inline] - pub unsafe fn get_mBothAccessors(&self) -> &::std::os::raw::c_int { - &self.mBothAccessors - } - #[inline] - pub unsafe fn get_mBothAccessors_mut(&mut self) - -> &mut ::std::os::raw::c_int { - &mut self.mBothAccessors - } - #[inline] - pub unsafe fn get_mAlsoBothAccessors(&self) -> &::std::os::raw::c_int { - &self.mAlsoBothAccessors - } - #[inline] - pub unsafe fn get_mAlsoBothAccessors_mut(&mut self) - -> &mut ::std::os::raw::c_int { - &mut self.mAlsoBothAccessors - } -} -/** <div rustbindgen accessor></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct ContradictAccessors { - pub mBothAccessors: ::std::os::raw::c_int, - /** <div rustbindgen accessor="false"></div> */ - pub mNoAccessors: ::std::os::raw::c_int, - /** <div rustbindgen accessor="unsafe"></div> */ - pub mUnsafeAccessors: ::std::os::raw::c_int, - /** <div rustbindgen accessor="immutable"></div> */ - pub mImmutableAccessor: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_ContradictAccessors() { - assert_eq!(::std::mem::size_of::<ContradictAccessors>() , 16usize); - assert_eq!(::std::mem::align_of::<ContradictAccessors>() , 4usize); -} -impl Clone for ContradictAccessors { - fn clone(&self) -> Self { *self } -} -impl ContradictAccessors { - #[inline] - pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int { - &self.mBothAccessors - } - #[inline] - pub fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int { - &mut self.mBothAccessors - } - #[inline] - pub unsafe fn get_mUnsafeAccessors(&self) -> &::std::os::raw::c_int { - &self.mUnsafeAccessors - } - #[inline] - pub unsafe fn get_mUnsafeAccessors_mut(&mut self) - -> &mut ::std::os::raw::c_int { - &mut self.mUnsafeAccessors - } - #[inline] - pub fn get_mImmutableAccessor(&self) -> &::std::os::raw::c_int { - &self.mImmutableAccessor - } -} -/** <div rustbindgen accessor replaces="Replaced"></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Replaced { - pub mAccessor: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_Replaced() { - assert_eq!(::std::mem::size_of::<Replaced>() , 4usize); - assert_eq!(::std::mem::align_of::<Replaced>() , 4usize); -} -impl Clone for Replaced { - fn clone(&self) -> Self { *self } -} -impl Replaced { - #[inline] - pub fn get_mAccessor(&self) -> &::std::os::raw::c_int { &self.mAccessor } - #[inline] - pub fn get_mAccessor_mut(&mut self) -> &mut ::std::os::raw::c_int { - &mut self.mAccessor - } -} -/** <div rustbindgen accessor></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Wrapper { - pub mReplaced: Replaced, -} -#[test] -fn bindgen_test_layout_Wrapper() { - assert_eq!(::std::mem::size_of::<Wrapper>() , 4usize); - assert_eq!(::std::mem::align_of::<Wrapper>() , 4usize); -} -impl Clone for Wrapper { - fn clone(&self) -> Self { *self } -} -impl Wrapper { - #[inline] - pub fn get_mReplaced(&self) -> &Replaced { &self.mReplaced } - #[inline] - pub fn get_mReplaced_mut(&mut self) -> &mut Replaced { - &mut self.mReplaced - } -} diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs deleted file mode 100644 index dcaf7997..00000000 --- a/tests/expectations/tests/annotation_hide.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -/** - * <div rustbindgen opaque></div> - */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct D { - pub _bindgen_opaque_blob: u32, -} -#[test] -fn bindgen_test_layout_D() { - assert_eq!(::std::mem::size_of::<D>() , 4usize); - assert_eq!(::std::mem::align_of::<D>() , 4usize); -} -impl Clone for D { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct NotAnnotated { - pub f: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_NotAnnotated() { - assert_eq!(::std::mem::size_of::<NotAnnotated>() , 4usize); - assert_eq!(::std::mem::align_of::<NotAnnotated>() , 4usize); -} -impl Clone for NotAnnotated { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs deleted file mode 100644 index 075830e6..00000000 --- a/tests/expectations/tests/anon_enum.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Test { - pub foo: ::std::os::raw::c_int, - pub bar: f32, -} -pub const Test_T_NONE: Test__bindgen_ty_1 = Test__bindgen_ty_1::T_NONE; -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Test__bindgen_ty_1 { T_NONE = 0, } -#[test] -fn bindgen_test_layout_Test() { - assert_eq!(::std::mem::size_of::<Test>() , 8usize); - assert_eq!(::std::mem::align_of::<Test>() , 4usize); -} -impl Clone for Test { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/anon_enum_whitelist.rs b/tests/expectations/tests/anon_enum_whitelist.rs deleted file mode 100644 index b32396a0..00000000 --- a/tests/expectations/tests/anon_enum_whitelist.rs +++ /dev/null @@ -1,11 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const NODE_FLAG_FOO: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_FOO; -pub const NODE_FLAG_BAR: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_BAR; -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_1 { NODE_FLAG_FOO = 0, NODE_FLAG_BAR = 1, } diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs deleted file mode 100644 index 8af416c3..00000000 --- a/tests/expectations/tests/anon_union.rs +++ /dev/null @@ -1,77 +0,0 @@ -/* 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, Copy, Clone)] -pub struct TErrorResult<T> { - pub mResult: ::std::os::raw::c_int, - pub __bindgen_anon_1: TErrorResult__bindgen_ty_1<T>, - pub mMightHaveUnreported: bool, - pub mUnionState: TErrorResult_UnionState, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState = - TErrorResult_UnionState::HasMessage; -#[repr(i32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum TErrorResult_UnionState { HasMessage = 0, } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct TErrorResult_Message<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct TErrorResult_DOMExceptionInfo<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct TErrorResult__bindgen_ty_1<T> { - pub mMessage: __BindgenUnionField<*mut TErrorResult_Message<T>>, - pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo<T>>, - pub bindgen_union_field: u64, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct ErrorResult { - pub _base: TErrorResult<::std::os::raw::c_int>, -} -#[test] -fn bindgen_test_layout_ErrorResult() { - assert_eq!(::std::mem::size_of::<ErrorResult>() , 24usize); - assert_eq!(::std::mem::align_of::<ErrorResult>() , 8usize); -} -impl Clone for ErrorResult { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/arg_keyword.rs b/tests/expectations/tests/arg_keyword.rs deleted file mode 100644 index cb1cc432..00000000 --- a/tests/expectations/tests/arg_keyword.rs +++ /dev/null @@ -1,10 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - #[link_name = "_Z3fooPKc"] - pub fn foo(type_: *const ::std::os::raw::c_char); -} diff --git a/tests/expectations/tests/base-to-derived.rs b/tests/expectations/tests/base-to-derived.rs deleted file mode 100644 index c2af2c43..00000000 --- a/tests/expectations/tests/base-to-derived.rs +++ /dev/null @@ -1,19 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct false_type { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_false_type() { - assert_eq!(::std::mem::size_of::<false_type>() , 1usize); - assert_eq!(::std::mem::align_of::<false_type>() , 1usize); -} -impl Clone for false_type { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/bitfield-enum-basic.rs b/tests/expectations/tests/bitfield-enum-basic.rs deleted file mode 100644 index 03e07de6..00000000 --- a/tests/expectations/tests/bitfield-enum-basic.rs +++ /dev/null @@ -1,77 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const Foo_Bar: Foo = Foo(2); -pub const Foo_Baz: Foo = Foo(4); -pub const Foo_Duplicated: Foo = Foo(4); -pub const Foo_Negative: Foo = Foo(-3); -impl ::std::ops::BitOr<Foo> for Foo { - type - Output - = - Self; - #[inline] - fn bitor(self, other: Self) -> Self { Foo(self.0 | other.0) } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct Foo(pub i32); -pub const Buz_Bar: Buz = Buz(2); -pub const Buz_Baz: Buz = Buz(4); -pub const Buz_Duplicated: Buz = Buz(4); -pub const Buz_Negative: Buz = Buz(-3); -impl ::std::ops::BitOr<Buz> for Buz { - type - Output - = - Self; - #[inline] - fn bitor(self, other: Self) -> Self { Buz(self.0 | other.0) } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct Buz(pub i8); -pub const NS_FOO: _bindgen_ty_1 = _bindgen_ty_1(1); -pub const NS_BAR: _bindgen_ty_1 = _bindgen_ty_1(2); -impl ::std::ops::BitOr<_bindgen_ty_1> for _bindgen_ty_1 { - type - Output - = - Self; - #[inline] - fn bitor(self, other: Self) -> Self { _bindgen_ty_1(self.0 | other.0) } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct _bindgen_ty_1(pub u32); -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Dummy { - pub _address: u8, -} -pub const Dummy_DUMMY_FOO: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(1); -pub const Dummy_DUMMY_BAR: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(2); -impl ::std::ops::BitOr<Dummy__bindgen_ty_1> for Dummy__bindgen_ty_1 { - type - Output - = - Self; - #[inline] - fn bitor(self, other: Self) -> Self { - Dummy__bindgen_ty_1(self.0 | other.0) - } -} -#[repr(C)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct Dummy__bindgen_ty_1(pub u32); -#[test] -fn bindgen_test_layout_Dummy() { - assert_eq!(::std::mem::size_of::<Dummy>() , 1usize); - assert_eq!(::std::mem::align_of::<Dummy>() , 1usize); -} -impl Clone for Dummy { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs deleted file mode 100644 index 528ea518..00000000 --- a/tests/expectations/tests/blocks.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - pub fn atexit_b(arg1: *mut ::std::os::raw::c_void); -} diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs deleted file mode 100644 index 579c24a4..00000000 --- a/tests/expectations/tests/class.rs +++ /dev/null @@ -1,127 +0,0 @@ -/* 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)] -pub struct C { - pub a: ::std::os::raw::c_int, - pub big_array: [::std::os::raw::c_char; 33usize], -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 40usize); - assert_eq!(::std::mem::align_of::<C>() , 4usize); -} -#[repr(C)] -#[derive(Debug)] -pub struct WithDtor { - pub b: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_WithDtor() { - assert_eq!(::std::mem::size_of::<WithDtor>() , 4usize); - assert_eq!(::std::mem::align_of::<WithDtor>() , 4usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Union { - pub d: __BindgenUnionField<f32>, - pub i: __BindgenUnionField<::std::os::raw::c_int>, - pub bindgen_union_field: u32, -} -#[test] -fn bindgen_test_layout_Union() { - assert_eq!(::std::mem::size_of::<Union>() , 4usize); - assert_eq!(::std::mem::align_of::<Union>() , 4usize); -} -impl Clone for Union { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct WithUnion { - pub data: Union, -} -#[test] -fn bindgen_test_layout_WithUnion() { - assert_eq!(::std::mem::size_of::<WithUnion>() , 4usize); - assert_eq!(::std::mem::align_of::<WithUnion>() , 4usize); -} -impl Clone for WithUnion { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct RealAbstractionWithTonsOfMethods { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { - assert_eq!(::std::mem::size_of::<RealAbstractionWithTonsOfMethods>() , - 1usize); - assert_eq!(::std::mem::align_of::<RealAbstractionWithTonsOfMethods>() , - 1usize); -} -extern "C" { - #[link_name = "_ZNK32RealAbstractionWithTonsOfMethods3barEv"] - pub fn RealAbstractionWithTonsOfMethods_bar(this: - *const RealAbstractionWithTonsOfMethods); -} -extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEv"] - pub fn RealAbstractionWithTonsOfMethods_bar1(this: - *mut RealAbstractionWithTonsOfMethods); -} -extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEi"] - pub fn RealAbstractionWithTonsOfMethods_bar2(this: - *mut RealAbstractionWithTonsOfMethods, - foo: ::std::os::raw::c_int); -} -extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3staEv"] - pub fn RealAbstractionWithTonsOfMethods_sta(); -} -impl Clone for RealAbstractionWithTonsOfMethods { - fn clone(&self) -> Self { *self } -} -impl RealAbstractionWithTonsOfMethods { - #[inline] - pub unsafe fn bar(&self) { RealAbstractionWithTonsOfMethods_bar(&*self) } - #[inline] - pub unsafe fn bar1(&mut self) { - RealAbstractionWithTonsOfMethods_bar1(&mut *self) - } - #[inline] - pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) { - RealAbstractionWithTonsOfMethods_bar2(&mut *self, foo) - } - #[inline] - pub unsafe fn sta() { RealAbstractionWithTonsOfMethods_sta() } -} diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs deleted file mode 100644 index 593e156d..00000000 --- a/tests/expectations/tests/class_nested.rs +++ /dev/null @@ -1,59 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct A { - pub member_a: ::std::os::raw::c_int, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct A_B { - pub member_b: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_A_B() { - assert_eq!(::std::mem::size_of::<A_B>() , 4usize); - assert_eq!(::std::mem::align_of::<A_B>() , 4usize); -} -impl Clone for A_B { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_A() { - assert_eq!(::std::mem::size_of::<A>() , 4usize); - assert_eq!(::std::mem::align_of::<A>() , 4usize); -} -impl Clone for A { - fn clone(&self) -> Self { *self } -} -extern "C" { - #[link_name = "var"] - pub static mut var: A_B; -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct D { - pub member: A_B, -} -#[test] -fn bindgen_test_layout_D() { - assert_eq!(::std::mem::size_of::<D>() , 4usize); - assert_eq!(::std::mem::align_of::<D>() , 4usize); -} -impl Clone for D { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Templated<T> { - pub member: T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Templated_Templated_inner<T> { - pub member_ptr: *mut T, -} diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs deleted file mode 100644 index 017f7c22..00000000 --- a/tests/expectations/tests/class_no_members.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct whatever { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_whatever() { - assert_eq!(::std::mem::size_of::<whatever>() , 1usize); - assert_eq!(::std::mem::align_of::<whatever>() , 1usize); -} -impl Clone for whatever { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct whatever_child { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_whatever_child() { - assert_eq!(::std::mem::size_of::<whatever_child>() , 1usize); - assert_eq!(::std::mem::align_of::<whatever_child>() , 1usize); -} -impl Clone for whatever_child { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct whatever_child_with_member { - pub m_member: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_whatever_child_with_member() { - assert_eq!(::std::mem::size_of::<whatever_child_with_member>() , 4usize); - assert_eq!(::std::mem::align_of::<whatever_child_with_member>() , 4usize); -} -impl Clone for whatever_child_with_member { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs deleted file mode 100644 index 8108be2d..00000000 --- a/tests/expectations/tests/class_static.rs +++ /dev/null @@ -1,32 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct MyClass { - pub _address: u8, -} -extern "C" { - #[link_name = "_ZN7MyClass7exampleE"] - pub static mut MyClass_example: *const ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "_ZN7MyClass26example_check_no_collisionE"] - pub static mut MyClass_example_check_no_collision: - *const ::std::os::raw::c_int; -} -#[test] -fn bindgen_test_layout_MyClass() { - assert_eq!(::std::mem::size_of::<MyClass>() , 1usize); - assert_eq!(::std::mem::align_of::<MyClass>() , 1usize); -} -impl Clone for MyClass { - fn clone(&self) -> Self { *self } -} -extern "C" { - #[link_name = "_ZL26example_check_no_collision"] - pub static mut example_check_no_collision: *const ::std::os::raw::c_int; -} diff --git a/tests/expectations/tests/class_static_const.rs b/tests/expectations/tests/class_static_const.rs deleted file mode 100644 index eed6590c..00000000 --- a/tests/expectations/tests/class_static_const.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct A { - pub _address: u8, -} -pub const A_a: ::std::os::raw::c_int = 0; -pub const A_b: i32 = 63; -pub const A_c: u32 = 255; -#[test] -fn bindgen_test_layout_A() { - assert_eq!(::std::mem::size_of::<A>() , 1usize); - assert_eq!(::std::mem::align_of::<A>() , 1usize); -} -impl Clone for A { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs deleted file mode 100644 index c3843b31..00000000 --- a/tests/expectations/tests/class_use_as.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -/** - * <div rustbindgen="true" replaces="whatever"></div> - */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct whatever { - pub replacement: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_whatever() { - assert_eq!(::std::mem::size_of::<whatever>() , 4usize); - assert_eq!(::std::mem::align_of::<whatever>() , 4usize); -} -impl Clone for whatever { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct container { - pub c: whatever, -} -#[test] -fn bindgen_test_layout_container() { - assert_eq!(::std::mem::size_of::<container>() , 4usize); - assert_eq!(::std::mem::align_of::<container>() , 4usize); -} -impl Clone for container { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs deleted file mode 100644 index 8ed1ddf9..00000000 --- a/tests/expectations/tests/class_with_dtor.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug)] -pub struct HandleWithDtor<T> { - pub ptr: *mut T, -} -pub type HandleValue = HandleWithDtor<::std::os::raw::c_int>; -#[repr(C)] -#[derive(Debug)] -pub struct WithoutDtor { - pub shouldBeWithDtor: HandleValue, -} -#[test] -fn bindgen_test_layout_WithoutDtor() { - assert_eq!(::std::mem::size_of::<WithoutDtor>() , 8usize); - assert_eq!(::std::mem::align_of::<WithoutDtor>() , 8usize); -} diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs deleted file mode 100644 index ab51396d..00000000 --- a/tests/expectations/tests/class_with_inner_struct.rs +++ /dev/null @@ -1,195 +0,0 @@ -/* 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, Copy)] -pub struct A { - pub c: ::std::os::raw::c_uint, - pub named_union: A__bindgen_ty_1, - pub __bindgen_anon_1: A__bindgen_ty_2, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct A_Segment { - pub begin: ::std::os::raw::c_int, - pub end: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_A_Segment() { - assert_eq!(::std::mem::size_of::<A_Segment>() , 8usize); - assert_eq!(::std::mem::align_of::<A_Segment>() , 4usize); -} -impl Clone for A_Segment { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct A__bindgen_ty_1 { - pub f: __BindgenUnionField<::std::os::raw::c_int>, - pub bindgen_union_field: u32, -} -#[test] -fn bindgen_test_layout_A__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<A__bindgen_ty_1>() , 4usize); - assert_eq!(::std::mem::align_of::<A__bindgen_ty_1>() , 4usize); -} -impl Clone for A__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct A__bindgen_ty_2 { - pub d: __BindgenUnionField<::std::os::raw::c_int>, - pub bindgen_union_field: u32, -} -#[test] -fn bindgen_test_layout_A__bindgen_ty_2() { - assert_eq!(::std::mem::size_of::<A__bindgen_ty_2>() , 4usize); - assert_eq!(::std::mem::align_of::<A__bindgen_ty_2>() , 4usize); -} -impl Clone for A__bindgen_ty_2 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_A() { - assert_eq!(::std::mem::size_of::<A>() , 12usize); - assert_eq!(::std::mem::align_of::<A>() , 4usize); -} -impl Clone for A { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct B { - pub d: ::std::os::raw::c_uint, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct B_Segment { - pub begin: ::std::os::raw::c_int, - pub end: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_B_Segment() { - assert_eq!(::std::mem::size_of::<B_Segment>() , 8usize); - assert_eq!(::std::mem::align_of::<B_Segment>() , 4usize); -} -impl Clone for B_Segment { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_B() { - assert_eq!(::std::mem::size_of::<B>() , 4usize); - assert_eq!(::std::mem::align_of::<B>() , 4usize); -} -impl Clone for B { - fn clone(&self) -> Self { *self } -} -#[repr(i32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum StepSyntax { - Keyword = 0, - FunctionalWithoutKeyword = 1, - FunctionalWithStartKeyword = 2, - FunctionalWithEndKeyword = 3, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub d: ::std::os::raw::c_uint, - pub __bindgen_anon_1: C__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C__bindgen_ty_1 { - pub mFunc: __BindgenUnionField<C__bindgen_ty_1_1>, - pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_1_2>, - pub bindgen_union_field: [u32; 4usize], -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C__bindgen_ty_1_1 { - pub mX1: f32, - pub mY1: f32, - pub mX2: f32, - pub mY2: f32, -} -#[test] -fn bindgen_test_layout_C__bindgen_ty_1_1() { - assert_eq!(::std::mem::size_of::<C__bindgen_ty_1_1>() , 16usize); - assert_eq!(::std::mem::align_of::<C__bindgen_ty_1_1>() , 4usize); -} -impl Clone for C__bindgen_ty_1_1 { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C__bindgen_ty_1_2 { - pub mStepSyntax: StepSyntax, - pub mSteps: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout_C__bindgen_ty_1_2() { - assert_eq!(::std::mem::size_of::<C__bindgen_ty_1_2>() , 8usize); - assert_eq!(::std::mem::align_of::<C__bindgen_ty_1_2>() , 4usize); -} -impl Clone for C__bindgen_ty_1_2 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_C__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<C__bindgen_ty_1>() , 16usize); - assert_eq!(::std::mem::align_of::<C__bindgen_ty_1>() , 4usize); -} -impl Clone for C__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C_Segment { - pub begin: ::std::os::raw::c_int, - pub end: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_C_Segment() { - assert_eq!(::std::mem::size_of::<C_Segment>() , 8usize); - assert_eq!(::std::mem::align_of::<C_Segment>() , 4usize); -} -impl Clone for C_Segment { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 20usize); - assert_eq!(::std::mem::align_of::<C>() , 4usize); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs deleted file mode 100644 index bc19f2bd..00000000 --- a/tests/expectations/tests/class_with_typedef.rs +++ /dev/null @@ -1,72 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type AnotherInt = ::std::os::raw::c_int; -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub c: C_MyInt, - pub ptr: *mut C_MyInt, - pub arr: [C_MyInt; 10usize], - pub d: AnotherInt, - pub other_ptr: *mut AnotherInt, -} -pub type C_MyInt = ::std::os::raw::c_int; -pub type C_Lookup = *const ::std::os::raw::c_char; -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 72usize); - assert_eq!(::std::mem::align_of::<C>() , 8usize); -} -extern "C" { - #[link_name = "_ZN1C6methodEi"] - pub fn C_method(this: *mut C, c: C_MyInt); -} -extern "C" { - #[link_name = "_ZN1C9methodRefERi"] - pub fn C_methodRef(this: *mut C, c: *mut C_MyInt); -} -extern "C" { - #[link_name = "_ZN1C16complexMethodRefERPKc"] - pub fn C_complexMethodRef(this: *mut C, c: *mut C_Lookup); -} -extern "C" { - #[link_name = "_ZN1C13anotherMethodEi"] - pub fn C_anotherMethod(this: *mut C, c: AnotherInt); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} -impl C { - #[inline] - pub unsafe fn method(&mut self, c: C_MyInt) { C_method(&mut *self, c) } - #[inline] - pub unsafe fn methodRef(&mut self, c: *mut C_MyInt) { - C_methodRef(&mut *self, c) - } - #[inline] - pub unsafe fn complexMethodRef(&mut self, c: *mut C_Lookup) { - C_complexMethodRef(&mut *self, c) - } - #[inline] - pub unsafe fn anotherMethod(&mut self, c: AnotherInt) { - C_anotherMethod(&mut *self, c) - } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct D { - pub _base: C, - pub ptr: *mut C_MyInt, -} -#[test] -fn bindgen_test_layout_D() { - assert_eq!(::std::mem::size_of::<D>() , 80usize); - assert_eq!(::std::mem::align_of::<D>() , 8usize); -} -impl Clone for D { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs deleted file mode 100644 index f2a97952..00000000 --- a/tests/expectations/tests/complex.rs +++ /dev/null @@ -1,64 +0,0 @@ -/* 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 TestDouble { - pub mMember: __BindgenComplex<f64>, -} -#[test] -fn bindgen_test_layout_TestDouble() { - assert_eq!(::std::mem::size_of::<TestDouble>() , 16usize); - assert_eq!(::std::mem::align_of::<TestDouble>() , 8usize); -} -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); - assert_eq!(::std::mem::align_of::<TestDoublePtr>() , 8usize); -} -impl Clone for TestDoublePtr { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct TestFloat { - pub mMember: __BindgenComplex<f32>, -} -#[test] -fn bindgen_test_layout_TestFloat() { - assert_eq!(::std::mem::size_of::<TestFloat>() , 8usize); - assert_eq!(::std::mem::align_of::<TestFloat>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<TestFloatPtr>() , 8usize); -} -impl Clone for TestFloatPtr { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/complex_global.rs b/tests/expectations/tests/complex_global.rs deleted file mode 100644 index badc4d1f..00000000 --- a/tests/expectations/tests/complex_global.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* 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, -} -extern "C" { - #[link_name = "globalValueFloat"] - pub static mut globalValueFloat: __BindgenComplex<f32>; -} -extern "C" { - #[link_name = "globalValueDouble"] - pub static mut globalValueDouble: __BindgenComplex<f64>; -} -extern "C" { - #[link_name = "globalValueLongDouble"] - pub static mut globalValueLongDouble: __BindgenComplex<f64>; -} diff --git a/tests/expectations/tests/const_enum_unnamed.rs b/tests/expectations/tests/const_enum_unnamed.rs deleted file mode 100644 index 0bd3987a..00000000 --- a/tests/expectations/tests/const_enum_unnamed.rs +++ /dev/null @@ -1,28 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const FOO_BAR: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAR; -pub const FOO_BAZ: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAZ; -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_1 { FOO_BAR = 0, FOO_BAZ = 1, } -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Foo { - pub _address: u8, -} -pub const Foo_FOO_BAR: Foo__bindgen_ty_1 = Foo__bindgen_ty_1::FOO_BAR; -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo__bindgen_ty_1 { FOO_BAR = 10, } -#[test] -fn bindgen_test_layout_Foo() { - assert_eq!(::std::mem::size_of::<Foo>() , 1usize); - assert_eq!(::std::mem::align_of::<Foo>() , 1usize); -} -impl Clone for Foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/const_ptr.rs b/tests/expectations/tests/const_ptr.rs deleted file mode 100644 index 89400df1..00000000 --- a/tests/expectations/tests/const_ptr.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - pub fn foo(bar: *const ::std::os::raw::c_void); -} diff --git a/tests/expectations/tests/const_resolved_ty.rs b/tests/expectations/tests/const_resolved_ty.rs deleted file mode 100644 index 77d8f438..00000000 --- a/tests/expectations/tests/const_resolved_ty.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - pub fn foo(foo: *const u8); -} diff --git a/tests/expectations/tests/const_tparam.rs b/tests/expectations/tests/const_tparam.rs deleted file mode 100644 index 3ed10d28..00000000 --- a/tests/expectations/tests/const_tparam.rs +++ /dev/null @@ -1,12 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct C<T> { - pub foo: *const T, - pub bar: *mut T, -} diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs deleted file mode 100644 index 5cd38c13..00000000 --- a/tests/expectations/tests/convert-floats.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* 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); - assert_eq!(::std::mem::align_of::<foo>() , 8usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/crtp.rs b/tests/expectations/tests/crtp.rs deleted file mode 100644 index e4a86b24..00000000 --- a/tests/expectations/tests/crtp.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Base<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Derived { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Derived() { - assert_eq!(::std::mem::size_of::<Derived>() , 1usize); - assert_eq!(::std::mem::align_of::<Derived>() , 1usize); -} -impl Clone for Derived { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug)] -pub struct BaseWithDestructor<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug)] -pub struct DerivedFromBaseWithDestructor { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_DerivedFromBaseWithDestructor() { - assert_eq!(::std::mem::size_of::<DerivedFromBaseWithDestructor>() , - 1usize); - assert_eq!(::std::mem::align_of::<DerivedFromBaseWithDestructor>() , - 1usize); -} diff --git a/tests/expectations/tests/decl_extern_int_twice.rs b/tests/expectations/tests/decl_extern_int_twice.rs deleted file mode 100644 index 603a51b1..00000000 --- a/tests/expectations/tests/decl_extern_int_twice.rs +++ /dev/null @@ -1,10 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - #[link_name = "foo"] - pub static mut foo: ::std::os::raw::c_int; -} diff --git a/tests/expectations/tests/decl_ptr_to_array.rs b/tests/expectations/tests/decl_ptr_to_array.rs deleted file mode 100644 index b8abedb5..00000000 --- a/tests/expectations/tests/decl_ptr_to_array.rs +++ /dev/null @@ -1,10 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - #[link_name = "foo"] - pub static mut foo: *mut [::std::os::raw::c_int; 1usize]; -} diff --git a/tests/expectations/tests/duplicated_constants_in_ns.rs b/tests/expectations/tests/duplicated_constants_in_ns.rs deleted file mode 100644 index cb69890c..00000000 --- a/tests/expectations/tests/duplicated_constants_in_ns.rs +++ /dev/null @@ -1,17 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub mod root { - use root; - pub mod foo { - use root; - pub const FOO: ::std::os::raw::c_int = 4; - } - pub mod bar { - use root; - pub const FOO: ::std::os::raw::c_int = 5; - } -} diff --git a/tests/expectations/tests/elaborated.rs b/tests/expectations/tests/elaborated.rs deleted file mode 100644 index db373d41..00000000 --- a/tests/expectations/tests/elaborated.rs +++ /dev/null @@ -1,11 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type whatever_t = ::std::os::raw::c_int; -extern "C" { - #[link_name = "_Z9somethingPKi"] - pub fn something(wat: *const whatever_t); -} diff --git a/tests/expectations/tests/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs deleted file mode 100644 index e10b56db..00000000 --- a/tests/expectations/tests/empty_template_param_name.rs +++ /dev/null @@ -1,13 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type __void_t = ::std::os::raw::c_void; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __iterator_traits<_Iterator> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<_Iterator>, -} diff --git a/tests/expectations/tests/enum.rs b/tests/expectations/tests/enum.rs deleted file mode 100644 index 8138d697..00000000 --- a/tests/expectations/tests/enum.rs +++ /dev/null @@ -1,12 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo { Bar = 0, Qux = 1, } -#[repr(i32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Neg { MinusOne = -1, One = 1, } diff --git a/tests/expectations/tests/enum_alias.rs b/tests/expectations/tests/enum_alias.rs deleted file mode 100644 index 7ea85598..00000000 --- a/tests/expectations/tests/enum_alias.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Bar { VAL = 0, } diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs deleted file mode 100644 index a55c344e..00000000 --- a/tests/expectations/tests/enum_and_vtable_mangling.rs +++ /dev/null @@ -1,28 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const match_: _bindgen_ty_1 = _bindgen_ty_1::match_; -pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else; -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_1 { match_ = 0, whatever_else = 1, } -#[repr(C)] -pub struct C__bindgen_vtable { -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub vtable_: *const C__bindgen_vtable, - pub i: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 16usize); - assert_eq!(::std::mem::align_of::<C>() , 8usize); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/enum_dupe.rs b/tests/expectations/tests/enum_dupe.rs deleted file mode 100644 index 322b89fc..00000000 --- a/tests/expectations/tests/enum_dupe.rs +++ /dev/null @@ -1,10 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const Foo_Dupe: Foo = Foo::Bar; -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo { Bar = 1, } diff --git a/tests/expectations/tests/enum_explicit_type.rs b/tests/expectations/tests/enum_explicit_type.rs deleted file mode 100644 index 4e555d3a..00000000 --- a/tests/expectations/tests/enum_explicit_type.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo { Bar = 0, Qux = 1, } -#[repr(i8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Neg { MinusOne = -1, One = 1, } -#[repr(u16)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Bigger { Much = 255, Larger = 256, } -#[repr(i64)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum MuchLong { MuchLow = -4294967296, } -#[repr(i64)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum MuchLongLong { I64_MIN = -9223372036854775808, } -#[repr(u64)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum MuchULongLong { MuchHigh = 4294967296, } diff --git a/tests/expectations/tests/enum_negative.rs b/tests/expectations/tests/enum_negative.rs deleted file mode 100644 index 74cf4f16..00000000 --- a/tests/expectations/tests/enum_negative.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(i32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo { Bar = -2, Qux = 1, } diff --git a/tests/expectations/tests/enum_packed.rs b/tests/expectations/tests/enum_packed.rs deleted file mode 100644 index 963763e1..00000000 --- a/tests/expectations/tests/enum_packed.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo { Bar = 0, Qux = 1, } -#[repr(i8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Neg { MinusOne = -1, One = 1, } -#[repr(u16)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Bigger { Much = 255, Larger = 256, } diff --git a/tests/expectations/tests/extern.rs b/tests/expectations/tests/extern.rs deleted file mode 100644 index e7ac7504..00000000 --- a/tests/expectations/tests/extern.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type foo = - ::std::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int) - -> ::std::os::raw::c_int>; diff --git a/tests/expectations/tests/float128.rs b/tests/expectations/tests/float128.rs deleted file mode 100644 index b4b7b2bc..00000000 --- a/tests/expectations/tests/float128.rs +++ /dev/null @@ -1,7 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - - diff --git a/tests/expectations/tests/forward-inherit-struct-with-fields.rs b/tests/expectations/tests/forward-inherit-struct-with-fields.rs deleted file mode 100644 index 84104971..00000000 --- a/tests/expectations/tests/forward-inherit-struct-with-fields.rs +++ /dev/null @@ -1,17 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub _base: RootedBase<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct RootedBase<T> { - pub foo: *mut T, - pub next: *mut Rooted<T>, -} diff --git a/tests/expectations/tests/forward-inherit-struct.rs b/tests/expectations/tests/forward-inherit-struct.rs deleted file mode 100644 index e053adcd..00000000 --- a/tests/expectations/tests/forward-inherit-struct.rs +++ /dev/null @@ -1,18 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct RootedBase<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs deleted file mode 100644 index 5c2764e1..00000000 --- a/tests/expectations/tests/forward_declared_struct.rs +++ /dev/null @@ -1,32 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<a>() , 4usize); -} -impl Clone for a { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<c>() , 4usize); -} -impl Clone for c { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/func_proto.rs b/tests/expectations/tests/func_proto.rs deleted file mode 100644 index e7ac7504..00000000 --- a/tests/expectations/tests/func_proto.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type foo = - ::std::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int) - -> ::std::os::raw::c_int>; diff --git a/tests/expectations/tests/func_ptr.rs b/tests/expectations/tests/func_ptr.rs deleted file mode 100644 index 87ec3e3d..00000000 --- a/tests/expectations/tests/func_ptr.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - #[link_name = "foo"] - pub static mut foo: - ::std::option::Option<unsafe extern "C" fn(x: - ::std::os::raw::c_int, - y: - ::std::os::raw::c_int) - -> ::std::os::raw::c_int>; -} diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs deleted file mode 100644 index dcae771b..00000000 --- a/tests/expectations/tests/func_ptr_in_struct.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* 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); - assert_eq!(::std::mem::align_of::<Foo>() , 8usize); -} -impl Clone for Foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/func_with_array_arg.rs b/tests/expectations/tests/func_with_array_arg.rs deleted file mode 100644 index 1528e0ba..00000000 --- a/tests/expectations/tests/func_with_array_arg.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - pub fn f(x: *mut ::std::os::raw::c_int); -} diff --git a/tests/expectations/tests/func_with_func_ptr_arg.rs b/tests/expectations/tests/func_with_func_ptr_arg.rs deleted file mode 100644 index 4ac25286..00000000 --- a/tests/expectations/tests/func_with_func_ptr_arg.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - pub fn foo(bar: ::std::option::Option<unsafe extern "C" fn()>); -} diff --git a/tests/expectations/tests/in_class_typedef.rs b/tests/expectations/tests/in_class_typedef.rs deleted file mode 100644 index 4e95ca8c..00000000 --- a/tests/expectations/tests/in_class_typedef.rs +++ /dev/null @@ -1,21 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Foo<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -pub type Foo_elem_type<T> = T; -pub type Foo_ptr_type<T> = *mut T; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Foo_Bar<T> { - pub x: ::std::os::raw::c_int, - pub y: ::std::os::raw::c_int, - pub _phantom_0: ::std::marker::PhantomData<T>, -} diff --git a/tests/expectations/tests/inherit-namespaced.rs b/tests/expectations/tests/inherit-namespaced.rs deleted file mode 100644 index a58058b0..00000000 --- a/tests/expectations/tests/inherit-namespaced.rs +++ /dev/null @@ -1,18 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct RootedBase<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} diff --git a/tests/expectations/tests/inherit_named.rs b/tests/expectations/tests/inherit_named.rs deleted file mode 100644 index 8081c649..00000000 --- a/tests/expectations/tests/inherit_named.rs +++ /dev/null @@ -1,17 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Wohoo<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Weeee<T> { - pub _base: T, -} diff --git a/tests/expectations/tests/inherit_typedef.rs b/tests/expectations/tests/inherit_typedef.rs deleted file mode 100644 index ca9041e2..00000000 --- a/tests/expectations/tests/inherit_typedef.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Foo { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Foo() { - assert_eq!(::std::mem::size_of::<Foo>() , 1usize); - assert_eq!(::std::mem::align_of::<Foo>() , 1usize); -} -impl Clone for Foo { - fn clone(&self) -> Self { *self } -} -pub type TypedefedFoo = Foo; -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Bar { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Bar() { - assert_eq!(::std::mem::size_of::<Bar>() , 1usize); - assert_eq!(::std::mem::align_of::<Bar>() , 1usize); -} -impl Clone for Bar { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs deleted file mode 100644 index 666b8ce2..00000000 --- a/tests/expectations/tests/inner_const.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Foo { - pub bar: ::std::os::raw::c_int, -} -extern "C" { - #[link_name = "_ZN3Foo3BOOE"] - pub static mut Foo_BOO: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "_ZN3Foo8whateverE"] - pub static mut Foo_whatever: Foo; -} -#[test] -fn bindgen_test_layout_Foo() { - assert_eq!(::std::mem::size_of::<Foo>() , 4usize); - assert_eq!(::std::mem::align_of::<Foo>() , 4usize); -} -impl Clone for Foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs deleted file mode 100644 index b965b92d..00000000 --- a/tests/expectations/tests/inner_template_self.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct LinkedList<T> { - pub next: *mut LinkedList<T>, - pub prev: *mut LinkedList<T>, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct InstantiateIt { - pub m_list: LinkedList<::std::os::raw::c_int>, -} -#[test] -fn bindgen_test_layout_InstantiateIt() { - assert_eq!(::std::mem::size_of::<InstantiateIt>() , 16usize); - assert_eq!(::std::mem::align_of::<InstantiateIt>() , 8usize); -} -impl Clone for InstantiateIt { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/int128_t.rs b/tests/expectations/tests/int128_t.rs deleted file mode 100644 index b4b7b2bc..00000000 --- a/tests/expectations/tests/int128_t.rs +++ /dev/null @@ -1,7 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - - diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs deleted file mode 100644 index 91f898af..00000000 --- a/tests/expectations/tests/jsval_layout_opaque.rs +++ /dev/null @@ -1,200 +0,0 @@ -/* 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 JSVAL_TAG_SHIFT: ::std::os::raw::c_uint = 47; -pub const JSVAL_PAYLOAD_MASK: ::std::os::raw::c_ulonglong = 140737488355327; -pub const JSVAL_TAG_MASK: ::std::os::raw::c_longlong = -140737488355328; -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum JSValueType { - JSVAL_TYPE_DOUBLE = 0, - JSVAL_TYPE_INT32 = 1, - JSVAL_TYPE_UNDEFINED = 2, - JSVAL_TYPE_BOOLEAN = 3, - JSVAL_TYPE_MAGIC = 4, - JSVAL_TYPE_STRING = 5, - JSVAL_TYPE_SYMBOL = 6, - JSVAL_TYPE_NULL = 7, - JSVAL_TYPE_OBJECT = 8, - JSVAL_TYPE_UNKNOWN = 32, - JSVAL_TYPE_MISSING = 33, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum JSValueTag { - JSVAL_TAG_MAX_DOUBLE = 131056, - JSVAL_TAG_INT32 = 131057, - JSVAL_TAG_UNDEFINED = 131058, - JSVAL_TAG_STRING = 131061, - JSVAL_TAG_SYMBOL = 131062, - JSVAL_TAG_BOOLEAN = 131059, - JSVAL_TAG_MAGIC = 131060, - JSVAL_TAG_NULL = 131063, - JSVAL_TAG_OBJECT = 131064, -} -#[repr(u64)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum JSValueShiftedTag { - JSVAL_SHIFTED_TAG_MAX_DOUBLE = 18444492278190833663, - JSVAL_SHIFTED_TAG_INT32 = 18444633011384221696, - JSVAL_SHIFTED_TAG_UNDEFINED = 18444773748872577024, - JSVAL_SHIFTED_TAG_STRING = 18445195961337643008, - JSVAL_SHIFTED_TAG_SYMBOL = 18445336698825998336, - JSVAL_SHIFTED_TAG_BOOLEAN = 18444914486360932352, - JSVAL_SHIFTED_TAG_MAGIC = 18445055223849287680, - JSVAL_SHIFTED_TAG_NULL = 18445477436314353664, - JSVAL_SHIFTED_TAG_OBJECT = 18445618173802708992, -} -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum JSWhyMagic { - JS_ELEMENTS_HOLE = 0, - JS_NO_ITER_VALUE = 1, - JS_GENERATOR_CLOSING = 2, - JS_NO_CONSTANT = 3, - JS_THIS_POISON = 4, - JS_ARG_POISON = 5, - JS_SERIALIZE_NO_NODE = 6, - JS_LAZY_ARGUMENTS = 7, - JS_OPTIMIZED_ARGUMENTS = 8, - JS_IS_CONSTRUCTING = 9, - JS_OVERWRITTEN_CALLEE = 10, - JS_BLOCK_NEEDS_CLONE = 11, - JS_HASH_KEY_EMPTY = 12, - JS_ION_ERROR = 13, - JS_ION_BAILOUT = 14, - JS_OPTIMIZED_OUT = 15, - JS_UNINITIALIZED_LEXICAL = 16, - JS_GENERIC_MAGIC = 17, - JS_WHY_MAGIC_COUNT = 18, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct jsval_layout { - pub asBits: __BindgenUnionField<u64>, - pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_1>, - pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>, - pub asDouble: __BindgenUnionField<f64>, - pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>, - pub asWord: __BindgenUnionField<usize>, - pub asUIntPtr: __BindgenUnionField<usize>, - pub bindgen_union_field: u64, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct jsval_layout__bindgen_ty_1 { - pub _bitfield_1: u64, -} -#[test] -fn bindgen_test_layout_jsval_layout__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_1>() , 8usize); - assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_1>() , 8usize); -} -impl Clone for jsval_layout__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -impl jsval_layout__bindgen_ty_1 { - #[inline] - pub fn payload47(&self) -> u64 { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & - (140737488355327usize as u64)) >> - 0u32) as u64) - } - } - #[inline] - pub fn set_payload47(&mut self, val: u64) { - self._bitfield_1 &= !(140737488355327usize as u64); - self._bitfield_1 |= - ((val as u64 as u64) << 0u32) & (140737488355327usize as u64); - } - #[inline] - pub fn tag(&self) -> JSValueTag { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & - (18446603336221196288usize as u64)) >> - 47u32) as u32) - } - } - #[inline] - pub fn set_tag(&mut self, val: JSValueTag) { - self._bitfield_1 &= !(18446603336221196288usize as u64); - self._bitfield_1 |= - ((val as u32 as u64) << 47u32) & - (18446603336221196288usize as u64); - } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct jsval_layout__bindgen_ty_2 { - pub payload: jsval_layout__bindgen_ty_2_1, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct jsval_layout__bindgen_ty_2_1 { - pub i32: __BindgenUnionField<i32>, - pub u32: __BindgenUnionField<u32>, - pub why: __BindgenUnionField<JSWhyMagic>, - pub bindgen_union_field: u32, -} -#[test] -fn bindgen_test_layout_jsval_layout__bindgen_ty_2_1() { - assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2_1>() , - 4usize); - assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_2_1>() , - 4usize); -} -impl Clone for jsval_layout__bindgen_ty_2_1 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_jsval_layout__bindgen_ty_2() { - assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2>() , 4usize); - assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_2>() , 4usize); -} -impl Clone for jsval_layout__bindgen_ty_2 { - fn clone(&self) -> Self { *self } -} -impl Clone for jsval_layout { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Value { - pub data: jsval_layout, -} -#[test] -fn bindgen_test_layout_Value() { - assert_eq!(::std::mem::size_of::<Value>() , 8usize); - assert_eq!(::std::mem::align_of::<Value>() , 8usize); -} -impl Clone for Value { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/keywords.rs b/tests/expectations/tests/keywords.rs deleted file mode 100644 index 5b75389e..00000000 --- a/tests/expectations/tests/keywords.rs +++ /dev/null @@ -1,202 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - #[link_name = "u8"] - pub static mut u8: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "u16"] - pub static mut u16: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "u32"] - pub static mut u32: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "u64"] - pub static mut u64: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "i8"] - pub static mut i8: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "i16"] - pub static mut i16: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "i32"] - pub static mut i32: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "i64"] - pub static mut i64: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "f32"] - pub static mut f32: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "f64"] - pub static mut f64: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "usize"] - pub static mut usize: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "isize"] - pub static mut isize: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "as"] - pub static mut as_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "box"] - pub static mut box_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "crate"] - pub static mut crate_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "false"] - pub static mut false_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "fn"] - pub static mut fn_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "impl"] - pub static mut impl_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "in"] - pub static mut in_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "let"] - pub static mut let_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "loop"] - pub static mut loop_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "match"] - pub static mut match_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "mod"] - pub static mut mod_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "move"] - pub static mut move_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "mut"] - pub static mut mut_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "pub"] - pub static mut pub_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "ref"] - pub static mut ref_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "self"] - pub static mut self_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "Self"] - pub static mut Self_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "super"] - pub static mut super_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "trait"] - pub static mut trait_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "true"] - pub static mut true_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "type"] - pub static mut type_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "unsafe"] - pub static mut unsafe_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "use"] - pub static mut use_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "where"] - pub static mut where_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "abstract"] - pub static mut abstract_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "alignof"] - pub static mut alignof_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "become"] - pub static mut become_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "final"] - pub static mut final_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "macro"] - pub static mut macro_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "offsetof"] - pub static mut offsetof_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "override"] - pub static mut override_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "priv"] - pub static mut priv_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "proc"] - pub static mut proc_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "pure"] - pub static mut pure_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "unsized"] - pub static mut unsized_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "virtual"] - pub static mut virtual_: ::std::os::raw::c_int; -} -extern "C" { - #[link_name = "yield"] - pub static mut yield_: ::std::os::raw::c_int; -} diff --git a/tests/expectations/tests/macro-expr-basic.rs b/tests/expectations/tests/macro-expr-basic.rs deleted file mode 100644 index 355294e7..00000000 --- a/tests/expectations/tests/macro-expr-basic.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const FOO: ::std::os::raw::c_uint = 1; -pub const BAR: ::std::os::raw::c_uint = 4; -pub const BAZ: ::std::os::raw::c_uint = 5; -pub const MIN: ::std::os::raw::c_longlong = -9223372036854775808; -pub const BARR: ::std::os::raw::c_uint = 1; -pub const BAZZ: ::std::os::raw::c_uint = 7; -pub const I_RAN_OUT_OF_DUMB_NAMES: ::std::os::raw::c_uint = 7; -pub const HAZ_A_COMMENT: ::std::os::raw::c_uint = 1; -pub const HAZ_A_COMMENT_INSIDE: ::std::os::raw::c_uint = 2; diff --git a/tests/expectations/tests/macro-redef.rs b/tests/expectations/tests/macro-redef.rs deleted file mode 100644 index 881a44ae..00000000 --- a/tests/expectations/tests/macro-redef.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const FOO: ::std::os::raw::c_uint = 4; -pub const BAR: ::std::os::raw::c_uint = 5; -pub const BAZ: ::std::os::raw::c_uint = 6; diff --git a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs b/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs deleted file mode 100644 index 5e9cf522..00000000 --- a/tests/expectations/tests/multiple-inherit-empty-correct-layout.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Foo { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Foo() { - assert_eq!(::std::mem::size_of::<Foo>() , 1usize); - assert_eq!(::std::mem::align_of::<Foo>() , 1usize); -} -impl Clone for Foo { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Bar { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Bar() { - assert_eq!(::std::mem::size_of::<Bar>() , 1usize); - assert_eq!(::std::mem::align_of::<Bar>() , 1usize); -} -impl Clone for Bar { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Baz { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Baz() { - assert_eq!(::std::mem::size_of::<Baz>() , 1usize); - assert_eq!(::std::mem::align_of::<Baz>() , 1usize); -} -impl Clone for Baz { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs deleted file mode 100644 index 0d0d6ea3..00000000 --- a/tests/expectations/tests/mutable.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub m_member: ::std::os::raw::c_int, - pub m_other: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 8usize); - assert_eq!(::std::mem::align_of::<C>() , 4usize); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug)] -pub struct NonCopiable { - pub m_member: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_NonCopiable() { - assert_eq!(::std::mem::size_of::<NonCopiable>() , 4usize); - assert_eq!(::std::mem::align_of::<NonCopiable>() , 4usize); -} -#[repr(C)] -#[derive(Debug)] -pub struct NonCopiableWithNonCopiableMutableMember { - pub m_member: NonCopiable, -} -#[test] -fn bindgen_test_layout_NonCopiableWithNonCopiableMutableMember() { - assert_eq!(::std::mem::size_of::<NonCopiableWithNonCopiableMutableMember>() - , 4usize); - assert_eq!(::std::mem::align_of::<NonCopiableWithNonCopiableMutableMember>() - , 4usize); -} diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs deleted file mode 100644 index bc8bae68..00000000 --- a/tests/expectations/tests/namespace.rs +++ /dev/null @@ -1,85 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub mod root { - use root; - extern "C" { - #[link_name = "_Z9top_levelv"] - pub fn top_level(); - } - pub mod whatever { - use root; - pub type whatever_int_t = ::std::os::raw::c_int; - extern "C" { - #[link_name = "_ZN8whatever11in_whateverEv"] - pub fn in_whatever(); - } - } - pub mod _bindgen_mod_id_13 { - use root; - pub mod empty { - use root; - } - extern "C" { - #[link_name = "_ZN12_GLOBAL__N_13fooEv"] - pub fn foo(); - } - #[repr(C)] - #[derive(Debug, Copy)] - pub struct A { - pub b: root::whatever::whatever_int_t, - } - #[test] - fn bindgen_test_layout_A() { - assert_eq!(::std::mem::size_of::<A>() , 4usize); - assert_eq!(::std::mem::align_of::<A>() , 4usize); - } - impl Clone for A { - fn clone(&self) -> Self { *self } - } - } - #[repr(C)] - #[derive(Debug)] - pub struct C<T> { - pub _base: root::_bindgen_mod_id_13::A, - pub m_c: T, - pub m_c_ptr: *mut T, - pub m_c_arr: [T; 10usize], - } - pub mod w { - use root; - pub type whatever_int_t = ::std::os::raw::c_uint; - #[repr(C)] - #[derive(Debug)] - pub struct D<T> { - pub m_c: root::C<T>, - } - extern "C" { - #[link_name = "_ZN1w3hehEv"] - pub fn heh() -> root::w::whatever_int_t; - } - extern "C" { - #[link_name = "_ZN1w3fooEv"] - pub fn foo() -> root::C<::std::os::raw::c_int>; - } - extern "C" { - #[link_name = "_ZN1w4barrEv"] - pub fn barr() -> root::C<f32>; - } - } -} -extern "C" { - #[link_name = "_Z9top_levelv"] - pub fn top_level(); -} -#[repr(C)] -#[derive(Debug)] -pub struct C<T> { - pub _base: root::_bindgen_mod_id_13::A, - pub m_c: T, - pub m_c_ptr: *mut T, - pub m_c_arr: [T; 10usize], -} diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs deleted file mode 100644 index fdd435aa..00000000 --- a/tests/expectations/tests/nested.rs +++ /dev/null @@ -1,59 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Calc { - pub w: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_Calc() { - assert_eq!(::std::mem::size_of::<Calc>() , 4usize); - assert_eq!(::std::mem::align_of::<Calc>() , 4usize); -} -impl Clone for Calc { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Test { - pub _address: u8, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Test_Size { - pub mWidth: Test_Size_Dimension, - pub mHeight: Test_Size_Dimension, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Test_Size_Dimension { - pub _base: Calc, -} -#[test] -fn bindgen_test_layout_Test_Size_Dimension() { - assert_eq!(::std::mem::size_of::<Test_Size_Dimension>() , 4usize); - assert_eq!(::std::mem::align_of::<Test_Size_Dimension>() , 4usize); -} -impl Clone for Test_Size_Dimension { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_Test_Size() { - assert_eq!(::std::mem::size_of::<Test_Size>() , 8usize); - assert_eq!(::std::mem::align_of::<Test_Size>() , 4usize); -} -impl Clone for Test_Size { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_Test() { - assert_eq!(::std::mem::size_of::<Test>() , 1usize); - assert_eq!(::std::mem::align_of::<Test>() , 1usize); -} -impl Clone for Test { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs deleted file mode 100644 index d74ad55f..00000000 --- a/tests/expectations/tests/nested_vtable.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -pub struct nsISupports__bindgen_vtable { -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsISupports { - pub vtable_: *const nsISupports__bindgen_vtable, -} -#[test] -fn bindgen_test_layout_nsISupports() { - assert_eq!(::std::mem::size_of::<nsISupports>() , 8usize); - assert_eq!(::std::mem::align_of::<nsISupports>() , 8usize); -} -impl Clone for nsISupports { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsIRunnable { - pub _base: nsISupports, -} -#[test] -fn bindgen_test_layout_nsIRunnable() { - assert_eq!(::std::mem::size_of::<nsIRunnable>() , 8usize); - assert_eq!(::std::mem::align_of::<nsIRunnable>() , 8usize); -} -impl Clone for nsIRunnable { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Runnable { - pub _base: nsIRunnable, -} -#[test] -fn bindgen_test_layout_Runnable() { - assert_eq!(::std::mem::size_of::<Runnable>() , 8usize); - assert_eq!(::std::mem::align_of::<Runnable>() , 8usize); -} -impl Clone for Runnable { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs deleted file mode 100644 index f50a889d..00000000 --- a/tests/expectations/tests/no-std.rs +++ /dev/null @@ -1,23 +0,0 @@ -/* 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); - assert_eq!(::core::mem::align_of::<foo>() , 8usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/no_copy.rs b/tests/expectations/tests/no_copy.rs deleted file mode 100644 index 53ab9677..00000000 --- a/tests/expectations/tests/no_copy.rs +++ /dev/null @@ -1,13 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -/** <div rustbindgen nocopy></div> */ -#[repr(C)] -#[derive(Debug)] -pub struct CopiableButWait<T> { - pub whatever: ::std::os::raw::c_int, - pub _phantom_0: ::std::marker::PhantomData<T>, -} diff --git a/tests/expectations/tests/nsStyleAutoArray.rs b/tests/expectations/tests/nsStyleAutoArray.rs deleted file mode 100644 index c150ec46..00000000 --- a/tests/expectations/tests/nsStyleAutoArray.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsTArray<T> { - pub mBuff: *mut T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct nsStyleAutoArray<T> { - pub mFirstElement: T, - pub mOtherElements: nsTArray<T>, -} -#[repr(i32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum nsStyleAutoArray_WithSingleInitialElement { - WITH_SINGLE_INITIAL_ELEMENT = 0, -} diff --git a/tests/expectations/tests/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs deleted file mode 100644 index 68968826..00000000 --- a/tests/expectations/tests/only_bitfields.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub _bitfield_1: u8, -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 1usize); - assert_eq!(::std::mem::align_of::<C>() , 1usize); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} -impl C { - #[inline] - pub fn a(&self) -> bool { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (1usize as u8)) >> - 0u32) as u8) - } - } - #[inline] - pub fn set_a(&mut self, val: bool) { - self._bitfield_1 &= !(1usize as u8); - self._bitfield_1 |= ((val as u8 as u8) << 0u32) & (1usize as u8); - } - #[inline] - pub fn b(&self) -> bool { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (254usize as u8)) >> - 1u32) as u8) - } - } - #[inline] - pub fn set_b(&mut self, val: bool) { - self._bitfield_1 &= !(254usize as u8); - self._bitfield_1 |= ((val as u8 as u8) << 1u32) & (254usize as u8); - } -} diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs deleted file mode 100644 index d537f5c7..00000000 --- a/tests/expectations/tests/opaque_in_struct.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -/** <div rustbindgen opaque> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct opaque { - pub _bindgen_opaque_blob: u32, -} -#[test] -fn bindgen_test_layout_opaque() { - assert_eq!(::std::mem::size_of::<opaque>() , 4usize); - assert_eq!(::std::mem::align_of::<opaque>() , 4usize); -} -impl Clone for opaque { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct container { - pub contained: u32, -} -#[test] -fn bindgen_test_layout_container() { - assert_eq!(::std::mem::size_of::<container>() , 4usize); - assert_eq!(::std::mem::align_of::<container>() , 4usize); -} -impl Clone for container { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs deleted file mode 100644 index 067f55bd..00000000 --- a/tests/expectations/tests/opaque_pointer.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -/** - * <div rustbindgen opaque></div> - */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct OtherOpaque { - pub _bindgen_opaque_blob: u32, -} -#[test] -fn bindgen_test_layout_OtherOpaque() { - assert_eq!(::std::mem::size_of::<OtherOpaque>() , 4usize); - assert_eq!(::std::mem::align_of::<OtherOpaque>() , 4usize); -} -impl Clone for OtherOpaque { - fn clone(&self) -> Self { *self } -} -/** - * <div rustbindgen opaque></div> - */ -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Opaque<T> { - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct WithOpaquePtr { - pub whatever: *mut Opaque<::std::os::raw::c_int>, - pub other: u32, - pub t: u32, -} -#[test] -fn bindgen_test_layout_WithOpaquePtr() { - assert_eq!(::std::mem::size_of::<WithOpaquePtr>() , 16usize); - assert_eq!(::std::mem::align_of::<WithOpaquePtr>() , 8usize); -} -impl Clone for WithOpaquePtr { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs deleted file mode 100644 index c45cbc6f..00000000 --- a/tests/expectations/tests/opaque_typedef.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct RandomTemplate<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -/** <div rustbindgen opaque></div> */ -pub type ShouldBeOpaque = [u8; 0usize]; -pub type ShouldNotBeOpaque = RandomTemplate<f32>; diff --git a/tests/expectations/tests/overflowed_enum.rs b/tests/expectations/tests/overflowed_enum.rs deleted file mode 100644 index 9e1f8a7f..00000000 --- a/tests/expectations/tests/overflowed_enum.rs +++ /dev/null @@ -1,16 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Foo { - BAP_ARM = 9698489, - BAP_X86 = 11960045, - BAP_X86_64 = 3128633167, -} -#[repr(u16)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Bar { One = 1, Big = 2, } diff --git a/tests/expectations/tests/overloading.rs b/tests/expectations/tests/overloading.rs deleted file mode 100644 index 4e138e7d..00000000 --- a/tests/expectations/tests/overloading.rs +++ /dev/null @@ -1,23 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - #[link_name = "_Z8Evaluatec"] - pub fn Evaluate(r: ::std::os::raw::c_char) -> bool; -} -extern "C" { - #[link_name = "_Z8Evaluateii"] - pub fn Evaluate1(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) - -> bool; -} -extern "C" { - #[link_name = "_ZN3foo10MyFunctionEv"] - pub fn MyFunction(); -} -extern "C" { - #[link_name = "_ZN3bar10MyFunctionEv"] - pub fn MyFunction1(); -} diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs deleted file mode 100644 index c4ac37d1..00000000 --- a/tests/expectations/tests/private.rs +++ /dev/null @@ -1,52 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct HasPrivate { - pub mNotPrivate: ::std::os::raw::c_int, - /** <div rustbindgen private></div> */ - mIsPrivate: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_HasPrivate() { - assert_eq!(::std::mem::size_of::<HasPrivate>() , 8usize); - assert_eq!(::std::mem::align_of::<HasPrivate>() , 4usize); -} -impl Clone for HasPrivate { - fn clone(&self) -> Self { *self } -} -/** <div rustbindgen private></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct VeryPrivate { - mIsPrivate: ::std::os::raw::c_int, - mIsAlsoPrivate: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_VeryPrivate() { - assert_eq!(::std::mem::size_of::<VeryPrivate>() , 8usize); - assert_eq!(::std::mem::align_of::<VeryPrivate>() , 4usize); -} -impl Clone for VeryPrivate { - fn clone(&self) -> Self { *self } -} -/** <div rustbindgen private></div> */ -#[repr(C)] -#[derive(Debug, Copy)] -pub struct ContradictPrivate { - /** <div rustbindgen private="false"></div> */ - pub mNotPrivate: ::std::os::raw::c_int, - mIsPrivate: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_ContradictPrivate() { - assert_eq!(::std::mem::size_of::<ContradictPrivate>() , 8usize); - assert_eq!(::std::mem::align_of::<ContradictPrivate>() , 4usize); -} -impl Clone for ContradictPrivate { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/redeclaration.rs b/tests/expectations/tests/redeclaration.rs deleted file mode 100644 index 0d7e585c..00000000 --- a/tests/expectations/tests/redeclaration.rs +++ /dev/null @@ -1,9 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -extern "C" { - pub fn foo(); -} diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs deleted file mode 100644 index c88492d7..00000000 --- a/tests/expectations/tests/ref_argument_array.rs +++ /dev/null @@ -1,23 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const NSID_LENGTH: ::std::os::raw::c_uint = 10; -#[repr(C)] -pub struct nsID__bindgen_vtable { -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct nsID { - pub vtable_: *const nsID__bindgen_vtable, -} -#[test] -fn bindgen_test_layout_nsID() { - assert_eq!(::std::mem::size_of::<nsID>() , 8usize); - assert_eq!(::std::mem::align_of::<nsID>() , 8usize); -} -impl Clone for nsID { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/replace_template_alias.rs b/tests/expectations/tests/replace_template_alias.rs deleted file mode 100644 index 61a2fbcc..00000000 --- a/tests/expectations/tests/replace_template_alias.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub ptr: MaybeWrapped<T>, -} -/// But the replacement type does use T! -/// -/// <div rustbindgen replaces="MaybeWrapped" /> -pub type MaybeWrapped<T> = T; diff --git a/tests/expectations/tests/replaces_double.rs b/tests/expectations/tests/replaces_double.rs deleted file mode 100644 index 50dafd42..00000000 --- a/tests/expectations/tests/replaces_double.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub ptr: Rooted_MaybeWrapped<T>, -} -/** - * <div rustbindgen replaces="Rooted_MaybeWrapped"></div> - */ -pub type Rooted_MaybeWrapped<T> = T; diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs deleted file mode 100644 index 78351ecc..00000000 --- a/tests/expectations/tests/size_t_template.rs +++ /dev/null @@ -1,19 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub arr: [u32; 3usize], -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 12usize); - assert_eq!(::std::mem::align_of::<C>() , 4usize); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs deleted file mode 100644 index 388cc595..00000000 --- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs +++ /dev/null @@ -1,32 +0,0 @@ -/* 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, 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); - assert_eq!(::std::mem::align_of::<a_b>() , 4usize); -} -impl Clone for a_b { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_a() { - assert_eq!(::std::mem::size_of::<a>() , 8usize); - assert_eq!(::std::mem::align_of::<a>() , 8usize); -} -impl Clone for a { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs deleted file mode 100644 index 1c49675d..00000000 --- a/tests/expectations/tests/struct_with_anon_struct.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo { - pub bar: foo__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs deleted file mode 100644 index 6e1c0315..00000000 --- a/tests/expectations/tests/struct_with_anon_struct_array.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo { - pub bar: [foo__bindgen_ty_1; 2usize], - pub baz: [[[foo__bindgen_ty_2; 4usize]; 3usize]; 2usize], -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -impl Clone for foo__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_2>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs deleted file mode 100644 index aa77d4b6..00000000 --- a/tests/expectations/tests/struct_with_anon_struct_pointer.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* 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, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 8usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs deleted file mode 100644 index 0d2e937a..00000000 --- a/tests/expectations/tests/struct_with_anon_union.rs +++ /dev/null @@ -1,58 +0,0 @@ -/* 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, Copy)] -pub struct foo { - pub bar: foo__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs deleted file mode 100644 index 1b77fccc..00000000 --- a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo { - pub __bindgen_anon_1: foo__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs deleted file mode 100644 index 2914eb41..00000000 --- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs +++ /dev/null @@ -1,58 +0,0 @@ -/* 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, Copy)] -pub struct foo { - pub __bindgen_anon_1: foo__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs deleted file mode 100644 index 3fb83a47..00000000 --- a/tests/expectations/tests/struct_with_bitfields.rs +++ /dev/null @@ -1,122 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<bitfield>() , 4usize); -} -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); - } -} diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs deleted file mode 100644 index 52906a81..00000000 --- a/tests/expectations/tests/struct_with_derive_debug.rs +++ /dev/null @@ -1,50 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<LittleArray>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<BigArray>() , 4usize); -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct WithLittleArray { - pub a: LittleArray, -} -#[test] -fn bindgen_test_layout_WithLittleArray() { - assert_eq!(::std::mem::size_of::<WithLittleArray>() , 128usize); - assert_eq!(::std::mem::align_of::<WithLittleArray>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<WithBigArray>() , 4usize); -} diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs deleted file mode 100644 index 97a0949e..00000000 --- a/tests/expectations/tests/struct_with_nesting.rs +++ /dev/null @@ -1,90 +0,0 @@ -/* 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, Copy)] -pub struct foo { - pub a: ::std::os::raw::c_uint, - pub __bindgen_anon_1: foo__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo__bindgen_ty_1 { - pub b: __BindgenUnionField<::std::os::raw::c_uint>, - pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1_1>, - pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_1_2>, - pub bindgen_union_field: u32, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo__bindgen_ty_1_1 { - pub c1: ::std::os::raw::c_ushort, - pub c2: ::std::os::raw::c_ushort, -} -#[test] -fn bindgen_test_layout_foo__bindgen_ty_1_1() { - assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_1>() , 4usize); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_1>() , 2usize); -} -impl Clone for foo__bindgen_ty_1_1 { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo__bindgen_ty_1_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_2() { - assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_2>() , 4usize); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_2>() , 1usize); -} -impl Clone for foo__bindgen_ty_1_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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs deleted file mode 100644 index 93fc3f11..00000000 --- a/tests/expectations/tests/struct_with_packing.rs +++ /dev/null @@ -1,20 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C, packed)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<a>() , 1usize); -} -impl Clone for a { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs deleted file mode 100644 index c8cdc927..00000000 --- a/tests/expectations/tests/struct_with_struct.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo { - pub bar: foo__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/struct_with_typedef_template_arg.rs b/tests/expectations/tests/struct_with_typedef_template_arg.rs deleted file mode 100644 index 6f8d71f1..00000000 --- a/tests/expectations/tests/struct_with_typedef_template_arg.rs +++ /dev/null @@ -1,15 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Proxy<T, Args> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, - pub _phantom_1: ::std::marker::PhantomData<Args>, -} -pub type Proxy_foo<T> = - ::std::option::Option<unsafe extern "C" fn(bar: *mut T)>; diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs deleted file mode 100644 index 76afc879..00000000 --- a/tests/expectations/tests/template.rs +++ /dev/null @@ -1,170 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug)] -pub struct Foo<T, U> { - pub m_member: T, - pub m_member_ptr: *mut T, - pub m_member_arr: [T; 1usize], - pub _phantom_1: ::std::marker::PhantomData<U>, -} -extern "C" { - #[link_name = "_Z3bar3FooIiiE"] - pub fn bar(foo: Foo<::std::os::raw::c_int, ::std::os::raw::c_int>); -} -#[repr(C)] -#[derive(Debug)] -pub struct D<T> { - pub m_foo: D_MyFoo, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -pub type D_MyFoo = Foo<::std::os::raw::c_int, ::std::os::raw::c_int>; -#[repr(C)] -#[derive(Debug)] -pub struct D_U<T, Z> { - pub m_nested_foo: D_MyFoo, - pub m_baz: Z, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub prev: *mut T, - pub next: *mut Rooted<*mut ::std::os::raw::c_void>, - pub ptr: T, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct RootedContainer { - pub root: Rooted<*mut ::std::os::raw::c_void>, -} -#[test] -fn bindgen_test_layout_RootedContainer() { - assert_eq!(::std::mem::size_of::<RootedContainer>() , 24usize); - assert_eq!(::std::mem::align_of::<RootedContainer>() , 8usize); -} -impl Clone for RootedContainer { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug)] -pub struct WithDtor<T> { - pub member: T, -} -pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>; -#[repr(C)] -#[derive(Debug)] -pub struct PODButContainsDtor { - pub member: WithDtorIntFwd, -} -#[test] -fn bindgen_test_layout_PODButContainsDtor() { - assert_eq!(::std::mem::size_of::<PODButContainsDtor>() , 4usize); - assert_eq!(::std::mem::align_of::<PODButContainsDtor>() , 4usize); -} -/** <div rustbindgen opaque> */ -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Opaque<T> { - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct POD { - pub opaque_member: u32, -} -#[test] -fn bindgen_test_layout_POD() { - assert_eq!(::std::mem::size_of::<POD>() , 4usize); - assert_eq!(::std::mem::align_of::<POD>() , 4usize); -} -impl Clone for POD { - fn clone(&self) -> Self { *self } -} -/** - * <div rustbindgen replaces="NestedReplaced"></div> - */ -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NestedReplaced<T> { - pub buff: *mut T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NestedBase<T, U> { - pub buff: *mut T, - pub _phantom_1: ::std::marker::PhantomData<U>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Incomplete<T> { - pub d: T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NestedContainer<T> { - pub c: T, - pub nested: NestedReplaced<T>, - pub inc: Incomplete<T>, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Untemplated { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Untemplated() { - assert_eq!(::std::mem::size_of::<Untemplated>() , 1usize); - assert_eq!(::std::mem::align_of::<Untemplated>() , 1usize); -} -impl Clone for Untemplated { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Templated<T> { - pub m_untemplated: Untemplated, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -/** - * If the replacement doesn't happen at the parse level the container would be - * copy and the replacement wouldn't, so this wouldn't compile. - * - * <div rustbindgen replaces="ReplacedWithoutDestructor"></div> - */ -#[repr(C)] -#[derive(Debug)] -pub struct ReplacedWithoutDestructor<T> { - pub buff: *mut T, -} -#[repr(C)] -#[derive(Debug)] -pub struct ShouldNotBeCopiable<T> { - pub m_member: ReplacedWithoutDestructor<T>, -} -#[repr(C)] -#[derive(Debug)] -pub struct ShouldNotBeCopiableAsWell<U> { - pub m_member: ReplacedWithoutDestructorFwd<U>, -} -/** - * If the replacement doesn't happen at the parse level the container would be - * copy and the replacement wouldn't, so this wouldn't compile. - * - * <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div> - */ -#[repr(C)] -#[derive(Debug)] -pub struct ReplacedWithoutDestructorFwd<T> { - pub buff: *mut T, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct TemplateWithVar<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} diff --git a/tests/expectations/tests/template_alias.rs b/tests/expectations/tests/template_alias.rs deleted file mode 100644 index 6457381f..00000000 --- a/tests/expectations/tests/template_alias.rs +++ /dev/null @@ -1,12 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type Wrapped<T> = T; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub ptr: Wrapped<T>, -} diff --git a/tests/expectations/tests/template_alias_basic.rs b/tests/expectations/tests/template_alias_basic.rs deleted file mode 100644 index 656fff33..00000000 --- a/tests/expectations/tests/template_alias_basic.rs +++ /dev/null @@ -1,7 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type Wrapped<T> = T; diff --git a/tests/expectations/tests/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs deleted file mode 100644 index 475c2b05..00000000 --- a/tests/expectations/tests/template_alias_namespace.rs +++ /dev/null @@ -1,21 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub mod root { - use root; - pub mod JS { - use root; - pub mod detail { - use root; - pub type Wrapped<T> = T; - } - #[repr(C)] - #[derive(Debug, Copy, Clone)] - pub struct Rooted<T> { - pub ptr: root::JS::detail::Wrapped<T>, - } - } -} diff --git a/tests/expectations/tests/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs deleted file mode 100644 index 166ddc3c..00000000 --- a/tests/expectations/tests/template_typedef_transitive_param.rs +++ /dev/null @@ -1,18 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Wrapper<T> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Wrapper_Wrapped<T> { - pub t: T, -} -pub type Wrapper_Type<T> = Wrapper_Wrapped<T>; diff --git a/tests/expectations/tests/template_typedefs.rs b/tests/expectations/tests/template_typedefs.rs deleted file mode 100644 index 5f0d80b9..00000000 --- a/tests/expectations/tests/template_typedefs.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type foo = - ::std::option::Option<unsafe extern "C" fn(arg1: ::std::os::raw::c_int)>; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Foo<T, U> { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData<T>, - pub _phantom_1: ::std::marker::PhantomData<U>, -} -pub type Foo_Char<T> = T; -pub type Foo_FooPtrTypedef<T> = *mut Foo_Char<T>; -pub type Foo_nsCOMArrayEnumFunc<T> = - ::std::option::Option<unsafe extern "C" fn(aElement: *mut T, - aData: - *mut ::std::os::raw::c_void) - -> bool>; diff --git a/tests/expectations/tests/type_alias_empty.rs b/tests/expectations/tests/type_alias_empty.rs deleted file mode 100644 index 47e36006..00000000 --- a/tests/expectations/tests/type_alias_empty.rs +++ /dev/null @@ -1,7 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub type bool_constant = (); diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs deleted file mode 100644 index da944146..00000000 --- a/tests/expectations/tests/typeref.rs +++ /dev/null @@ -1,96 +0,0 @@ -/* 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, Copy)] -pub struct nsFoo { - pub mBar: StyleShapeSource<::std::os::raw::c_int>, -} -#[test] -fn bindgen_test_layout_nsFoo() { - assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize); - assert_eq!(::std::mem::align_of::<nsFoo>() , 8usize); -} -impl Clone for nsFoo { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct FragmentOrURL { - pub mIsLocalRef: bool, -} -#[test] -fn bindgen_test_layout_FragmentOrURL() { - assert_eq!(::std::mem::size_of::<FragmentOrURL>() , 1usize); - assert_eq!(::std::mem::align_of::<FragmentOrURL>() , 1usize); -} -impl Clone for FragmentOrURL { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Position { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_Position() { - assert_eq!(::std::mem::size_of::<Position>() , 1usize); - assert_eq!(::std::mem::align_of::<Position>() , 1usize); -} -impl Clone for Position { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Bar { - pub mFoo: *mut nsFoo, -} -#[test] -fn bindgen_test_layout_Bar() { - assert_eq!(::std::mem::size_of::<Bar>() , 8usize); - assert_eq!(::std::mem::align_of::<Bar>() , 8usize); -} -impl Clone for Bar { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct StyleShapeSource<ReferenceBox> { - pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_1<ReferenceBox>, - pub _phantom_0: ::std::marker::PhantomData<ReferenceBox>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct StyleShapeSource__bindgen_ty_1<ReferenceBox> { - pub mPosition: __BindgenUnionField<*mut Position>, - pub mFragmentOrURL: __BindgenUnionField<*mut FragmentOrURL>, - pub bindgen_union_field: u64, - pub _phantom_0: ::std::marker::PhantomData<ReferenceBox>, -} diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs deleted file mode 100644 index 9be626ff..00000000 --- a/tests/expectations/tests/union_dtor.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* 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)] -pub struct UnionWithDtor { - pub mFoo: __BindgenUnionField<::std::os::raw::c_int>, - pub mBar: __BindgenUnionField<*mut ::std::os::raw::c_void>, - pub bindgen_union_field: u64, -} -#[test] -fn bindgen_test_layout_UnionWithDtor() { - assert_eq!(::std::mem::size_of::<UnionWithDtor>() , 8usize); - assert_eq!(::std::mem::align_of::<UnionWithDtor>() , 8usize); -} diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs deleted file mode 100644 index 495e80f9..00000000 --- a/tests/expectations/tests/union_fields.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* 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, Copy)] -pub struct _bindgen_ty_1 { - pub mInt: __BindgenUnionField<::std::os::raw::c_int>, - pub mFloat: __BindgenUnionField<f32>, - pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>, - pub bindgen_union_field: u64, -} -#[test] -fn bindgen_test_layout__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 8usize); - assert_eq!(::std::mem::align_of::<_bindgen_ty_1>() , 8usize); -} -impl Clone for _bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -pub type nsStyleUnion = _bindgen_ty_1; diff --git a/tests/expectations/tests/union_template.rs b/tests/expectations/tests/union_template.rs deleted file mode 100644 index fc92afb8..00000000 --- a/tests/expectations/tests/union_template.rs +++ /dev/null @@ -1,62 +0,0 @@ -/* 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, Copy, Clone)] -pub struct NastyStruct<T> { - pub mIsSome: bool, - pub mStorage: NastyStruct__bindgen_ty_1<T>, - pub __bindgen_anon_1: NastyStruct__bindgen_ty_2<T>, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NastyStruct__bindgen_ty_1<T> { - pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>, - pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>, - pub bindgen_union_field: u64, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct NastyStruct__bindgen_ty_2<T> { - pub wat: __BindgenUnionField<::std::os::raw::c_short>, - pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>, - pub bindgen_union_field: u64, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Whatever<T> { - pub mTPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>, - pub mInt: __BindgenUnionField<::std::os::raw::c_int>, - pub bindgen_union_field: u64, - pub _phantom_0: ::std::marker::PhantomData<T>, -} diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs deleted file mode 100644 index f0a21512..00000000 --- a/tests/expectations/tests/union_with_anon_struct.rs +++ /dev/null @@ -1,58 +0,0 @@ -/* 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, Copy)] -pub struct foo { - pub bar: __BindgenUnionField<foo__bindgen_ty_1>, - pub bindgen_union_field: [u32; 2usize], -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs deleted file mode 100644 index 548b0dc4..00000000 --- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs +++ /dev/null @@ -1,86 +0,0 @@ -/* 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, 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, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs deleted file mode 100644 index 95278556..00000000 --- a/tests/expectations/tests/union_with_anon_union.rs +++ /dev/null @@ -1,59 +0,0 @@ -/* 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, Copy)] -pub struct foo { - pub bar: __BindgenUnionField<foo__bindgen_ty_1>, - pub bindgen_union_field: u32, -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs deleted file mode 100644 index 2d6fab97..00000000 --- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs +++ /dev/null @@ -1,61 +0,0 @@ -/* 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, 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, 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); - assert_eq!(::std::mem::align_of::<pixel__bindgen_ty_1>() , 1usize); -} -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); - assert_eq!(::std::mem::align_of::<pixel>() , 4usize); -} -impl Clone for pixel { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs deleted file mode 100644 index eb214017..00000000 --- a/tests/expectations/tests/union_with_anon_unnamed_union.rs +++ /dev/null @@ -1,60 +0,0 @@ -/* 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, 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, 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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs deleted file mode 100644 index b921f33c..00000000 --- a/tests/expectations/tests/union_with_big_member.rs +++ /dev/null @@ -1,75 +0,0 @@ -/* 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); - assert_eq!(::std::mem::align_of::<WithBigArray>() , 4usize); -} -impl Clone for WithBigArray { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, 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); - assert_eq!(::std::mem::align_of::<WithBigArray2>() , 4usize); -} -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); - assert_eq!(::std::mem::align_of::<WithBigMember>() , 4usize); -} -impl Clone for WithBigMember { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs deleted file mode 100644 index 61c08a2a..00000000 --- a/tests/expectations/tests/union_with_nesting.rs +++ /dev/null @@ -1,89 +0,0 @@ -/* 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, 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, Copy)] -pub struct foo__bindgen_ty_1 { - pub __bindgen_anon_1: foo__bindgen_ty_1_1, - pub __bindgen_anon_2: foo__bindgen_ty_1_2, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo__bindgen_ty_1_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_1() { - assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_1>() , 2usize); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_1>() , 2usize); -} -impl Clone for foo__bindgen_ty_1_1 { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo__bindgen_ty_1_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_2() { - assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_2>() , 2usize); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_2>() , 2usize); -} -impl Clone for foo__bindgen_ty_1_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); - assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize); -} -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); - assert_eq!(::std::mem::align_of::<foo>() , 4usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs deleted file mode 100644 index fd9cce45..00000000 --- a/tests/expectations/tests/unknown_attr.rs +++ /dev/null @@ -1,16 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct _bindgen_ty_1 { - pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, - pub __clang_max_align_nonce2: f64, -} -impl Clone for _bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -pub type max_align_t = _bindgen_ty_1; diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs deleted file mode 100644 index b0900f5f..00000000 --- a/tests/expectations/tests/use-core.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - -extern crate core; - -#[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); - assert_eq!(::core::mem::align_of::<foo>() , 8usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} -pub type fooFunction = - ::core::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)>; diff --git a/tests/expectations/tests/using.rs b/tests/expectations/tests/using.rs deleted file mode 100644 index dbb6c84f..00000000 --- a/tests/expectations/tests/using.rs +++ /dev/null @@ -1,14 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Point<T> { - pub x: T, - pub y: T, -} -pub type IntPoint2D = Point<::std::os::raw::c_int>; -pub type IntVec2D = Point<::std::os::raw::c_int>; diff --git a/tests/expectations/tests/vector.rs b/tests/expectations/tests/vector.rs deleted file mode 100644 index b8ca5735..00000000 --- a/tests/expectations/tests/vector.rs +++ /dev/null @@ -1,19 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct foo { - pub mMember: [::std::os::raw::c_longlong; 1usize], -} -#[test] -fn bindgen_test_layout_foo() { - assert_eq!(::std::mem::size_of::<foo>() , 8usize); - assert_eq!(::std::mem::align_of::<foo>() , 8usize); -} -impl Clone for foo { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/virtual_dtor.rs b/tests/expectations/tests/virtual_dtor.rs deleted file mode 100644 index 9571f084..00000000 --- a/tests/expectations/tests/virtual_dtor.rs +++ /dev/null @@ -1,19 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -pub struct nsSlots__bindgen_vtable { -} -#[repr(C)] -#[derive(Debug)] -pub struct nsSlots { - pub vtable_: *const nsSlots__bindgen_vtable, -} -#[test] -fn bindgen_test_layout_nsSlots() { - assert_eq!(::std::mem::size_of::<nsSlots>() , 8usize); - assert_eq!(::std::mem::align_of::<nsSlots>() , 8usize); -} diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs deleted file mode 100644 index 7833cdbf..00000000 --- a/tests/expectations/tests/virtual_overloaded.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -pub struct C__bindgen_vtable { -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct C { - pub vtable_: *const C__bindgen_vtable, -} -#[test] -fn bindgen_test_layout_C() { - assert_eq!(::std::mem::size_of::<C>() , 8usize); - assert_eq!(::std::mem::align_of::<C>() , 8usize); -} -impl Clone for C { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs deleted file mode 100644 index ce62eeb0..00000000 --- a/tests/expectations/tests/vtable_recursive_sig.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Derived { - pub _base: Base, -} -#[test] -fn bindgen_test_layout_Derived() { - assert_eq!(::std::mem::size_of::<Derived>() , 8usize); - assert_eq!(::std::mem::align_of::<Derived>() , 8usize); -} -impl Clone for Derived { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -pub struct Base__bindgen_vtable { -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Base { - pub vtable_: *const Base__bindgen_vtable, -} -#[test] -fn bindgen_test_layout_Base() { - assert_eq!(::std::mem::size_of::<Base>() , 8usize); - assert_eq!(::std::mem::align_of::<Base>() , 8usize); -} -impl Clone for Base { - fn clone(&self) -> Self { *self } -} diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs deleted file mode 100644 index 56ee76a5..00000000 --- a/tests/expectations/tests/weird_bitfields.rs +++ /dev/null @@ -1,128 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum nsStyleSVGOpacitySource { - eStyleSVGOpacitySource_Normal = 0, - eStyleSVGOpacitySource_ContextFillOpacity = 1, - eStyleSVGOpacitySource_ContextStrokeOpacity = 2, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct Weird { - pub mStrokeDasharrayLength: ::std::os::raw::c_uint, - pub _bitfield_1: u32, - pub mClipRule: ::std::os::raw::c_uchar, - pub mColorInterpolation: ::std::os::raw::c_uchar, - pub mColorInterpolationFilters: ::std::os::raw::c_uchar, - pub mFillRule: ::std::os::raw::c_uchar, - pub mImageRendering: ::std::os::raw::c_uchar, - pub mPaintOrder: ::std::os::raw::c_uchar, - pub mShapeRendering: ::std::os::raw::c_uchar, - pub mStrokeLinecap: ::std::os::raw::c_uchar, - pub mStrokeLinejoin: ::std::os::raw::c_uchar, - pub mTextAnchor: ::std::os::raw::c_uchar, - pub mTextRendering: ::std::os::raw::c_uchar, - pub _bitfield_2: u16, -} -#[test] -fn bindgen_test_layout_Weird() { - assert_eq!(::std::mem::size_of::<Weird>() , 24usize); - assert_eq!(::std::mem::align_of::<Weird>() , 4usize); -} -impl Clone for Weird { - fn clone(&self) -> Self { *self } -} -impl Weird { - #[inline] - pub fn bitTest(&self) -> ::std::os::raw::c_uint { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (65535usize as u32)) >> - 0u32) as u32) - } - } - #[inline] - pub fn set_bitTest(&mut self, val: ::std::os::raw::c_uint) { - self._bitfield_1 &= !(65535usize as u32); - self._bitfield_1 |= - ((val as u32 as u32) << 0u32) & (65535usize as u32); - } - #[inline] - pub fn bitTest2(&self) -> ::std::os::raw::c_uint { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & - (2147418112usize as u32)) >> 16u32) as - u32) - } - } - #[inline] - pub fn set_bitTest2(&mut self, val: ::std::os::raw::c_uint) { - self._bitfield_1 &= !(2147418112usize as u32); - self._bitfield_1 |= - ((val as u32 as u32) << 16u32) & (2147418112usize as u32); - } - #[inline] - pub fn mFillOpacitySource(&self) -> nsStyleSVGOpacitySource { - unsafe { - ::std::mem::transmute(((self._bitfield_2 & (7usize as u16)) >> - 0u32) as u32) - } - } - #[inline] - pub fn set_mFillOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { - self._bitfield_2 &= !(7usize as u16); - self._bitfield_2 |= ((val as u32 as u16) << 0u32) & (7usize as u16); - } - #[inline] - pub fn mStrokeOpacitySource(&self) -> nsStyleSVGOpacitySource { - unsafe { - ::std::mem::transmute(((self._bitfield_2 & (56usize as u16)) >> - 3u32) as u32) - } - } - #[inline] - pub fn set_mStrokeOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { - self._bitfield_2 &= !(56usize as u16); - self._bitfield_2 |= ((val as u32 as u16) << 3u32) & (56usize as u16); - } - #[inline] - pub fn mStrokeDasharrayFromObject(&self) -> bool { - unsafe { - ::std::mem::transmute(((self._bitfield_2 & (64usize as u16)) >> - 6u32) as u8) - } - } - #[inline] - pub fn set_mStrokeDasharrayFromObject(&mut self, val: bool) { - self._bitfield_2 &= !(64usize as u16); - self._bitfield_2 |= ((val as u8 as u16) << 6u32) & (64usize as u16); - } - #[inline] - pub fn mStrokeDashoffsetFromObject(&self) -> bool { - unsafe { - ::std::mem::transmute(((self._bitfield_2 & (128usize as u16)) >> - 7u32) as u8) - } - } - #[inline] - pub fn set_mStrokeDashoffsetFromObject(&mut self, val: bool) { - self._bitfield_2 &= !(128usize as u16); - self._bitfield_2 |= ((val as u8 as u16) << 7u32) & (128usize as u16); - } - #[inline] - pub fn mStrokeWidthFromObject(&self) -> bool { - unsafe { - ::std::mem::transmute(((self._bitfield_2 & (256usize as u16)) >> - 8u32) as u8) - } - } - #[inline] - pub fn set_mStrokeWidthFromObject(&mut self, val: bool) { - self._bitfield_2 &= !(256usize as u16); - self._bitfield_2 |= ((val as u8 as u16) << 8u32) & (256usize as u16); - } -} diff --git a/tests/expectations/tests/what_is_going_on.rs b/tests/expectations/tests/what_is_going_on.rs deleted file mode 100644 index 6f1998d1..00000000 --- a/tests/expectations/tests/what_is_going_on.rs +++ /dev/null @@ -1,28 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct UnknownUnits { - pub _address: u8, -} -#[test] -fn bindgen_test_layout_UnknownUnits() { - assert_eq!(::std::mem::size_of::<UnknownUnits>() , 1usize); - assert_eq!(::std::mem::align_of::<UnknownUnits>() , 1usize); -} -impl Clone for UnknownUnits { - fn clone(&self) -> Self { *self } -} -pub type Float = f32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct PointTyped<units, F> { - pub x: F, - pub y: F, - pub _phantom_0: ::std::marker::PhantomData<units>, -} -pub type IntPoint = PointTyped<UnknownUnits, f32>; diff --git a/tests/expectations/tests/whitelist_basic.rs b/tests/expectations/tests/whitelist_basic.rs deleted file mode 100644 index 0104f049..00000000 --- a/tests/expectations/tests/whitelist_basic.rs +++ /dev/null @@ -1,18 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct WhitelistMe<T> { - pub foo: ::std::os::raw::c_int, - pub bar: WhitelistMe_Inner<T>, - pub _phantom_0: ::std::marker::PhantomData<T>, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct WhitelistMe_Inner<T> { - pub bar: T, -} diff --git a/tests/expectations/tests/whitelist_vars.rs b/tests/expectations/tests/whitelist_vars.rs deleted file mode 100644 index f7af24b2..00000000 --- a/tests/expectations/tests/whitelist_vars.rs +++ /dev/null @@ -1,10 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub const NONE: ::std::os::raw::c_uint = 0; -pub const FOO: ::std::os::raw::c_uint = 5; -pub const FOOB: ::std::os::raw::c_int = -2; -pub const FOOBAR: ::std::os::raw::c_int = -10; diff --git a/tests/headers/accessors.hpp b/tests/headers/accessors.hpp deleted file mode 100644 index 4c23e35d..00000000 --- a/tests/headers/accessors.hpp +++ /dev/null @@ -1,46 +0,0 @@ -struct SomeAccessors { - int mNoAccessor; - /** <div rustbindgen accessor></div> */ - int mBothAccessors; - /** <div rustbindgen accessor="unsafe"></div> */ - int mUnsafeAccessors; - /** <div rustbindgen accessor="immutable"></div> */ - int mImmutableAccessor; -}; - -/** <div rustbindgen accessor></div> */ -struct AllAccessors { - int mBothAccessors; - int mAlsoBothAccessors; -}; - -/** <div rustbindgen accessor="unsafe"></div> */ -struct AllUnsafeAccessors { - int mBothAccessors; - int mAlsoBothAccessors; -}; - -/** <div rustbindgen accessor></div> */ -struct ContradictAccessors { - int mBothAccessors; - /** <div rustbindgen accessor="false"></div> */ - int mNoAccessors; - /** <div rustbindgen accessor="unsafe"></div> */ - int mUnsafeAccessors; - /** <div rustbindgen accessor="immutable"></div> */ - int mImmutableAccessor; -}; - -/** <div rustbindgen accessor replaces="Replaced"></div> */ -struct Replacing { - int mAccessor; -}; - -struct Replaced { - int noOp; -}; - -/** <div rustbindgen accessor></div> */ -struct Wrapper { - Replaced mReplaced; -}; diff --git a/tests/headers/annotation_hide.hpp b/tests/headers/annotation_hide.hpp deleted file mode 100644 index 3c82c9a2..00000000 --- a/tests/headers/annotation_hide.hpp +++ /dev/null @@ -1,16 +0,0 @@ - -/** - * <div rustbindgen="true" hide="true"></div> - */ -struct C; - -/** - * <div rustbindgen opaque></div> - */ -struct D { - int a; -}; - -struct NotAnnotated { - int f; -}; diff --git a/tests/headers/anon_enum.hpp b/tests/headers/anon_enum.hpp deleted file mode 100644 index c7405202..00000000 --- a/tests/headers/anon_enum.hpp +++ /dev/null @@ -1,5 +0,0 @@ -struct Test { - int foo; - float bar; - enum { T_NONE }; -}; diff --git a/tests/headers/anon_enum_whitelist.h b/tests/headers/anon_enum_whitelist.h deleted file mode 100644 index 15cda6b1..00000000 --- a/tests/headers/anon_enum_whitelist.h +++ /dev/null @@ -1,6 +0,0 @@ -// bindgen-flags: --whitelist-var NODE_.* - -enum { - NODE_FLAG_FOO, - NODE_FLAG_BAR, -}; diff --git a/tests/headers/anon_union.hpp b/tests/headers/anon_union.hpp deleted file mode 100644 index 126f6a6e..00000000 --- a/tests/headers/anon_union.hpp +++ /dev/null @@ -1,20 +0,0 @@ -template<typename T> -struct TErrorResult { - enum UnionState { - HasMessage, - HasException, - }; - int mResult; - struct Message; - struct DOMExceptionInfo; - union { - Message* mMessage; - DOMExceptionInfo* mDOMExceptionInfo; - }; - - bool mMightHaveUnreported; - UnionState mUnionState; -}; - -struct ErrorResult : public TErrorResult<int> { -}; diff --git a/tests/headers/arg_keyword.hpp b/tests/headers/arg_keyword.hpp deleted file mode 100644 index 9f0af850..00000000 --- a/tests/headers/arg_keyword.hpp +++ /dev/null @@ -1 +0,0 @@ -void foo(const char* type); diff --git a/tests/headers/base-to-derived.hpp b/tests/headers/base-to-derived.hpp deleted file mode 100644 index ea31e0f2..00000000 --- a/tests/headers/base-to-derived.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -struct false_type {}; - -template<typename _From, typename _To, bool> -struct __is_base_to_derived_ref; - -template<typename _From, typename _To> -struct __is_base_to_derived_ref<_From, _To, true> -{ - typedef _To type; - - static constexpr bool value = type::value; -}; - -template<typename _From, typename _To> -struct __is_base_to_derived_ref<_From, _To, false> -: public false_type -{ }; diff --git a/tests/headers/bitfield-enum-basic.h b/tests/headers/bitfield-enum-basic.h deleted file mode 100644 index 364bebf2..00000000 --- a/tests/headers/bitfield-enum-basic.h +++ /dev/null @@ -1,27 +0,0 @@ -// bindgen-flags: --bitfield-enum "Foo|Buz|NS_.*|DUMMY_.*" -- -std=c++11 - -enum Foo { - Bar = 1 << 1, - Baz = 1 << 2, - Duplicated = 1 << 2, - Negative = -3, -}; - -enum class Buz : signed char { - Bar = 1 << 1, - Baz = 1 << 2, - Duplicated = 1 << 2, - Negative = -3, -}; - -enum { - NS_FOO = 1 << 0, - NS_BAR = 1 << 1, -}; - -class Dummy { - enum { - DUMMY_FOO = 1 << 0, - DUMMY_BAR = 1 << 1, - }; -}; diff --git a/tests/headers/blocks.h b/tests/headers/blocks.h deleted file mode 100644 index 80420e6e..00000000 --- a/tests/headers/blocks.h +++ /dev/null @@ -1,3 +0,0 @@ -// bindgen-flags: -- -fblocks - -void atexit_b(void (^)(void)); diff --git a/tests/headers/class.hpp b/tests/headers/class.hpp deleted file mode 100644 index e753f186..00000000 --- a/tests/headers/class.hpp +++ /dev/null @@ -1,29 +0,0 @@ -class C { - int a; - // More than rust limits (32) - char big_array[33]; -}; - -class WithDtor { - int b; - - ~WithDtor() {} -}; - -union Union { - float d; - int i; -}; - -class WithUnion { - Union data; -}; - -class RealAbstractionWithTonsOfMethods { - void foo(); -public: - void bar() const; - void bar(); - void bar(int foo); - static void sta(); -}; diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp deleted file mode 100644 index ab38d500..00000000 --- a/tests/headers/class_nested.hpp +++ /dev/null @@ -1,24 +0,0 @@ -class A { -public: - int member_a; - class B { - int member_b; - }; -}; - -A::B var; - -class D { - A::B member; -}; - -template<typename T> -class Templated { - T member; - - class Templated_inner { - public: - T* member_ptr; - void get() {} - }; -}; diff --git a/tests/headers/class_no_members.hpp b/tests/headers/class_no_members.hpp deleted file mode 100644 index a4483558..00000000 --- a/tests/headers/class_no_members.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -class whatever { -}; - -class whatever_child: public whatever { -}; - -class whatever_child_with_member: public whatever { -public: - int m_member; -}; - -static_assert(sizeof(whatever) == 1, "Testing!"); -static_assert(sizeof(whatever_child) == 1, "Testing!"); -static_assert(sizeof(whatever_child_with_member) == 4, "Testing!"); diff --git a/tests/headers/class_static.hpp b/tests/headers/class_static.hpp deleted file mode 100644 index 21ab2321..00000000 --- a/tests/headers/class_static.hpp +++ /dev/null @@ -1,7 +0,0 @@ -class MyClass { -public: - static const int* example; - static const int* example_check_no_collision; -}; - -static const int* example_check_no_collision; diff --git a/tests/headers/class_static_const.hpp b/tests/headers/class_static_const.hpp deleted file mode 100644 index 150afe8b..00000000 --- a/tests/headers/class_static_const.hpp +++ /dev/null @@ -1,8 +0,0 @@ -using int32_t = int; -typedef unsigned int uint32_t; - -class A { - static const int a = 0; - static const int32_t b = 077; - static const uint32_t c = 0xff; -}; diff --git a/tests/headers/class_use_as.hpp b/tests/headers/class_use_as.hpp deleted file mode 100644 index a4e36ded..00000000 --- a/tests/headers/class_use_as.hpp +++ /dev/null @@ -1,15 +0,0 @@ - -/** - * <div rustbindgen="true" replaces="whatever"></div> - */ -struct whatever_replacement { - int replacement; -}; - -struct whatever { - int b; -}; - -struct container { - whatever c; -}; diff --git a/tests/headers/class_with_dtor.hpp b/tests/headers/class_with_dtor.hpp deleted file mode 100644 index b9bf74e1..00000000 --- a/tests/headers/class_with_dtor.hpp +++ /dev/null @@ -1,13 +0,0 @@ - - -template <typename T> -class HandleWithDtor { - T* ptr; - ~HandleWithDtor() {} -}; - -typedef HandleWithDtor<int> HandleValue; - -class WithoutDtor { - HandleValue shouldBeWithDtor; -}; diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp deleted file mode 100644 index ec729fe6..00000000 --- a/tests/headers/class_with_inner_struct.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -class A { - unsigned c; - struct Segment { int begin, end; }; - union { - int f; - } named_union; - union { - int d; - }; -}; - -class B { - unsigned d; - struct Segment { int begin, end; }; -}; - - -enum class StepSyntax { - Keyword, // step-start and step-end - FunctionalWithoutKeyword, // steps(...) - FunctionalWithStartKeyword, // steps(..., start) - FunctionalWithEndKeyword, // steps(..., end) -}; - -class C { - unsigned d; - union { - struct { - float mX1; - float mY1; - float mX2; - float mY2; - } mFunc; - struct { - StepSyntax mStepSyntax; - unsigned int mSteps; - }; - }; - // To ensure it doesn't collide - struct Segment { int begin, end; }; -}; diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp deleted file mode 100644 index 8707cffe..00000000 --- a/tests/headers/class_with_typedef.hpp +++ /dev/null @@ -1,22 +0,0 @@ -typedef int AnotherInt; - -class C { -public: - typedef int MyInt; - typedef const char* Lookup; - MyInt c; - MyInt* ptr; - MyInt arr[10]; - AnotherInt d; - AnotherInt* other_ptr; - - void method(MyInt c); - void methodRef(MyInt& c); - void complexMethodRef(Lookup& c); - void anotherMethod(AnotherInt c); -}; - -class D: public C { -public: - MyInt* ptr; -}; diff --git a/tests/headers/complex.h b/tests/headers/complex.h deleted file mode 100644 index 04877a4e..00000000 --- a/tests/headers/complex.h +++ /dev/null @@ -1,16 +0,0 @@ - -#define COMPLEX_TEST(ty_, name_) \ - struct Test##name_ { \ - ty_ _Complex mMember; \ - \ - }; \ - struct Test##name_##Ptr { \ - ty_ _Complex* mMember; \ - }; - -COMPLEX_TEST(double, Double) -COMPLEX_TEST(float, Float) - -// FIXME: 128-byte-aligned in some machines -// which we can't support right now in Rust. -// COMPLEX_TEST(long double, LongDouble) diff --git a/tests/headers/complex_global.h b/tests/headers/complex_global.h deleted file mode 100644 index d9f9fb01..00000000 --- a/tests/headers/complex_global.h +++ /dev/null @@ -1,3 +0,0 @@ -float _Complex globalValueFloat; -double _Complex globalValueDouble; -long double _Complex globalValueLongDouble; diff --git a/tests/headers/const_enum_unnamed.hpp b/tests/headers/const_enum_unnamed.hpp deleted file mode 100644 index eb139434..00000000 --- a/tests/headers/const_enum_unnamed.hpp +++ /dev/null @@ -1,9 +0,0 @@ - -enum { - FOO_BAR, - FOO_BAZ, -}; - -class Foo { - enum { FOO_BAR = 10 }; -}; diff --git a/tests/headers/const_ptr.hpp b/tests/headers/const_ptr.hpp deleted file mode 100644 index 66744f8b..00000000 --- a/tests/headers/const_ptr.hpp +++ /dev/null @@ -1,3 +0,0 @@ -extern "C" { - void foo(const void* bar); -} diff --git a/tests/headers/const_resolved_ty.h b/tests/headers/const_resolved_ty.h deleted file mode 100644 index 2521e61c..00000000 --- a/tests/headers/const_resolved_ty.h +++ /dev/null @@ -1,3 +0,0 @@ -typedef unsigned char uint8_t; - -void foo(const uint8_t* foo); diff --git a/tests/headers/const_tparam.hpp b/tests/headers/const_tparam.hpp deleted file mode 100644 index 05f26e4a..00000000 --- a/tests/headers/const_tparam.hpp +++ /dev/null @@ -1,5 +0,0 @@ -template<typename T> -class C { - const T* const foo; - const T* bar; -}; diff --git a/tests/headers/convert-floats.h b/tests/headers/convert-floats.h deleted file mode 100644 index 08d9fe0b..00000000 --- a/tests/headers/convert-floats.h +++ /dev/null @@ -1,9 +0,0 @@ -// bindgen-flags: --no-convert-floats - -struct foo { - float bar, baz; - double bazz; - long double* bazzz; - float _Complex complexFloat; - double _Complex complexDouble; -}; diff --git a/tests/headers/crtp.hpp b/tests/headers/crtp.hpp deleted file mode 100644 index a5477c54..00000000 --- a/tests/headers/crtp.hpp +++ /dev/null @@ -1,12 +0,0 @@ -template<class T> -class Base {}; - -class Derived : public Base<Derived> {}; - -template<class T> -class BaseWithDestructor { - ~BaseWithDestructor(); -}; - -class DerivedFromBaseWithDestructor : - public BaseWithDestructor<DerivedFromBaseWithDestructor> {}; diff --git a/tests/headers/decl_extern_int_twice.h b/tests/headers/decl_extern_int_twice.h deleted file mode 100644 index 06f80e87..00000000 --- a/tests/headers/decl_extern_int_twice.h +++ /dev/null @@ -1,2 +0,0 @@ -extern int foo; -extern int foo; diff --git a/tests/headers/decl_ptr_to_array.h b/tests/headers/decl_ptr_to_array.h deleted file mode 100644 index 3222cbd4..00000000 --- a/tests/headers/decl_ptr_to_array.h +++ /dev/null @@ -1 +0,0 @@ -int (*foo)[1]; diff --git a/tests/headers/duplicated_constants_in_ns.hpp b/tests/headers/duplicated_constants_in_ns.hpp deleted file mode 100644 index bb343641..00000000 --- a/tests/headers/duplicated_constants_in_ns.hpp +++ /dev/null @@ -1,7 +0,0 @@ -// bindgen-flags: --enable-cxx-namespaces -namespace foo { - const int FOO = 4; -} -namespace bar { - const int FOO = 5; -} diff --git a/tests/headers/elaborated.hpp b/tests/headers/elaborated.hpp deleted file mode 100644 index 4bfbff23..00000000 --- a/tests/headers/elaborated.hpp +++ /dev/null @@ -1,5 +0,0 @@ -namespace whatever { - typedef int whatever_t; -} - -void something(const whatever::whatever_t *wat); diff --git a/tests/headers/empty_template_param_name.hpp b/tests/headers/empty_template_param_name.hpp deleted file mode 100644 index b3360bc9..00000000 --- a/tests/headers/empty_template_param_name.hpp +++ /dev/null @@ -1,4 +0,0 @@ -template<typename...> using __void_t = void; - -template<typename _Iterator, typename = __void_t<>> - struct __iterator_traits { }; diff --git a/tests/headers/enum.h b/tests/headers/enum.h deleted file mode 100644 index f2d301e7..00000000 --- a/tests/headers/enum.h +++ /dev/null @@ -1,9 +0,0 @@ -enum Foo { - Bar = 0, - Qux -}; - -enum Neg { - MinusOne = -1, - One = 1, -}; diff --git a/tests/headers/enum_alias.hpp b/tests/headers/enum_alias.hpp deleted file mode 100644 index 658f8fde..00000000 --- a/tests/headers/enum_alias.hpp +++ /dev/null @@ -1,7 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -typedef unsigned char uint8_t; - -enum Bar : uint8_t { - VAL -}; diff --git a/tests/headers/enum_and_vtable_mangling.hpp b/tests/headers/enum_and_vtable_mangling.hpp deleted file mode 100644 index 3abd6a29..00000000 --- a/tests/headers/enum_and_vtable_mangling.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -enum { - match, - whatever_else, -}; - -class C { - int i; -public: - virtual void match() { }; -}; diff --git a/tests/headers/enum_dupe.h b/tests/headers/enum_dupe.h deleted file mode 100644 index 6d3591d5..00000000 --- a/tests/headers/enum_dupe.h +++ /dev/null @@ -1,4 +0,0 @@ -enum Foo { - Bar = 1, - Dupe = 1 -}; diff --git a/tests/headers/enum_explicit_type.hpp b/tests/headers/enum_explicit_type.hpp deleted file mode 100644 index 78eadd40..00000000 --- a/tests/headers/enum_explicit_type.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -enum Foo: unsigned char { - Bar = 0, - Qux -}; - -enum Neg: char { - MinusOne = -1, - One = 1, -}; - -enum Bigger: unsigned short { - Much = 255, - Larger -}; - -enum MuchLong: long { - MuchLow = -4294967296, -}; - -enum MuchLongLong: long long { - I64_MIN = 1ll << 63, -}; - -enum MuchULongLong: unsigned long long { - MuchHigh = 4294967296, -}; diff --git a/tests/headers/enum_negative.h b/tests/headers/enum_negative.h deleted file mode 100644 index 6cbdfe04..00000000 --- a/tests/headers/enum_negative.h +++ /dev/null @@ -1,4 +0,0 @@ -enum Foo { - Bar = -2, - Qux = 1, -}; diff --git a/tests/headers/enum_packed.h b/tests/headers/enum_packed.h deleted file mode 100644 index 8654d110..00000000 --- a/tests/headers/enum_packed.h +++ /dev/null @@ -1,14 +0,0 @@ -enum __attribute__((packed)) Foo { - Bar = 0, - Qux -}; - -enum __attribute__((packed)) Neg { - MinusOne = -1, - One = 1, -}; - -enum __attribute__((packed)) Bigger { - Much = 255, - Larger -}; diff --git a/tests/headers/extern.hpp b/tests/headers/extern.hpp deleted file mode 100644 index 0779e038..00000000 --- a/tests/headers/extern.hpp +++ /dev/null @@ -1,3 +0,0 @@ -extern "C" { -#include "func_proto.h" -} diff --git a/tests/headers/float128.hpp b/tests/headers/float128.hpp deleted file mode 100644 index f554e88e..00000000 --- a/tests/headers/float128.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// FIXME: libclang < 3.9 does not expose `__float128` in its interface, so this -// test will fail. Once we remove support for `--features llvm_stable` and -// require libclang >= 3.9, we can reenable this test. -// -// static __float128 global = 1.0; - -// FIXME: We have no way to get 128 bit aligned structs in Rust at the moment, -// and therefore the generated layout tests for this struct will fail. When we -// can enforce 128 bit alignment, we can re-enable this test. -// -// struct A { -// __float128 f; -// }; diff --git a/tests/headers/forward-inherit-struct-with-fields.hpp b/tests/headers/forward-inherit-struct-with-fields.hpp deleted file mode 100644 index 437fff5d..00000000 --- a/tests/headers/forward-inherit-struct-with-fields.hpp +++ /dev/null @@ -1,8 +0,0 @@ -template <typename> class Rooted; -namespace js { - template <typename T> class RootedBase { - T* foo; - Rooted<T>* next; - }; -} -template <typename T> class Rooted : js::RootedBase<T> {}; diff --git a/tests/headers/forward-inherit-struct.hpp b/tests/headers/forward-inherit-struct.hpp deleted file mode 100644 index ac7aef5e..00000000 --- a/tests/headers/forward-inherit-struct.hpp +++ /dev/null @@ -1,5 +0,0 @@ -template <typename> class Rooted; -namespace js { - template <typename T> class RootedBase {}; -} -template <typename T> class Rooted : js::RootedBase<T> {}; diff --git a/tests/headers/forward_declared_struct.h b/tests/headers/forward_declared_struct.h deleted file mode 100644 index 2a69450c..00000000 --- a/tests/headers/forward_declared_struct.h +++ /dev/null @@ -1,11 +0,0 @@ -struct a; - -struct a { - int b; -}; - -struct c { - int d; -}; - -struct c;
\ No newline at end of file diff --git a/tests/headers/func_proto.h b/tests/headers/func_proto.h deleted file mode 100644 index 51139ca9..00000000 --- a/tests/headers/func_proto.h +++ /dev/null @@ -1 +0,0 @@ -typedef int foo(int bar); diff --git a/tests/headers/func_ptr.h b/tests/headers/func_ptr.h deleted file mode 100644 index a4662f3d..00000000 --- a/tests/headers/func_ptr.h +++ /dev/null @@ -1 +0,0 @@ -int (*foo) (int x, int y); diff --git a/tests/headers/func_ptr_in_struct.h b/tests/headers/func_ptr_in_struct.h deleted file mode 100644 index 988db5b3..00000000 --- a/tests/headers/func_ptr_in_struct.h +++ /dev/null @@ -1,6 +0,0 @@ - -enum baz; - -struct Foo { - enum baz (*bar) (int x, int y); -}; diff --git a/tests/headers/func_with_array_arg.h b/tests/headers/func_with_array_arg.h deleted file mode 100644 index 1b81702b..00000000 --- a/tests/headers/func_with_array_arg.h +++ /dev/null @@ -1 +0,0 @@ -void f(int x[2]); diff --git a/tests/headers/func_with_func_ptr_arg.h b/tests/headers/func_with_func_ptr_arg.h deleted file mode 100644 index 629c84ab..00000000 --- a/tests/headers/func_with_func_ptr_arg.h +++ /dev/null @@ -1 +0,0 @@ -void foo(void (*bar)()); diff --git a/tests/headers/in_class_typedef.hpp b/tests/headers/in_class_typedef.hpp deleted file mode 100644 index dda7472d..00000000 --- a/tests/headers/in_class_typedef.hpp +++ /dev/null @@ -1,10 +0,0 @@ - -template<typename T> -class Foo { - typedef T elem_type; - typedef T* ptr_type; - - typedef struct Bar { - int x, y; - } Bar; -}; diff --git a/tests/headers/inherit-namespaced.hpp b/tests/headers/inherit-namespaced.hpp deleted file mode 100644 index 61eafd5a..00000000 --- a/tests/headers/inherit-namespaced.hpp +++ /dev/null @@ -1,4 +0,0 @@ -namespace js { - template <typename T> class RootedBase {}; -} -template <typename T> class Rooted : js::RootedBase<T> {}; diff --git a/tests/headers/inherit_named.hpp b/tests/headers/inherit_named.hpp deleted file mode 100644 index 9881d1b6..00000000 --- a/tests/headers/inherit_named.hpp +++ /dev/null @@ -1,5 +0,0 @@ -template<typename T> -class Wohoo {}; - -template<typename T> -class Weeee : public T {}; diff --git a/tests/headers/inherit_typedef.hpp b/tests/headers/inherit_typedef.hpp deleted file mode 100644 index 8d699e82..00000000 --- a/tests/headers/inherit_typedef.hpp +++ /dev/null @@ -1,5 +0,0 @@ -struct Foo {}; - -typedef Foo TypedefedFoo; - -struct Bar: public TypedefedFoo {}; diff --git a/tests/headers/inner_const.hpp b/tests/headers/inner_const.hpp deleted file mode 100644 index 25c2e603..00000000 --- a/tests/headers/inner_const.hpp +++ /dev/null @@ -1,6 +0,0 @@ - -class Foo { - static int BOO; - static Foo whatever; - int bar; -}; diff --git a/tests/headers/inner_template_self.hpp b/tests/headers/inner_template_self.hpp deleted file mode 100644 index 1ae5af06..00000000 --- a/tests/headers/inner_template_self.hpp +++ /dev/null @@ -1,10 +0,0 @@ - -template <typename T> -class LinkedList { - LinkedList<T>* next; - LinkedList* prev; -}; - -class InstantiateIt { - LinkedList<int> m_list; -}; diff --git a/tests/headers/int128_t.h b/tests/headers/int128_t.h deleted file mode 100644 index eece252c..00000000 --- a/tests/headers/int128_t.h +++ /dev/null @@ -1,7 +0,0 @@ -/** - * FIXME: Uncomment this once we can generate the proper alignment for the type, - * i.e., when we use u128/i128. -struct Foo { - __int128 foo; -}; - */ diff --git a/tests/headers/jsval_layout_opaque.hpp b/tests/headers/jsval_layout_opaque.hpp deleted file mode 100644 index 85c5be63..00000000 --- a/tests/headers/jsval_layout_opaque.hpp +++ /dev/null @@ -1,424 +0,0 @@ -// bindgen-flags: --no-unstable-rust -- -std=c++11 - -/** - * These typedefs are hacky, but keep our tests consistent across 64-bit - * platforms, otherwise the id's change and our CI is unhappy. - */ -typedef unsigned char uint8_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -typedef unsigned long long size_t; -typedef unsigned long long uintptr_t; - - -#define JS_PUNBOX64 -#define IS_LITTLE_ENDIAN - -/* - * Try to get jsvals 64-bit aligned. We could almost assert that all values are - * aligned, but MSVC and GCC occasionally break alignment. - */ -#if defined(__GNUC__) || defined(__xlc__) || defined(__xlC__) -# define JSVAL_ALIGNMENT __attribute__((aligned (8))) -#elif defined(_MSC_VER) - /* - * Structs can be aligned with MSVC, but not if they are used as parameters, - * so we just don't try to align. - */ -# define JSVAL_ALIGNMENT -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# define JSVAL_ALIGNMENT -#elif defined(__HP_cc) || defined(__HP_aCC) -# define JSVAL_ALIGNMENT -#endif - -#if defined(JS_PUNBOX64) -# define JSVAL_TAG_SHIFT 47 -#endif - -/* - * We try to use enums so that printing a jsval_layout in the debugger shows - * nice symbolic type tags, however we can only do this when we can force the - * underlying type of the enum to be the desired size. - */ -#if !defined(__SUNPRO_CC) && !defined(__xlC__) - -#if defined(_MSC_VER) -# define JS_ENUM_HEADER(id, type) enum id : type -# define JS_ENUM_FOOTER(id) -#else -# define JS_ENUM_HEADER(id, type) enum id -# define JS_ENUM_FOOTER(id) __attribute__((packed)) -#endif - -/* Remember to propagate changes to the C defines below. */ -JS_ENUM_HEADER(JSValueType, uint8_t) -{ - JSVAL_TYPE_DOUBLE = 0x00, - JSVAL_TYPE_INT32 = 0x01, - JSVAL_TYPE_UNDEFINED = 0x02, - JSVAL_TYPE_BOOLEAN = 0x03, - JSVAL_TYPE_MAGIC = 0x04, - JSVAL_TYPE_STRING = 0x05, - JSVAL_TYPE_SYMBOL = 0x06, - JSVAL_TYPE_NULL = 0x07, - JSVAL_TYPE_OBJECT = 0x08, - - /* These never appear in a jsval; they are only provided as an out-of-band value. */ - JSVAL_TYPE_UNKNOWN = 0x20, - JSVAL_TYPE_MISSING = 0x21 -} JS_ENUM_FOOTER(JSValueType); - -static_assert(sizeof(JSValueType) == 1, - "compiler typed enum support is apparently buggy"); - -#if defined(JS_NUNBOX32) - -/* Remember to propagate changes to the C defines below. */ -JS_ENUM_HEADER(JSValueTag, uint32_t) -{ - JSVAL_TAG_CLEAR = 0xFFFFFF80, - JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32, - JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED, - JSVAL_TAG_STRING = JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING, - JSVAL_TAG_SYMBOL = JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL, - JSVAL_TAG_BOOLEAN = JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN, - JSVAL_TAG_MAGIC = JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC, - JSVAL_TAG_NULL = JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL, - JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT -} JS_ENUM_FOOTER(JSValueTag); - -static_assert(sizeof(JSValueTag) == sizeof(uint32_t), - "compiler typed enum support is apparently buggy"); - -#elif defined(JS_PUNBOX64) - -/* Remember to propagate changes to the C defines below. */ -JS_ENUM_HEADER(JSValueTag, uint32_t) -{ - JSVAL_TAG_MAX_DOUBLE = 0x1FFF0, - JSVAL_TAG_INT32 = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32, - JSVAL_TAG_UNDEFINED = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED, - JSVAL_TAG_STRING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING, - JSVAL_TAG_SYMBOL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL, - JSVAL_TAG_BOOLEAN = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN, - JSVAL_TAG_MAGIC = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC, - JSVAL_TAG_NULL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL, - JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT -} JS_ENUM_FOOTER(JSValueTag); - -static_assert(sizeof(JSValueTag) == sizeof(uint32_t), - "compiler typed enum support is apparently buggy"); - -JS_ENUM_HEADER(JSValueShiftedTag, uint64_t) -{ - JSVAL_SHIFTED_TAG_MAX_DOUBLE = ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF), - JSVAL_SHIFTED_TAG_INT32 = (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_UNDEFINED = (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_STRING = (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_SYMBOL = (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_BOOLEAN = (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_MAGIC = (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_NULL = (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT), - JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT) -} JS_ENUM_FOOTER(JSValueShiftedTag); - -static_assert(sizeof(JSValueShiftedTag) == sizeof(uint64_t), - "compiler typed enum support is apparently buggy"); - -#endif - -/* - * All our supported compilers implement C++11 |enum Foo : T| syntax, so don't - * expose these macros. (This macro exists *only* because gcc bug 51242 - * <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242> makes bit-fields of - * typed enums trigger a warning that can't be turned off. Don't expose it - * beyond this file!) - */ -#undef JS_ENUM_HEADER -#undef JS_ENUM_FOOTER - -#else /* !defined(__SUNPRO_CC) && !defined(__xlC__) */ - -typedef uint8_t JSValueType; -#define JSVAL_TYPE_DOUBLE ((uint8_t)0x00) -#define JSVAL_TYPE_INT32 ((uint8_t)0x01) -#define JSVAL_TYPE_UNDEFINED ((uint8_t)0x02) -#define JSVAL_TYPE_BOOLEAN ((uint8_t)0x03) -#define JSVAL_TYPE_MAGIC ((uint8_t)0x04) -#define JSVAL_TYPE_STRING ((uint8_t)0x05) -#define JSVAL_TYPE_SYMBOL ((uint8_t)0x06) -#define JSVAL_TYPE_NULL ((uint8_t)0x07) -#define JSVAL_TYPE_OBJECT ((uint8_t)0x08) -#define JSVAL_TYPE_UNKNOWN ((uint8_t)0x20) - -#if defined(JS_NUNBOX32) - -typedef uint32_t JSValueTag; -#define JSVAL_TAG_CLEAR ((uint32_t)(0xFFFFFF80)) -#define JSVAL_TAG_INT32 ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32)) -#define JSVAL_TAG_UNDEFINED ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED)) -#define JSVAL_TAG_STRING ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING)) -#define JSVAL_TAG_SYMBOL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL)) -#define JSVAL_TAG_BOOLEAN ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN)) -#define JSVAL_TAG_MAGIC ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC)) -#define JSVAL_TAG_NULL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL)) -#define JSVAL_TAG_OBJECT ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT)) - -#elif defined(JS_PUNBOX64) - -typedef uint32_t JSValueTag; -#define JSVAL_TAG_MAX_DOUBLE ((uint32_t)(0x1FFF0)) -#define JSVAL_TAG_INT32 (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32) -#define JSVAL_TAG_UNDEFINED (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED) -#define JSVAL_TAG_STRING (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING) -#define JSVAL_TAG_SYMBOL (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL) -#define JSVAL_TAG_BOOLEAN (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN) -#define JSVAL_TAG_MAGIC (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC) -#define JSVAL_TAG_NULL (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL) -#define JSVAL_TAG_OBJECT (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT) - -typedef uint64_t JSValueShiftedTag; -#define JSVAL_SHIFTED_TAG_MAX_DOUBLE ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF) -#define JSVAL_SHIFTED_TAG_INT32 (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_UNDEFINED (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_STRING (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_SYMBOL (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_BOOLEAN (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_MAGIC (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_NULL (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT) -#define JSVAL_SHIFTED_TAG_OBJECT (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT) - -#endif /* JS_PUNBOX64 */ -#endif /* !defined(__SUNPRO_CC) && !defined(__xlC__) */ - -#if defined(JS_NUNBOX32) - -#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | (type))) - -#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL -#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT -#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32 -#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING - -#elif defined(JS_PUNBOX64) - -#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL -#define JSVAL_TAG_MASK 0xFFFF800000000000LL -#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | (type))) -#define JSVAL_TYPE_TO_SHIFTED_TAG(type) (((uint64_t)JSVAL_TYPE_TO_TAG(type)) << JSVAL_TAG_SHIFT) - -#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL -#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT -#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32 -#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING - -#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET JSVAL_SHIFTED_TAG_NULL -#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET JSVAL_SHIFTED_TAG_OBJECT -#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_UNDEFINED -#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_STRING - -#endif /* JS_PUNBOX64 */ - -typedef enum JSWhyMagic -{ - /** a hole in a native object's elements */ - JS_ELEMENTS_HOLE, - - /** there is not a pending iterator value */ - JS_NO_ITER_VALUE, - - /** exception value thrown when closing a generator */ - JS_GENERATOR_CLOSING, - - /** compiler sentinel value */ - JS_NO_CONSTANT, - - /** used in debug builds to catch tracing errors */ - JS_THIS_POISON, - - /** used in debug builds to catch tracing errors */ - JS_ARG_POISON, - - /** an empty subnode in the AST serializer */ - JS_SERIALIZE_NO_NODE, - - /** lazy arguments value on the stack */ - JS_LAZY_ARGUMENTS, - - /** optimized-away 'arguments' value */ - JS_OPTIMIZED_ARGUMENTS, - - /** magic value passed to natives to indicate construction */ - JS_IS_CONSTRUCTING, - - /** arguments.callee has been overwritten */ - JS_OVERWRITTEN_CALLEE, - - /** value of static block object slot */ - JS_BLOCK_NEEDS_CLONE, - - /** see class js::HashableValue */ - JS_HASH_KEY_EMPTY, - - /** error while running Ion code */ - JS_ION_ERROR, - - /** missing recover instruction result */ - JS_ION_BAILOUT, - - /** optimized out slot */ - JS_OPTIMIZED_OUT, - - /** uninitialized lexical bindings that produce ReferenceError on touch. */ - JS_UNINITIALIZED_LEXICAL, - - /** for local use */ - JS_GENERIC_MAGIC, - - JS_WHY_MAGIC_COUNT -} JSWhyMagic; - -#if defined(IS_LITTLE_ENDIAN) -# if defined(JS_NUNBOX32) -typedef union jsval_layout -{ - uint64_t asBits; - struct { - union { - int32_t i32; - uint32_t u32; - uint32_t boo; // Don't use |bool| -- it must be four bytes. - JSString* str; - JS::Symbol* sym; - JSObject* obj; - js::gc::Cell* cell; - void* ptr; - JSWhyMagic why; - size_t word; - uintptr_t uintptr; - } payload; - JSValueTag tag; - } s; - double asDouble; - void* asPtr; -} JSVAL_ALIGNMENT jsval_layout; -# elif defined(JS_PUNBOX64) -typedef union jsval_layout -{ - uint64_t asBits; -#if !defined(_WIN64) - /* MSVC does not pack these correctly :-( */ - struct { - uint64_t payload47 : 47; - JSValueTag tag : 17; - } debugView; -#endif - struct { - union { - int32_t i32; - uint32_t u32; - JSWhyMagic why; - } payload; - } s; - double asDouble; - void* asPtr; - size_t asWord; - uintptr_t asUIntPtr; -} JSVAL_ALIGNMENT jsval_layout; -# endif /* JS_PUNBOX64 */ -#else /* defined(IS_LITTLE_ENDIAN) */ -# if defined(JS_NUNBOX32) -typedef union jsval_layout -{ - uint64_t asBits; - struct { - JSValueTag tag; - union { - int32_t i32; - uint32_t u32; - uint32_t boo; // Don't use |bool| -- it must be four bytes. - JSString* str; - JS::Symbol* sym; - JSObject* obj; - js::gc::Cell* cell; - void* ptr; - JSWhyMagic why; - size_t word; - uintptr_t uintptr; - } payload; - } s; - double asDouble; - void* asPtr; -} JSVAL_ALIGNMENT jsval_layout; -# elif defined(JS_PUNBOX64) -typedef union jsval_layout -{ - uint64_t asBits; - struct { - JSValueTag tag : 17; - uint64_t payload47 : 47; - } debugView; - struct { - uint32_t padding; - union { - int32_t i32; - uint32_t u32; - JSWhyMagic why; - } payload; - } s; - double asDouble; - void* asPtr; - size_t asWord; - uintptr_t asUIntPtr; -} JSVAL_ALIGNMENT jsval_layout; -# endif /* JS_PUNBOX64 */ -#endif /* defined(IS_LITTLE_ENDIAN) */ - -/* - * For codesize purposes on some platforms, it's important that the - * compiler know that JS::Values constructed from constant values can be - * folded to constant bit patterns at compile time, rather than - * constructed at runtime. Doing this requires a fair amount of C++11 - * features, which are not supported on all of our compilers. Set up - * some defines and helper macros in an attempt to confine the ugliness - * here, rather than scattering it all about the file. The important - * features are: - * - * - constexpr; - * - defaulted functions; - * - C99-style designated initializers. - */ -#if defined(__clang__) -# if __has_feature(cxx_constexpr) && __has_feature(cxx_defaulted_functions) -# define JS_VALUE_IS_CONSTEXPR -# endif -#elif defined(__GNUC__) -/* - * We need 4.5 for defaulted functions, 4.6 for constexpr, 4.7 because 4.6 - * doesn't understand |(X) { .field = ... }| syntax, and 4.7.3 because - * versions prior to that have bugs in the C++ front-end that cause crashes. - */ -# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 3) -# define JS_VALUE_IS_CONSTEXPR -# endif -#endif - -#if defined(JS_VALUE_IS_CONSTEXPR) -# define JS_RETURN_LAYOUT_FROM_BITS(BITS) \ - return (jsval_layout) { .asBits = (BITS) } -# define JS_VALUE_CONSTEXPR MOZ_CONSTEXPR -# define JS_VALUE_CONSTEXPR_VAR MOZ_CONSTEXPR_VAR -#else -# define JS_RETURN_LAYOUT_FROM_BITS(BITS) \ - jsval_layout l; \ - l.asBits = (BITS); \ - return l; -# define JS_VALUE_CONSTEXPR -# define JS_VALUE_CONSTEXPR_VAR const -#endif - -struct Value { - jsval_layout data; -}; diff --git a/tests/headers/keywords.h b/tests/headers/keywords.h deleted file mode 100644 index 8699ce5f..00000000 --- a/tests/headers/keywords.h +++ /dev/null @@ -1,49 +0,0 @@ -int u8; -int u16; -int u32; -int u64; -int i8; -int i16; -int i32; -int i64; -int f32; -int f64; -int usize; -int isize; -int as; -int box; -int crate; -int false; -int fn; -int impl; -int in; -int let; -int loop; -int match; -int mod; -int move; -int mut; -int pub; -int ref; -int self; -int Self; -int super; -int trait; -int true; -int type; -int unsafe; -int use; -int where; -int abstract; -int alignof; -int become; -int final; -int macro; -int offsetof; -int override; -int priv; -int proc; -int pure; -int unsized; -int virtual; -int yield; diff --git a/tests/headers/macro-expr-basic.h b/tests/headers/macro-expr-basic.h deleted file mode 100644 index d2de7fdf..00000000 --- a/tests/headers/macro-expr-basic.h +++ /dev/null @@ -1,14 +0,0 @@ -#define FOO 1 -#define BAR 4 -#define BAZ (FOO + BAR) - -#define MIN (1 << 63) - -#define BARR (1 << 0) -#define BAZZ ((1 << 1) + BAZ) -#define I_RAN_OUT_OF_DUMB_NAMES (BARR | BAZZ) - -/* I haz a comment */ -#define HAZ_A_COMMENT BARR - -#define HAZ_A_COMMENT_INSIDE (/* comment for real */ BARR + FOO) diff --git a/tests/headers/macro-redef.h b/tests/headers/macro-redef.h deleted file mode 100644 index 0180d2ab..00000000 --- a/tests/headers/macro-redef.h +++ /dev/null @@ -1,5 +0,0 @@ -#define FOO 4 -#define BAR (1 + FOO) -#undef FOO -#define FOO 5 -#define BAZ (1 + FOO) diff --git a/tests/headers/multiple-inherit-empty-correct-layout.hpp b/tests/headers/multiple-inherit-empty-correct-layout.hpp deleted file mode 100644 index 1e2b133a..00000000 --- a/tests/headers/multiple-inherit-empty-correct-layout.hpp +++ /dev/null @@ -1,3 +0,0 @@ -struct Foo {}; -struct Bar {}; -struct Baz : public Foo, public Bar {}; diff --git a/tests/headers/mutable.hpp b/tests/headers/mutable.hpp deleted file mode 100644 index b61a1031..00000000 --- a/tests/headers/mutable.hpp +++ /dev/null @@ -1,14 +0,0 @@ -class C { - mutable int m_member; - int m_other; -}; - -class NonCopiable { - mutable int m_member; - - ~NonCopiable() {}; -}; - -class NonCopiableWithNonCopiableMutableMember { - mutable NonCopiable m_member; -}; diff --git a/tests/headers/namespace.hpp b/tests/headers/namespace.hpp deleted file mode 100644 index 65788539..00000000 --- a/tests/headers/namespace.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// bindgen-flags: --enable-cxx-namespaces - -void top_level(); - -namespace whatever { - typedef int whatever_int_t; - - void in_whatever(); -} - -namespace { - namespace empty {} - - void foo(); - struct A { - whatever::whatever_int_t b; - public: - int lets_hope_this_works(); - }; -} - -template<typename T> -class C: public A { - T m_c; - T* m_c_ptr; - T m_c_arr[10]; -}; - - -template<> -class C<int>; - - -namespace w { - typedef unsigned int whatever_int_t; - - template<typename T> - class D { - C<T> m_c; - }; - - whatever_int_t heh(); // this should return w::whatever_int_t, and not whatever::whatever_int_t - - C<int> foo(); - - C<float> barr(); // <- This is the problematic one -} diff --git a/tests/headers/nested.hpp b/tests/headers/nested.hpp deleted file mode 100644 index 299e1768..00000000 --- a/tests/headers/nested.hpp +++ /dev/null @@ -1,15 +0,0 @@ - -class Calc { - int w; -}; - -class Test { -public: - struct Size; - friend struct Size; - struct Size { - struct Dimension : public Calc { - }; - Dimension mWidth, mHeight; - }; -}; diff --git a/tests/headers/nested_vtable.hpp b/tests/headers/nested_vtable.hpp deleted file mode 100644 index 87d6ce1f..00000000 --- a/tests/headers/nested_vtable.hpp +++ /dev/null @@ -1,8 +0,0 @@ -class nsISupports { -public: - virtual nsISupports* QueryInterface(); -}; - -class nsIRunnable : public nsISupports {}; - -class Runnable : public nsIRunnable {}; diff --git a/tests/headers/no-std.h b/tests/headers/no-std.h deleted file mode 100644 index 7bee9657..00000000 --- a/tests/headers/no-std.h +++ /dev/null @@ -1,5 +0,0 @@ -// bindgen-flags: --ctypes-prefix "libc" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub type c_int = i32; pub enum c_void {} }" -struct foo { - int a, b; - void* bar; -}; diff --git a/tests/headers/no_copy.hpp b/tests/headers/no_copy.hpp deleted file mode 100644 index 349e428e..00000000 --- a/tests/headers/no_copy.hpp +++ /dev/null @@ -1,6 +0,0 @@ - -/** <div rustbindgen nocopy></div> */ -template<typename T> -class CopiableButWait { - int whatever; -}; diff --git a/tests/headers/nsStyleAutoArray.hpp b/tests/headers/nsStyleAutoArray.hpp deleted file mode 100644 index 950152c0..00000000 --- a/tests/headers/nsStyleAutoArray.hpp +++ /dev/null @@ -1,57 +0,0 @@ - -template<typename T> -class nsTArray { - T* mBuff; -}; - -template<typename T> -class nsStyleAutoArray -{ -public: - // This constructor places a single element in mFirstElement. - enum WithSingleInitialElement { WITH_SINGLE_INITIAL_ELEMENT }; - explicit nsStyleAutoArray(WithSingleInitialElement) {} - nsStyleAutoArray(const nsStyleAutoArray& aOther) { *this = aOther; } - nsStyleAutoArray& operator=(const nsStyleAutoArray& aOther) { - mFirstElement = aOther.mFirstElement; - mOtherElements = aOther.mOtherElements; - return *this; - } - - bool operator==(const nsStyleAutoArray& aOther) const { - return Length() == aOther.Length() && - mFirstElement == aOther.mFirstElement && - mOtherElements == aOther.mOtherElements; - } - bool operator!=(const nsStyleAutoArray& aOther) const { - return !(*this == aOther); - } - - unsigned long Length() const { - return mOtherElements.Length() + 1; - } - const T& operator[](unsigned long aIndex) const { - return aIndex == 0 ? mFirstElement : mOtherElements[aIndex - 1]; - } - T& operator[](unsigned long aIndex) { - return aIndex == 0 ? mFirstElement : mOtherElements[aIndex - 1]; - } - - void EnsureLengthAtLeast(unsigned long aMinLen) { - if (aMinLen > 0) { - mOtherElements.EnsureLengthAtLeast(aMinLen - 1); - } - } - - void SetLengthNonZero(unsigned long aNewLen) { - mOtherElements.SetLength(aNewLen - 1); - } - - void TruncateLengthNonZero(unsigned long aNewLen) { - mOtherElements.TruncateLength(aNewLen - 1); - } - -private: - T mFirstElement; - nsTArray<T> mOtherElements; -}; diff --git a/tests/headers/only_bitfields.hpp b/tests/headers/only_bitfields.hpp deleted file mode 100644 index 84db0586..00000000 --- a/tests/headers/only_bitfields.hpp +++ /dev/null @@ -1,5 +0,0 @@ -// bindgen-flags: --no-unstable-rust -class C { - bool a: 1; - bool b: 7; -}; diff --git a/tests/headers/opaque_in_struct.hpp b/tests/headers/opaque_in_struct.hpp deleted file mode 100644 index 3cffeb20..00000000 --- a/tests/headers/opaque_in_struct.hpp +++ /dev/null @@ -1,10 +0,0 @@ - - -/** <div rustbindgen opaque> */ -typedef struct opaque { - int waht; -} opaque; - -struct container { - opaque contained; -}; diff --git a/tests/headers/opaque_pointer.hpp b/tests/headers/opaque_pointer.hpp deleted file mode 100644 index 53f8ce1f..00000000 --- a/tests/headers/opaque_pointer.hpp +++ /dev/null @@ -1,22 +0,0 @@ - -/** - * <div rustbindgen opaque></div> - */ -struct OtherOpaque { - int c; -}; - -/** - * <div rustbindgen opaque></div> - */ -template <typename T> -struct Opaque { - T whatever; -}; - -struct WithOpaquePtr { - Opaque<int>* whatever; - Opaque<float> other; - OtherOpaque t; -}; - diff --git a/tests/headers/opaque_typedef.hpp b/tests/headers/opaque_typedef.hpp deleted file mode 100644 index 25640738..00000000 --- a/tests/headers/opaque_typedef.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// bindgen-flags: -- -std=c++11 -template<typename T> -class RandomTemplate; - -template<int i> -class Wat; - -template<int i> -class Wat3; - -template<> -class Wat3<3>; - -/** <div rustbindgen opaque></div> */ -typedef RandomTemplate<int> ShouldBeOpaque; - -typedef RandomTemplate<float> ShouldNotBeOpaque; diff --git a/tests/headers/overflowed_enum.hpp b/tests/headers/overflowed_enum.hpp deleted file mode 100644 index 1f2075a5..00000000 --- a/tests/headers/overflowed_enum.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// bindgen-flags: -- -std=c++11 -Wno-narrowing - -enum Foo { - BAP_ARM = 0x93fcb9, - BAP_X86 = 0xb67eed, - BAP_X86_64 = 0xba7b274f, -}; - -enum Bar: unsigned short { - One = 1, - Big = 65538, -}; diff --git a/tests/headers/overloading.hpp b/tests/headers/overloading.hpp deleted file mode 100644 index 3c2b0487..00000000 --- a/tests/headers/overloading.hpp +++ /dev/null @@ -1,9 +0,0 @@ -extern bool Evaluate(char r); -extern bool Evaluate(int x, int y); - -namespace foo { - extern void MyFunction(); -} -namespace bar { - extern void MyFunction(); -} diff --git a/tests/headers/private.hpp b/tests/headers/private.hpp deleted file mode 100644 index c0f3ce7f..00000000 --- a/tests/headers/private.hpp +++ /dev/null @@ -1,21 +0,0 @@ - -struct HasPrivate { - int mNotPrivate; - /** <div rustbindgen private></div> */ - int mIsPrivate; -}; - - -/** <div rustbindgen private></div> */ -struct VeryPrivate { - int mIsPrivate; - int mIsAlsoPrivate; -}; - - -/** <div rustbindgen private></div> */ -struct ContradictPrivate { - /** <div rustbindgen private="false"></div> */ - int mNotPrivate; - int mIsPrivate; -}; diff --git a/tests/headers/redeclaration.hpp b/tests/headers/redeclaration.hpp deleted file mode 100644 index d536b158..00000000 --- a/tests/headers/redeclaration.hpp +++ /dev/null @@ -1,7 +0,0 @@ -extern "C" { - void foo(); -} - -extern "C" { - void foo(); -} diff --git a/tests/headers/ref_argument_array.hpp b/tests/headers/ref_argument_array.hpp deleted file mode 100644 index dc73fd62..00000000 --- a/tests/headers/ref_argument_array.hpp +++ /dev/null @@ -1,6 +0,0 @@ - -#define NSID_LENGTH 10 -class nsID { -public: - virtual void ToProvidedString(char (&aDest)[NSID_LENGTH]) = 0; -}; diff --git a/tests/headers/replace_template_alias.hpp b/tests/headers/replace_template_alias.hpp deleted file mode 100644 index 6ceae4e5..00000000 --- a/tests/headers/replace_template_alias.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// bindgen-flags: -- --std=c++14 - -namespace JS { -namespace detail { - -/// Notice how this doesn't use T. -template <typename T> -using MaybeWrapped = int; - -} - -template <typename T> -class Rooted { - detail::MaybeWrapped<T> ptr; -}; - -} - -/// But the replacement type does use T! -/// -/// <div rustbindgen replaces="MaybeWrapped" /> -template <typename T> -using replaces_MaybeWrapped = T; diff --git a/tests/headers/replaces_double.hpp b/tests/headers/replaces_double.hpp deleted file mode 100644 index 1a78b0d9..00000000 --- a/tests/headers/replaces_double.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// bindgen-flags: --blacklist-type Wrapper -- --std=c++11 - -template<typename T> -struct Wrapper { - struct Wrapped { - T t; - }; - using Type = Wrapped; -}; - -template<typename T> -class Rooted { - using MaybeWrapped = typename Wrapper<T>::Type; - MaybeWrapped ptr; - - /** - * <div rustbindgen replaces="Rooted_MaybeWrapped"></div> - */ - using MaybeWrapped_simple = T; -}; diff --git a/tests/headers/size_t_template.hpp b/tests/headers/size_t_template.hpp deleted file mode 100644 index 6045c698..00000000 --- a/tests/headers/size_t_template.hpp +++ /dev/null @@ -1,8 +0,0 @@ -template<typename T, unsigned long N> -class Array { - T inner[N]; -}; - -class C { - Array<int, 3> arr; -}; diff --git a/tests/headers/struct_containing_forward_declared_struct.h b/tests/headers/struct_containing_forward_declared_struct.h deleted file mode 100644 index d38aca2f..00000000 --- a/tests/headers/struct_containing_forward_declared_struct.h +++ /dev/null @@ -1,7 +0,0 @@ -struct a { - struct b* val_a; -}; - -struct b { - int val_b; -}; diff --git a/tests/headers/struct_with_anon_struct.h b/tests/headers/struct_with_anon_struct.h deleted file mode 100644 index 1617d7a8..00000000 --- a/tests/headers/struct_with_anon_struct.h +++ /dev/null @@ -1,6 +0,0 @@ -struct foo { - struct { - int a; - int b; - } bar; -}; diff --git a/tests/headers/struct_with_anon_struct_array.h b/tests/headers/struct_with_anon_struct_array.h deleted file mode 100644 index 9ea977e8..00000000 --- a/tests/headers/struct_with_anon_struct_array.h +++ /dev/null @@ -1,10 +0,0 @@ -struct foo { - struct { - int a; - int b; - } bar[2]; - struct { - int a; - int b; - } baz[2][3][4]; -}; diff --git a/tests/headers/struct_with_anon_struct_pointer.h b/tests/headers/struct_with_anon_struct_pointer.h deleted file mode 100644 index 0c486d84..00000000 --- a/tests/headers/struct_with_anon_struct_pointer.h +++ /dev/null @@ -1,6 +0,0 @@ -struct foo { - struct { - int a; - int b; - } *bar; -}; diff --git a/tests/headers/struct_with_anon_union.h b/tests/headers/struct_with_anon_union.h deleted file mode 100644 index 3a92b940..00000000 --- a/tests/headers/struct_with_anon_union.h +++ /dev/null @@ -1,6 +0,0 @@ -struct foo { - union { - unsigned int a; - unsigned short b; - } bar; -}; diff --git a/tests/headers/struct_with_anon_unnamed_struct.h b/tests/headers/struct_with_anon_unnamed_struct.h deleted file mode 100644 index f8ac4225..00000000 --- a/tests/headers/struct_with_anon_unnamed_struct.h +++ /dev/null @@ -1,6 +0,0 @@ -struct foo { - struct { - unsigned int a; - unsigned int b; - }; -}; diff --git a/tests/headers/struct_with_anon_unnamed_union.h b/tests/headers/struct_with_anon_unnamed_union.h deleted file mode 100644 index 7158e727..00000000 --- a/tests/headers/struct_with_anon_unnamed_union.h +++ /dev/null @@ -1,6 +0,0 @@ -struct foo { - union { - unsigned int a; - unsigned short b; - }; -}; diff --git a/tests/headers/struct_with_bitfields.h b/tests/headers/struct_with_bitfields.h deleted file mode 100644 index 107fb136..00000000 --- a/tests/headers/struct_with_bitfields.h +++ /dev/null @@ -1,13 +0,0 @@ -// bindgen-flags: --no-unstable-rust -struct bitfield { - unsigned short - a :1, - b :1, - c :1, - :1, - :2, - d :2; - int e; - unsigned int f : 2; - unsigned int g : 32; -}; diff --git a/tests/headers/struct_with_derive_debug.h b/tests/headers/struct_with_derive_debug.h deleted file mode 100644 index 98ba1b3d..00000000 --- a/tests/headers/struct_with_derive_debug.h +++ /dev/null @@ -1,15 +0,0 @@ -struct LittleArray { - int a[32]; -}; - -struct BigArray{ - int a[33]; -}; - -struct WithLittleArray { - struct LittleArray a; -}; - -struct WithBigArray { - struct BigArray a; -}; diff --git a/tests/headers/struct_with_nesting.h b/tests/headers/struct_with_nesting.h deleted file mode 100644 index 9d7fa176..00000000 --- a/tests/headers/struct_with_nesting.h +++ /dev/null @@ -1,17 +0,0 @@ -struct foo { - unsigned int a; - union { - unsigned int b; - struct { - unsigned short c1; - unsigned short c2; - }; - - struct { - unsigned char d1; - unsigned char d2; - unsigned char d3; - unsigned char d4; - }; - }; -}; diff --git a/tests/headers/struct_with_packing.h b/tests/headers/struct_with_packing.h deleted file mode 100644 index 1b9fe131..00000000 --- a/tests/headers/struct_with_packing.h +++ /dev/null @@ -1,4 +0,0 @@ -struct a { - char b; - short c; -} __attribute__((packed)); diff --git a/tests/headers/struct_with_struct.h b/tests/headers/struct_with_struct.h deleted file mode 100644 index 78b1cc81..00000000 --- a/tests/headers/struct_with_struct.h +++ /dev/null @@ -1,6 +0,0 @@ -struct foo { - struct { - unsigned int x; - unsigned int y; - } bar; -}; diff --git a/tests/headers/struct_with_typedef_template_arg.hpp b/tests/headers/struct_with_typedef_template_arg.hpp deleted file mode 100644 index 7fed21ab..00000000 --- a/tests/headers/struct_with_typedef_template_arg.hpp +++ /dev/null @@ -1,4 +0,0 @@ -template<typename T, typename ...Args> -struct Proxy { - typedef void (*foo)(T* bar); -}; diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp deleted file mode 100644 index c13643c3..00000000 --- a/tests/headers/template.hpp +++ /dev/null @@ -1,144 +0,0 @@ -template<typename T, typename U> class Foo { - T m_member; - T* m_member_ptr; - T m_member_arr[1]; -}; - -void bar(Foo<int, int> foo); - -template<typename T> -class D { - typedef Foo<int, int> MyFoo; - - MyFoo m_foo; - - template<typename Z> - class U { - MyFoo m_nested_foo; - Z m_baz; - }; -}; - -template<typename T> -class Rooted { - T* prev; - Rooted<void*>* next; - T ptr; -}; - -class RootedContainer { - Rooted<void*> root; -}; - -template<typename T> -class WithDtor; - -typedef WithDtor<int> WithDtorIntFwd; - -template<typename T> -class WithDtor { - T member; - ~WithDtor() {} -}; - -class PODButContainsDtor { - WithDtorIntFwd member; -}; - - -/** <div rustbindgen opaque> */ -template<typename T> -class Opaque { - T member; -}; - -class POD { - Opaque<int> opaque_member; -}; - -/** - * <div rustbindgen replaces="NestedReplaced"></div> - */ -template<typename T> -class Nested { - T* buff; -}; - -template<typename T, typename U> -class NestedBase { - T* buff; -}; - -template<typename T> -class NestedReplaced: public NestedBase<T, int> { -}; - -template<typename T> -class Incomplete; - -template<typename T> -class NestedContainer { - T c; -private: - NestedReplaced<T> nested; - Incomplete<T> inc; -}; - -template<typename T> -class Incomplete { - T d; -}; - -class Untemplated {}; - -template<typename T> -class Templated { - Untemplated m_untemplated; -}; - -/** - * If the replacement doesn't happen at the parse level the container would be - * copy and the replacement wouldn't, so this wouldn't compile. - * - * <div rustbindgen replaces="ReplacedWithoutDestructor"></div> - */ -template<typename T> -class ReplacedWithDestructor { - T* buff; - ~ReplacedWithDestructor() {}; -}; - -template<typename T> -class ReplacedWithoutDestructor { - T* buff; -}; - -template<typename T> -class ReplacedWithoutDestructorFwd; - -template<typename T> -class ShouldNotBeCopiable { - ReplacedWithoutDestructor<T> m_member; -}; - -template<typename U> -class ShouldNotBeCopiableAsWell { - ReplacedWithoutDestructorFwd<U> m_member; -}; - -/** - * If the replacement doesn't happen at the parse level the container would be - * copy and the replacement wouldn't, so this wouldn't compile. - * - * <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div> - */ -template<typename T> -class ReplacedWithDestructorDeclaredAfter { - T* buff; - ~ReplacedWithDestructorDeclaredAfter() {}; -}; - -template<typename T> -class TemplateWithVar { - static T var = 0; -}; diff --git a/tests/headers/template_alias.hpp b/tests/headers/template_alias.hpp deleted file mode 100644 index 646d9f40..00000000 --- a/tests/headers/template_alias.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// bindgen-flags: -- -std=c++14 - -namespace JS { -namespace detail { - template <typename T> - using Wrapped = T; -} - -template <typename T> -struct Rooted { - detail::Wrapped<T> ptr; -}; -} diff --git a/tests/headers/template_alias_basic.hpp b/tests/headers/template_alias_basic.hpp deleted file mode 100644 index 964f6e27..00000000 --- a/tests/headers/template_alias_basic.hpp +++ /dev/null @@ -1,4 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -template<typename T> -using Wrapped = T; diff --git a/tests/headers/template_alias_namespace.hpp b/tests/headers/template_alias_namespace.hpp deleted file mode 100644 index bd637166..00000000 --- a/tests/headers/template_alias_namespace.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// bindgen-flags: --enable-cxx-namespaces -- -std=c++14 - -namespace JS { -namespace detail { - template <typename T> - using Wrapped = T; -} - -template <typename T> -struct Rooted { - detail::Wrapped<T> ptr; -}; -} diff --git a/tests/headers/template_typedef_transitive_param.hpp b/tests/headers/template_typedef_transitive_param.hpp deleted file mode 100644 index 2269ac36..00000000 --- a/tests/headers/template_typedef_transitive_param.hpp +++ /dev/null @@ -1,7 +0,0 @@ -template<typename T> -struct Wrapper { - struct Wrapped { - T t; - }; - using Type = Wrapped; -}; diff --git a/tests/headers/template_typedefs.hpp b/tests/headers/template_typedefs.hpp deleted file mode 100644 index 5e13dcd8..00000000 --- a/tests/headers/template_typedefs.hpp +++ /dev/null @@ -1,8 +0,0 @@ -typedef void (*foo)(int); - -template<typename T, typename U> -class Foo { - typedef T Char; - typedef Char* FooPtrTypedef; - typedef bool (*nsCOMArrayEnumFunc)(T* aElement, void* aData); -}; diff --git a/tests/headers/type_alias_empty.hpp b/tests/headers/type_alias_empty.hpp deleted file mode 100644 index f0760c8f..00000000 --- a/tests/headers/type_alias_empty.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// bindgen-flags: --whitelist-type bool_constant -- -std=c++11 - -// NB: The --whitelist-type is done to trigger the traversal of the types on -// codegen in order to trigger #67. - -template<typename T, T Val> -struct integral_constant {}; - -template<bool B> -using bool_constant = integral_constant<bool, B>; diff --git a/tests/headers/typeref.hpp b/tests/headers/typeref.hpp deleted file mode 100644 index b94c98ef..00000000 --- a/tests/headers/typeref.hpp +++ /dev/null @@ -1,28 +0,0 @@ -struct nsFoo; - -namespace mozilla { - -struct FragmentOrURL { bool mIsLocalRef; }; -struct Position { }; - -} // namespace mozilla - -class Bar { - nsFoo* mFoo; -}; - -namespace mozilla { - -template<typename ReferenceBox> -struct StyleShapeSource { - union { - Position* mPosition; - FragmentOrURL* mFragmentOrURL; - }; -}; - -} // namespace mozilla - -struct nsFoo { - mozilla::StyleShapeSource<int> mBar; -}; diff --git a/tests/headers/union_dtor.hpp b/tests/headers/union_dtor.hpp deleted file mode 100644 index 399dc89d..00000000 --- a/tests/headers/union_dtor.hpp +++ /dev/null @@ -1,5 +0,0 @@ -union UnionWithDtor { - ~UnionWithDtor(); - int mFoo; - void* mBar; -}; diff --git a/tests/headers/union_fields.hpp b/tests/headers/union_fields.hpp deleted file mode 100644 index aec3a7fd..00000000 --- a/tests/headers/union_fields.hpp +++ /dev/null @@ -1,5 +0,0 @@ -typedef union { - int mInt; - float mFloat; - void* mPointer; -} nsStyleUnion; diff --git a/tests/headers/union_template.hpp b/tests/headers/union_template.hpp deleted file mode 100644 index 0d0a9bb3..00000000 --- a/tests/headers/union_template.hpp +++ /dev/null @@ -1,19 +0,0 @@ -template<typename T> -struct NastyStruct { - bool mIsSome; - union { - void* mFoo; - unsigned long mDummy; - } mStorage; - - union { - short wat; - int* wut; - }; -}; - -template<typename T> -union Whatever { - void* mTPtr; - int mInt; -}; diff --git a/tests/headers/union_with_anon_struct.h b/tests/headers/union_with_anon_struct.h deleted file mode 100644 index 7f8dec95..00000000 --- a/tests/headers/union_with_anon_struct.h +++ /dev/null @@ -1,6 +0,0 @@ -union foo { - struct { - unsigned int a; - unsigned int b; - } bar; -}; diff --git a/tests/headers/union_with_anon_struct_bitfield.h b/tests/headers/union_with_anon_struct_bitfield.h deleted file mode 100644 index 24c7dce8..00000000 --- a/tests/headers/union_with_anon_struct_bitfield.h +++ /dev/null @@ -1,8 +0,0 @@ -// bindgen-flags: --no-unstable-rust -union foo { - int a; - struct { - int b : 7; - int c : 25; - }; -}; diff --git a/tests/headers/union_with_anon_union.h b/tests/headers/union_with_anon_union.h deleted file mode 100644 index 212431b8..00000000 --- a/tests/headers/union_with_anon_union.h +++ /dev/null @@ -1,6 +0,0 @@ -union foo { - union { - unsigned int a; - unsigned short b; - } bar; -}; diff --git a/tests/headers/union_with_anon_unnamed_struct.h b/tests/headers/union_with_anon_unnamed_struct.h deleted file mode 100644 index 79558049..00000000 --- a/tests/headers/union_with_anon_unnamed_struct.h +++ /dev/null @@ -1,9 +0,0 @@ -union pixel { - unsigned int rgba; - struct { - unsigned char r; - unsigned char g; - unsigned char b; - unsigned char a; - }; -}; diff --git a/tests/headers/union_with_anon_unnamed_union.h b/tests/headers/union_with_anon_unnamed_union.h deleted file mode 100644 index 7580771a..00000000 --- a/tests/headers/union_with_anon_unnamed_union.h +++ /dev/null @@ -1,7 +0,0 @@ -union foo { - unsigned int a; - union { - unsigned short b; - unsigned char c; - }; -}; diff --git a/tests/headers/union_with_big_member.h b/tests/headers/union_with_big_member.h deleted file mode 100644 index 6347d6ca..00000000 --- a/tests/headers/union_with_big_member.h +++ /dev/null @@ -1,14 +0,0 @@ -union WithBigArray { - int a; - int b[33]; -}; - -union WithBigArray2 { - int a; - char b[33]; -}; - -union WithBigMember { - int a; - union WithBigArray b; -}; diff --git a/tests/headers/union_with_nesting.h b/tests/headers/union_with_nesting.h deleted file mode 100644 index cd907d57..00000000 --- a/tests/headers/union_with_nesting.h +++ /dev/null @@ -1,14 +0,0 @@ -union foo { - unsigned int a; - struct { - union { - unsigned short b1; - unsigned short b2; - }; - - union { - unsigned short c1; - unsigned short c2; - }; - }; -}; diff --git a/tests/headers/unknown_attr.h b/tests/headers/unknown_attr.h deleted file mode 100644 index f87e9f0b..00000000 --- a/tests/headers/unknown_attr.h +++ /dev/null @@ -1,6 +0,0 @@ -typedef struct { - long long __clang_max_align_nonce1 - __attribute__((__aligned__(__alignof__(long long)))); - long double __clang_max_align_nonce2 - __attribute__((__aligned__(__alignof__(long double)))); -} max_align_t; diff --git a/tests/headers/use-core.h b/tests/headers/use-core.h deleted file mode 100644 index 42bb10d9..00000000 --- a/tests/headers/use-core.h +++ /dev/null @@ -1,8 +0,0 @@ -// bindgen-flags: --use-core --raw-line "extern crate core;" - -struct foo { - int a, b; - void* bar; -}; - -typedef void (*fooFunction)(int bar); diff --git a/tests/headers/using.hpp b/tests/headers/using.hpp deleted file mode 100644 index ba07b9c8..00000000 --- a/tests/headers/using.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -template<typename T> -class Point { - T x; - T y; -}; - -typedef Point<int> IntPoint2D; - -using IntVec2D = Point<int>; diff --git a/tests/headers/vector.hpp b/tests/headers/vector.hpp deleted file mode 100644 index 4707f77f..00000000 --- a/tests/headers/vector.hpp +++ /dev/null @@ -1,3 +0,0 @@ -struct foo { - __attribute__((__vector_size__(1 * sizeof(long long)))) long long mMember; -}; diff --git a/tests/headers/virtual_dtor.hpp b/tests/headers/virtual_dtor.hpp deleted file mode 100644 index c35dcab1..00000000 --- a/tests/headers/virtual_dtor.hpp +++ /dev/null @@ -1,3 +0,0 @@ -struct nsSlots { - virtual ~nsSlots(); -}; diff --git a/tests/headers/virtual_overloaded.hpp b/tests/headers/virtual_overloaded.hpp deleted file mode 100644 index 8aea8a19..00000000 --- a/tests/headers/virtual_overloaded.hpp +++ /dev/null @@ -1,5 +0,0 @@ -class C { -public: - virtual void do_thing(char) { }; - virtual void do_thing(int) { }; -}; diff --git a/tests/headers/vtable_recursive_sig.hpp b/tests/headers/vtable_recursive_sig.hpp deleted file mode 100644 index 8729be00..00000000 --- a/tests/headers/vtable_recursive_sig.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// bindgen-flags: -- -std=c++11 - -class Derived; -class Base { -public: - virtual Derived* AsDerived() { return nullptr; } -}; - -class Derived final : public Base { - virtual Derived* AsDerived() override { return this; } -}; diff --git a/tests/headers/weird_bitfields.hpp b/tests/headers/weird_bitfields.hpp deleted file mode 100644 index 755681c1..00000000 --- a/tests/headers/weird_bitfields.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// bindgen-flags: --no-unstable-rust -// You can guess where this is taken from... -enum nsStyleSVGOpacitySource { - eStyleSVGOpacitySource_Normal, - eStyleSVGOpacitySource_ContextFillOpacity, - eStyleSVGOpacitySource_ContextStrokeOpacity -}; - -class Weird { - unsigned int mStrokeDasharrayLength; - unsigned int bitTest: 16; - unsigned int bitTest2: 15; - unsigned char mClipRule; // [inherited] - unsigned char mColorInterpolation; // [inherited] see nsStyleConsts.h - unsigned char mColorInterpolationFilters; // [inherited] see nsStyleConsts.h - unsigned char mFillRule; // [inherited] see nsStyleConsts.h - unsigned char mImageRendering; // [inherited] see nsStyleConsts.h - unsigned char mPaintOrder; // [inherited] see nsStyleConsts.h - unsigned char mShapeRendering; // [inherited] see nsStyleConsts.h - unsigned char mStrokeLinecap; // [inherited] see nsStyleConsts.h - unsigned char mStrokeLinejoin; // [inherited] see nsStyleConsts.h - unsigned char mTextAnchor; // [inherited] see nsStyleConsts.h - unsigned char mTextRendering; // [inherited] see nsStyleConsts.h - - // In SVG glyphs, whether we inherit fill or stroke opacity from the outer - // text object. - // Use 3 bits to avoid signedness problems in MSVC. - nsStyleSVGOpacitySource mFillOpacitySource : 3; - nsStyleSVGOpacitySource mStrokeOpacitySource : 3; - - // SVG glyph outer object inheritance for other properties - bool mStrokeDasharrayFromObject : 1; - bool mStrokeDashoffsetFromObject : 1; - bool mStrokeWidthFromObject : 1; -}; diff --git a/tests/headers/what_is_going_on.hpp b/tests/headers/what_is_going_on.hpp deleted file mode 100644 index 078c1ad5..00000000 --- a/tests/headers/what_is_going_on.hpp +++ /dev/null @@ -1,19 +0,0 @@ - -struct UnknownUnits {}; -typedef float Float; - -template<class units, class F = Float> -struct PointTyped { - F x; - F y; - - static PointTyped<units, F> FromUnknownPoint(const PointTyped<UnknownUnits, F>& aPoint) { - return PointTyped<units, F>(aPoint.x, aPoint.y); - } - - PointTyped<UnknownUnits, F> ToUnknownPoint() const { - return PointTyped<UnknownUnits, F>(this->x, this->y); - } -}; - -typedef PointTyped<UnknownUnits> IntPoint; diff --git a/tests/headers/whitelist_basic.hpp b/tests/headers/whitelist_basic.hpp deleted file mode 100644 index 8424f75a..00000000 --- a/tests/headers/whitelist_basic.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// bindgen-flags: --whitelist-type WhitelistMe - -template<typename T> -class WhitelistMe { - class Inner { - T bar; - }; - - int foo; - Inner bar; -}; - -struct DontWhitelistMe { - void* foo; - double _Complex noComplexGenerated; -}; diff --git a/tests/headers/whitelist_vars.h b/tests/headers/whitelist_vars.h deleted file mode 100644 index 07fa2815..00000000 --- a/tests/headers/whitelist_vars.h +++ /dev/null @@ -1,4 +0,0 @@ -#define NONE 0 -#define FOO 5 -#define FOOB -2 -#define FOOBAR (-10) diff --git a/tests/tests.rs b/tests/tests.rs deleted file mode 100644 index 1f72fccf..00000000 --- a/tests/tests.rs +++ /dev/null @@ -1,171 +0,0 @@ -// We add this `extern crate` here to ensure that bindgen is up-to-date and -// rebuilt, even though we aren't using any of its types or functions here, only -// indirectly calling the executable. -#[allow(dead_code)] -extern crate bindgen; - -use std::env; -use std::fs; -use std::io::Read; -use std::path::{Path, PathBuf}; -use std::process; - -const TEST_BATCH_DEFAULT_SIZE: usize = 16; - -fn spawn_run_bindgen<P, Q, R>(run_bindgen: P, - bindgen: Q, - header: R) - -> process::Child - where P: AsRef<Path>, - Q: AsRef<Path>, - R: AsRef<Path>, -{ - let run_bindgen = run_bindgen.as_ref(); - let bindgen = bindgen.as_ref(); - let header = header.as_ref(); - - // Convert from "tests/headers/foo.hpp" to "tests/expectations/tests/foo.rs" by - // saving the filename, popping off "headers/foo.hpp", pushing - // "expectations/tests", pushing the saved filename, and finally modifying the - // extension. - - let mut expected = PathBuf::from(header); - let file_name = expected.file_name() - .expect("Should have filename") - .to_os_string(); - expected.pop(); - expected.pop(); - expected.push("expectations"); - expected.push("tests"); - expected.push(file_name); - expected.set_extension("rs"); - - // And the same style conversion as above, but for the dummy uses. We assume - // that .hpp means we should generate a .cpp uses file, and .h means we - // should generate a .c file. - - let mut dummy_uses = PathBuf::from(header); - let file_name = dummy_uses.file_name() - .expect("Should still have filename") - .to_os_string(); - dummy_uses.pop(); - dummy_uses.pop(); - dummy_uses.push("uses"); - dummy_uses.push(file_name); - dummy_uses.set_extension(if header.extension().and_then(|s| s.to_str()) == - Some("hpp") { - "cpp" - } else { - "c" - }); - - process::Command::new(run_bindgen) - .stdout(process::Stdio::piped()) - .stderr(process::Stdio::piped()) - .arg(bindgen) - .arg(header) - .arg(expected) - .arg("--dummy-uses") - .arg(dummy_uses) - .spawn() - .expect("Should be able to spawn run-bindgen.py child process") -} - -#[test] -fn run_bindgen_tests() { - let crate_root = env::var("CARGO_MANIFEST_DIR") - .expect("should have CARGO_MANIFEST_DIR environment variable"); - - let mut run_bindgen = PathBuf::from(&crate_root); - run_bindgen.push("tests"); - run_bindgen.push("tools"); - run_bindgen.push("run-bindgen.py"); - - let mut bindgen = PathBuf::from(&crate_root); - bindgen.push("target"); - if cfg!(debug_assertions) { - bindgen.push("debug"); - } else { - bindgen.push("release"); - } - bindgen.push("bindgen"); - if !bindgen.is_file() { - panic!("{} is not a file! Build bindgen before running tests.", - bindgen.display()); - } - - let mut headers_dir = PathBuf::from(&crate_root); - headers_dir.push("tests"); - headers_dir.push("headers"); - - let entries = fs::read_dir(&headers_dir) - .expect("Should read directory") - .map(|result| result.expect("Should read directory entry")); - - let tests = entries.filter(|entry| { - match entry.path().extension().and_then(|s| s.to_str()) { - Some("h") | Some("hpp") => true, - _ => false, - } - }) - .collect::<Vec<_>>(); - - let batch_size = env::var("BINDGEN_TEST_BATCH_SIZE") - .ok() - .and_then(|x| x.parse::<usize>().ok()) - .unwrap_or(TEST_BATCH_DEFAULT_SIZE); - - // Spawn `batch_size` children to run in parallel and wait on all of them - // before processing the next batch. This puts a limit on the resources - // consumed when testing, so that we don't overload the system. - - let children = tests.chunks(batch_size).map(|x| { - x.iter() - .map(|entry| { - let child = spawn_run_bindgen(run_bindgen.clone(), - bindgen.clone(), - entry.path()); - (entry.path(), child) - }) - .collect::<Vec<_>>() - }); - - let failures: Vec<_> = children.flat_map(|x| { - x.into_iter().filter_map(|(path, mut child)| { - let passed = child.wait() - .expect("Should wait on child process") - .success(); - - if passed { None } else { Some((path, child)) } - }) - }) - .collect(); - - let num_failures = failures.len(); - - for (path, child) in failures { - println!("FAIL: {}", path.display()); - - let mut buf = String::new(); - - child.stdout - .expect("should have stdout piped") - .read_to_string(&mut buf) - .expect("should read child's stdout"); - for line in buf.lines() { - println!("child stdout> {}", line); - } - - child.stderr - .expect("should have stderr piped") - .read_to_string(&mut buf) - .expect("should read child's stderr"); - for line in buf.lines() { - println!("child stderr> {}", line); - } - } - - if num_failures > 0 { - panic!("{} test failures!", num_failures); - } -} diff --git a/tests/tools/run-bindgen.py b/tests/tools/run-bindgen.py deleted file mode 100755 index 519e6891..00000000 --- a/tests/tools/run-bindgen.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function - -import argparse -import difflib -import os -import sys -import subprocess -import tempfile -import shlex - -BINDGEN_FLAGS_PREFIX = "// bindgen-flags: " - -COMMON_PRELUDE = """ -#![allow(non_snake_case)] -""" - -DESCRIPTION = """ -Run bindgen on a test header and check the generated bindings against expected -output. -""" - -def make_parser(): - """Make the commandline parser""" - parser = argparse.ArgumentParser(description=DESCRIPTION) - parser.add_argument("bindgen", - metavar="BINDGEN", - help="The path to the bindgen executable") - parser.add_argument("header", - metavar="HEADER", - help="The path to the input header") - parser.add_argument("rust_bindings", - metavar="RUST_BINDINGS", - help="The path to the generated rust output. If a file \ - at this path already exists, the newly generated \ - bindings will be checked against those extant \ - expected bindings.") - parser.add_argument("--feature", - dest="features", - action="append", - nargs=1, - help="Run tests that depend on bindgen being built with \ - the given feature.") - parser.add_argument("--dummy-uses", - dest="dummy_uses", - help="The path to generate dummy C/C++ uses of the \ - whitelisted types from the input header at.") - return parser - -def usage_and_exit(*args): - """Print the program usage and exit. If args are given, print them first""" - if len(args) > 0: - print(*args) - make_parser().print_help() - sys.exit(1) - -def parse_args(): - """Get, parse, and validate commandline arguments.""" - parser = make_parser() - args = parser.parse_args() - - if args.features is None: - args.features = [] - - if not os.path.isfile(args.bindgen): - usage_and_exit("error: bindgen is not a file:", args.bindgen) - - if not os.path.isfile(args.header): - usage_and_exit("error: header is not a file:", args.header) - - return args - -def make_bindgen_env(): - """Build the environment to run bindgen in.""" - env = os.environ.copy() - env["RUST_BACKTRACE"] = "1" - - # El Capitan likes to unset dyld variables - # https://forums.developer.apple.com/thread/9233 - if "DYLD_LIBRARY_PATH" not in env and "LIBCLANG_PATH" in env: - env["DYLD_LIBRARY_PATH"] = env["LIBCLANG_PATH"] - - return env - -def get_bindgen_flags(header_path): - """ - Return the bindgen flags required for this header - """ - flags = ["--no-unstable-rust"] - for line in COMMON_PRELUDE.split("\n"): - flags.append("--raw-line") - flags.append(line) - - with open(header_path) as f: - for line in f: - if line.startswith(BINDGEN_FLAGS_PREFIX): - flags.extend(shlex.split(line.strip().split(BINDGEN_FLAGS_PREFIX)[1])) - break - - return flags - -def get_expected_bindings(rust_bindings_path): - """ - Get the expected, generated rust bindings output, or None if there is no - expected output yet. - """ - expected_bindings = None - if os.path.isfile(rust_bindings_path): - with open(rust_bindings_path) as f: - expected_bindings = f.read() - return expected_bindings - -def get_actual_bindings(rust_bindings_path): - """Get the actual generated rust bindings output.""" - assert os.path.isfile(rust_bindings_path) - with open(rust_bindings_path) as f: - return f.read() - -def run_cmd(command, **kwargs): - """Run the given command, passing through **kwargs to subprocess.check_call""" - print("run-bindgen.py: running", command) - subprocess.check_call(command, **kwargs) - -def generate_bindings(bindgen, dummy_uses, flags, header, output): - """Generate the rust bindings.""" - command = [bindgen, "-o", output] - if dummy_uses: - command.extend(["--dummy-uses", dummy_uses]) - command.extend(flags) - command.append(header) - run_cmd(command, cwd=os.getcwd(), env=make_bindgen_env()) - -def check_actual_vs_expected(expected_bindings, rust_bindings_path): - """ - Check the actual generated rust bindings versus our expected generated rust - bindings. If they don't match up, print a diff between them and exit with a - failure. - """ - if expected_bindings is None: - return - - actual_bindings = get_actual_bindings(rust_bindings_path) - if actual_bindings == expected_bindings: - return - - print("error: actual generated bindings do not match expected generated bindings!") - - def to_diffable(s): - return map(lambda l: l + "\n", s.split("\n")) - - diff = difflib.unified_diff(to_diffable(expected_bindings), - to_diffable(actual_bindings), - fromfile="expected_bindings.rs", - tofile="actual_bindings.rs") - sys.stderr.writelines(diff) - sys.stderr.write("\n") - - sys.exit(1) - -def main(): - args = parse_args() - - test_flags = get_bindgen_flags(args.header) - expected_bindings = get_expected_bindings(args.rust_bindings) - generate_bindings(args.bindgen, - args.dummy_uses, - test_flags, - args.header, - args.rust_bindings) - check_actual_vs_expected(expected_bindings, args.rust_bindings) - sys.exit(0) - -if __name__ == "__main__": - main() diff --git a/tests/uses/.gitignore b/tests/uses/.gitignore deleted file mode 100644 index 40d7cb4c..00000000 --- a/tests/uses/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.c -*.cpp |