-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for forward declared complex types
- Loading branch information
1 parent
8eb9e3f
commit 78aaa32
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
tests/expectations/tests/forward_declared_complex_types.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(non_snake_case)] | ||
|
||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct Foo_empty { | ||
pub _address: u8, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_Foo_empty() { | ||
assert_eq!(::std::mem::size_of::<Foo_empty>() , 1usize); | ||
assert_eq!(::std::mem::align_of::<Foo_empty>() , 1usize); | ||
} | ||
impl Clone for Foo_empty { | ||
fn clone(&self) -> Self { *self } | ||
} | ||
#[repr(C)] | ||
pub struct Foo([u8; 0]); | ||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct Bar { | ||
pub f: *mut Foo, | ||
} | ||
#[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 } | ||
} | ||
extern "C" { | ||
#[link_name = "_Z10baz_structP3Foo"] | ||
pub fn baz_struct(f: *mut Foo); | ||
} | ||
#[repr(C)] | ||
pub struct Union([u8; 0]); | ||
extern "C" { | ||
#[link_name = "_Z9baz_unionP5Union"] | ||
pub fn baz_union(u: *mut Union); | ||
} | ||
#[repr(C)] | ||
pub struct Quux([u8; 0]); | ||
extern "C" { | ||
#[link_name = "_Z9baz_classP4Quux"] | ||
pub fn baz_class(q: *mut Quux); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
struct Foo_empty {}; | ||
struct Foo; | ||
|
||
struct Bar { | ||
Foo *f; | ||
}; | ||
|
||
void baz_struct(Foo* f); | ||
|
||
union Union; | ||
|
||
void baz_union(Union* u); | ||
|
||
class Quux; | ||
|
||
void baz_class(Quux* q); |