Re: [PATCH 1/5] rust: fix size_t in bindgen prototypes of C builtins

From: Gary Guo
Date: Sat Oct 05 2024 - 18:11:06 EST


On Sun, 29 Sep 2024 17:00:29 -0400
Trevor Gross <tmgross@xxxxxxxxx> wrote:

> On Fri, Sep 13, 2024 at 5:32 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> > -bindgen_c_flags_final = $(bindgen_c_flags_lto) -D__BINDGEN__
> > +# `-fno-builtin` is passed to avoid bindgen from using clang builtin prototypes
> > +# for functions like `memcpy` -- if this flag is not passed, bindgen-generated
> > +# prototypes use `c_ulong` or `c_uint` depending on architecture instead of
> > +# generating `usize`.
> > +bindgen_c_flags_final = $(bindgen_c_flags_lto) -fno-builtin -D__BINDGEN__
>
> I wonder how reliable this behavior is. Maybe bindgen could do a
> better job controlling this, is there an open issue?
>
> - Trevor

I didn't search for bindgen issues when made this change, but
apparently this is indeed the suggested approach in
https://github.com/rust-lang/rust-bindgen/issues/1770

Best,
Gary