rust-bindgen
rust-bindgen copied to clipboard
some unknown generating when default value is set in c
here is my input structure.
typedef struct {
const char *base_path; /**< Mounting point. */
const char *partition_label; /**< Label of partition to use. */
uint8_t format_if_mount_failed:1; /**< Format the file system if it fails to mount. */
uint8_t dont_mount:1; /**< Don't attempt to mount or format. Overrides format_if_mount_failed */
} esp_vfs_littlefs_conf_t;
Bindgen Invocation
let builder = bindgen::Builder::default()
.use_core()
.layout_tests(false)
.rustfmt_bindings(false)
.derive_default(true)
.clang_arg("-D__bindgen")
// Include directories provided by the build system
// should be first on the search path (before sysroot includes),
// or else libc's <dirent.h> does not correctly override sysroot's <dirent.h>
.clang_args(&self.clang_args)
.clang_args(sysroot_args)
.clang_args(&["-x", if cpp { "c++" } else { "c" }])
.clang_args(cpp_args);
Actual Results
#[doc = "Configuration structure for esp_vfs_littlefs_register."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct esp_vfs_littlefs_conf_t {
#[doc = "< Mounting point."]
pub base_path: *const c_types::c_char,
#[doc = "< Label of partition to use."]
pub partition_label: *const c_types::c_char,
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub __bindgen_padding_0: [u8; 3usize],
}
Expected Results
#[doc = "Configuration structure for esp_vfs_littlefs_register."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct esp_vfs_littlefs_conf_t {
#[doc = "< Mounting point."]
pub base_path: *const c_types::c_char,
#[doc = "< Label of partition to use."]
pub partition_label: *const c_types::c_char,
#[doc = "< Format the file system if it fails to mount."]
pub format_if_mount_failed: u8,
#[doc = "< Don't attempt to mount or format. Overrides format_if_mount_failed"]
pub dont_mount: u8,
}
Thanks for your report. Would you be able to extend the bindgen invocation a bit so it can be tested locally?. In particular, the current invocation does not have the values for self.clang_args, sysroot_args, cpp and cpp_args.