Closed
Description
Input C/C++ Header
#include "src/CDeps/Redis/include/redismodule.h"
#include "src/CDeps/Redis/include/export_redismodule.h"
Bindgen Invokation
#[derive(Debug)]
struct SqliteTypeChooser;
impl ParseCallbacks for SqliteTypeChooser {
fn int_macro(&self, _name: &str, value: i64) -> Option<IntKind> {
if value >= i32::min_value() as i64 &&
value <= i32::max_value() as i64 {
Some(IntKind::I32)
} else {
None
}
}
}
let bindings = bindgen::Builder::default()
.no_unstable_rust()
.parse_callbacks(Box::new(SqliteTypeChooser))
.header("wrapper.h")
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
Actual Results
and
extern "C" {
pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t)
-> ::std::os::raw::c_int;
}
extern "C" {
pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t)
-> ::std::os::raw::c_int;
}
warning: found non-foreign-function-safe member in struct marked #[repr(C)]: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type, #[warn(improper_ctypes)] on by default
--> /home/simo/rediSQL-rst/target/debug/build/rediSQL-rst-196441589fefb3b1/out/bindings.rs:5575:48
|
5575 | pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t)
| ^^^^^^^^^^^
warning: found non-foreign-function-safe member in struct marked #[repr(C)]: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type, #[warn(improper_ctypes)] on by default
--> /home/simo/rediSQL-rst/target/debug/build/rediSQL-rst-196441589fefb3b1/out/bindings.rs:5579:48
|
5579 | pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t)
| ^^^^^^^^^^^^^
-->
Expected Results
I wasn't expecting the warning generated.
RUST_LOG=bindgen
Output
It 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 :)
Metadata
Metadata
Assignees
Labels
No labels