Partially support #[cfg]s on fields

This commit is contained in:
Yurii Rashkovskii
2019-04-08 14:24:52 +02:00
committed by Emilio Cobos Álvarez
parent dfcee869ba
commit 1963f0c92e
14 changed files with 113 additions and 1 deletions
+13
View File
@@ -40,6 +40,15 @@ struct BarHandle {
y: f32,
}
// FIXME(#634): Support deriving methods for structs with conditional fields.
/// cbindgen:derive-eq=false
/// cbindgen:derive-neq=false
#[repr(C)]
struct ConditionalField {
#[cfg(x11)]
field: i32,
}
#[cfg(all(unix, x11))]
#[no_mangle]
pub extern "C" fn root(a: FooHandle, c: C)
@@ -49,3 +58,7 @@ pub extern "C" fn root(a: FooHandle, c: C)
#[no_mangle]
pub extern "C" fn root(a: BarHandle, c: C)
{ }
#[no_mangle]
pub extern "C" fn cond(a: ConditionalField)
{ }