bearssl-sys: use bindgen's usize setting
* `bindgen` can now set size_t as usize. This should remove the annoying type definition.main
parent
8d5a9f7a16
commit
771f543cb5
|
@ -11,12 +11,6 @@ Currently BearSSL 0.6 and latest Rust stable is supported.
|
|||
* `bundled`: Build and link statically BearSSL. Needs a working C compiler and autoenables some sensible flags for the build target.
|
||||
* `dont-assume-size_t-equals-uintptr_t`: Use libc's `size_t` instead of `usize`. Should only needed when `sizeof(uintptr_t) != sizeof(size_t)`.
|
||||
|
||||
## Misc.
|
||||
|
||||
Once `core::ffi` types are stable, the bindings can and should be
|
||||
dependency-free for platforms where `dont-assume-size_t-equals-uintptr_t`
|
||||
isn't required.
|
||||
|
||||
## License
|
||||
|
||||
This repository is licensed under the BSD-3-Clause. Please refer to `LICENSE` and
|
||||
|
|
|
@ -5,6 +5,8 @@ use std::path::PathBuf;
|
|||
fn main() {
|
||||
linkage::configure();
|
||||
|
||||
let usize_equals_size_t = !cfg!(feature = "dont-assume-size_t-equals-uintptr_t");
|
||||
|
||||
let bindings = bindgen::builder()
|
||||
.use_core()
|
||||
.ctypes_prefix("::core::ffi")
|
||||
|
@ -17,6 +19,7 @@ fn main() {
|
|||
.blocklist_type("__.*_t")
|
||||
.blocklist_type("size_t")
|
||||
.generate_comments(false)
|
||||
.size_t_is_usize(usize_equals_size_t)
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
|
|
|
@ -15,7 +15,4 @@
|
|||
#[cfg(feature = "dont-assume-size_t-equals-uintptr_t")]
|
||||
use libc::size_t;
|
||||
|
||||
#[cfg(not(feature = "dont-assume-size_t-equals-uintptr_t"))]
|
||||
type size_t = usize;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
|
|
Loading…
Reference in New Issue