Open youknowone opened 1 month ago
source (x.rs):
#[repr(C)] pub struct Foo { a: i32, #[cfg(feature = "feat")] b: i32, } impl Foo { pub const ZEROED: Self = Self { a: 0, #[cfg(feature = "feat")] b: 0, }; }
cbindgen.toml:
[export] include=["Foo"] [defines] "feature = feat" = "FEAT"
command:
cbindgen --config cbindgen.toml x.rs
actual result:
#include <cstdarg> #include <cstdint> #include <cstdlib> #include <ostream> #include <new> struct Foo { int32_t a; #if defined(FEAT) int32_t b #endif ; }; constexpr static const Foo Foo_ZEROED = Foo{ /* .a = */ 0, /* .b = */ 0 };
expected result:
#include <cstdarg> #include <cstdint> #include <cstdlib> #include <ostream> #include <new> struct Foo { int32_t a; #if defined(FEAT) int32_t b #endif ; }; constexpr static const Foo Foo_ZEROED = Foo{ /* .a = */ 0, #if defined(FEAT) /* .b = */ 0 #endif };
maybe related to #937
source (x.rs):
cbindgen.toml:
command:
actual result:
expected result: