[rust] adjust bindgen imports.

- only import functions from the notcurses public API
- exclude more unneeded types from being imported.
- use custom `__va_list_tag`
This commit is contained in:
joseLuís 2021-05-06 14:10:46 +02:00
parent 66e20bdac8
commit 7e7082e836
2 changed files with 13 additions and 5 deletions

View File

@ -30,10 +30,18 @@ fn main() {
.generate_comments(true) .generate_comments(true)
.clang_arg("-fretain-comments-from-system-headers") .clang_arg("-fretain-comments-from-system-headers")
.clang_arg("-fparse-all-comments") .clang_arg("-fparse-all-comments")
// Remove warnings about improper_ctypes // only import functions from notcurses public API
.blacklist_function("strtold") .blacklist_function("[^n].*")
.blacklist_function("wcstold") .blacklist_function("n[^co].*")
.blacklist_function("socketpair") // clean more unneeded types
.blacklist_item("_[A-FHJ-Z].*")
.blacklist_item("__[A-Z].*")
.blacklist_item("[ADHJ-MQ-Z].*")
.blacklist_item("IP[^R].*")
.blacklist_item("PF.*")
.blacklist_item("MSG_.*")
.blacklist_item("N[^C].*")
.blacklist_type("_bindgen.*")
// Don't derive the Copy trait on types with destructors. // Don't derive the Copy trait on types with destructors.
.no_copy("ncdirect") .no_copy("ncdirect")
.no_copy("ncdplot") .no_copy("ncdplot")

View File

@ -2,7 +2,7 @@
use core::ptr::null_mut; use core::ptr::null_mut;
use crate::ffi::__va_list_tag; use crate::__va_list_tag;
use crate::{ use crate::{
cstring, nccell_release, NcAlign, NcAlphaBits, NcBoxMask, NcCell, NcChannel, NcChannelPair, cstring, nccell_release, NcAlign, NcAlphaBits, NcBoxMask, NcCell, NcChannel, NcChannelPair,
NcColor, NcDim, NcEgc, NcIntResult, NcPlane, NcRgb, NcStyleMask, NCRESULT_ERR, NCRESULT_OK, NcColor, NcDim, NcEgc, NcIntResult, NcPlane, NcRgb, NcStyleMask, NCRESULT_ERR, NCRESULT_OK,