Support an annotation for generating bitfield sizes in C code (: SIZE)

Closes #609
Closes #611
This commit is contained in:
Vadim Petrochenkov
2020-10-27 01:51:31 +03:00
committed by Emilio Cobos Álvarez
parent dc12952e19
commit a689bcabc7
12 changed files with 139 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "bitfield"
version = "0.1.0"
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "bitfield"
version = "0.1.0"
authors = ["cbindgen"]
[features]
cbindgen = []
+3
View File
@@ -0,0 +1,3 @@
[parse.expand]
crates = ["bitfield"]
features = ["cbindgen"]
+15
View File
@@ -0,0 +1,15 @@
#[repr(C)]
pub struct HasBitfields {
#[cfg(not(feature = "cbindgen"))]
foo_and_bar: u64,
#[cfg(feature = "cbindgen")]
/// cbindgen:bitfield=8
foo: u64,
#[cfg(feature = "cbindgen")]
/// cbindgen:bitfield=56
bar: u64,
}
#[no_mangle]
pub extern "C" fn root(_: &HasBitfields) {}