-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag to ignore type blocklist when computing derive information
Fixes #1454
- Loading branch information
Showing
5 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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,81 @@ | ||
#![allow( | ||
dead_code, | ||
non_snake_case, | ||
non_camel_case_types, | ||
non_upper_case_globals | ||
)] | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Default, Copy, Clone)] | ||
pub struct rlimit; | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Default, Copy, Clone)] | ||
pub struct my_rlimit_conf { | ||
pub core: rlimit, | ||
pub cpu: rlimit, | ||
pub data: rlimit, | ||
pub fsize: rlimit, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_my_rlimit_conf() { | ||
assert_eq!( | ||
::std::mem::size_of::<my_rlimit_conf>(), | ||
0usize, | ||
concat!("Size of: ", stringify!(my_rlimit_conf)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<my_rlimit_conf>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(my_rlimit_conf)) | ||
); | ||
assert_eq!( | ||
unsafe { | ||
&(*(::std::ptr::null::<my_rlimit_conf>())).core as *const _ as usize | ||
}, | ||
0usize, | ||
concat!( | ||
"Offset of field: ", | ||
stringify!(my_rlimit_conf), | ||
"::", | ||
stringify!(core) | ||
) | ||
); | ||
assert_eq!( | ||
unsafe { | ||
&(*(::std::ptr::null::<my_rlimit_conf>())).cpu as *const _ as usize | ||
}, | ||
0usize, | ||
concat!( | ||
"Offset of field: ", | ||
stringify!(my_rlimit_conf), | ||
"::", | ||
stringify!(cpu) | ||
) | ||
); | ||
assert_eq!( | ||
unsafe { | ||
&(*(::std::ptr::null::<my_rlimit_conf>())).data as *const _ as usize | ||
}, | ||
0usize, | ||
concat!( | ||
"Offset of field: ", | ||
stringify!(my_rlimit_conf), | ||
"::", | ||
stringify!(data) | ||
) | ||
); | ||
assert_eq!( | ||
unsafe { | ||
&(*(::std::ptr::null::<my_rlimit_conf>())).fsize as *const _ | ||
as usize | ||
}, | ||
0usize, | ||
concat!( | ||
"Offset of field: ", | ||
stringify!(my_rlimit_conf), | ||
"::", | ||
stringify!(fsize) | ||
) | ||
); | ||
} |
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,12 @@ | ||
// bindgen-flags: --no-recursive-allowlist --allowlist-type "my_rlimit_conf" --derive-ignore-blocklist --raw-line "#[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct rlimit;" | ||
|
||
struct rlimit {}; | ||
|
||
typedef struct | ||
{ | ||
struct rlimit core; | ||
struct rlimit cpu; | ||
struct rlimit data; | ||
struct rlimit fsize; | ||
} | ||
my_rlimit_conf; |