Input C/C++ Header
#include <stddef.h>
nullptr_t ident(nullptr_t p);
int is_null(nullptr_t p);
Bindgen Invocation
$ bindgen input.h --no-rustfmt-bindings --output bindings.rs -- -std=c23
Actual Results
bindgen exits 0 and emits uses of nullptr_t without defining it:
pub type wchar_t = ::std::os::raw::c_int;
pub type max_align_t = f64;
unsafe extern "C" {
pub fn ident(p: nullptr_t) -> nullptr_t;
}
unsafe extern "C" {
pub fn is_null(p: nullptr_t) -> ::std::os::raw::c_int;
}
rustc then fails:
error[E0425]: cannot find type `nullptr_t` in this scope
clang's AST does have the type (BuiltinType 'nullptr_t', plus the stddef.h typedef). Layout is pointer-sized.
Expected Results
Either:
- emit a Rust alias for
nullptr_t (for example *const c_void, which matches the pointer-sized builtin), or
- skip these declarations instead of generating code that does not compile.
Environment
bindgen release: 0.72.1
clang: Apple clang 21.0.0 (also reproduced with clang 18 on x86_64-linux)
rustc: 1.97.1
target: aarch64-apple-darwin
Input C/C++ Header
Bindgen Invocation
$ bindgen input.h --no-rustfmt-bindings --output bindings.rs -- -std=c23Actual Results
bindgen exits 0 and emits uses of
nullptr_twithout defining it:rustcthen fails:clang's AST does have the type (
BuiltinType 'nullptr_t', plus thestddef.htypedef). Layout is pointer-sized.Expected Results
Either:
nullptr_t(for example*const c_void, which matches the pointer-sized builtin), orEnvironment