-
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
1a56a6a
commit 9866229
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
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,37 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(non_snake_case)] | ||
|
||
|
||
#[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,15 @@ | ||
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); |