-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning in bindgen: found non-foreign-function-safe member in struct marked #[repr(C)] #634
Comments
Could you post the definition of |
Hi, Actually all the code I get is the one that you see. I have no idea of the definition of fpos_t however I assume it the one documented here: http://www.cplusplus.com/reference/cstdio/fpos_t/ Stuff from the stdio... Sorry for this vague information but I really don't know how to help futher... |
So I can't reproduce it on my system. The warning points to a source file (in this case Thanks again! :) |
Hi emilio, what I got is here: #[repr(C)]
#[derive(Debug, Copy)]
pub struct _G_fpos_t {
pub __pos: __off_t,
pub __state: __mbstate_t,
}
#[test]
fn bindgen_test_layout__G_fpos_t() {
assert_eq!(::std::mem::size_of::<_G_fpos_t>() , 16usize , concat ! (
"Size of: " , stringify ! ( _G_fpos_t ) ));
assert_eq! (::std::mem::align_of::<_G_fpos_t>() , 8usize , concat ! (
"Alignment of " , stringify ! ( _G_fpos_t ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const _G_fpos_t ) ) . __pos as * const _ as
usize } , 0usize , concat ! (
"Alignment of field: " , stringify ! ( _G_fpos_t ) , "::" ,
stringify ! ( __pos ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const _G_fpos_t ) ) . __state as * const _ as
usize } , 8usize , concat ! (
"Alignment of field: " , stringify ! ( _G_fpos_t ) , "::" ,
stringify ! ( __state ) ));
}
impl Clone for _G_fpos_t {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct _G_fpos64_t {
pub __pos: __off64_t,
pub __state: __mbstate_t,
}
...
pub type fpos_t = _G_fpos_t; I looked inside the source file of Redis and there is nothing like fpos_t however it includes stdio.h However let me guess that a lot of other projects include stdio.h Did you try to fork my repo and reproduce the issues or simply recreate the same environment give the indication that I provide to you? |
I forked and built, but couldn't repro. This is inside system headers so that's somewhat expected I guess. Could you post the definitions of |
duplicate #442? |
Maybe if the rustc version the reporter is compiling with doesn't contain rust-lang/rust#39462? But even with that, I don't see off-hand a reason those types should have |
Hi, here are the definitions: pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
...
#[repr(C)]
#[derive(Debug, Copy)]
pub struct __mbstate_t {
pub __count: ::std::os::raw::c_int,
pub __value: __mbstate_t__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct __mbstate_t__bindgen_ty_1 {
pub __wch: __BindgenUnionField<::std::os::raw::c_uint>,
pub __wchb: __BindgenUnionField<[::std::os::raw::c_char; 4usize]>,
pub bindgen_union_field: u32,
} Is this enough? I see primitive so I would rule out that the structs are empty. Also, let me post the whole file in this gist |
Also, I am running/compiling in ubuntu 16.04 with:
|
Hmm, interesting. So it seems definitely like a dupe of #442. Given the date you should have the fix in tree though, could you check just in case that updating |
I don't believe that the compiler fix is in stable (1.16.0) rust yet. |
That's right, closing this as a dupe of #442. Thanks both :) |
Input C/C++ Header
Bindgen Invokation
Actual Results
and
-->
Expected Results
I wasn't expecting the warning generated.
RUST_LOG=bindgen
OutputIt actually didn't change anything, but I it may be me running it wrong.
The project is here: https://github.com/siscia/rediSQL-rs and the C dependencies are here: https://github.com/siscia/rediSQL-rs/tree/master/src/CDeps/Redis
For anything please just let me know :)
The text was updated successfully, but these errors were encountered: