[libc-commits] [libc] [libc] Provide an implementation of the 'stdint.h' header (PR #83353)

via libc-commits libc-commits at lists.llvm.org
Wed Feb 28 15:55:14 PST 2024


lntue wrote:

> > We probably need to be careful with this change. I'm nervous if stdint.h from clang is 100% the same for different architectures?
> 
> This is the same handling clang uses for all its targets, if you do `-ffreestanding` on your target you'll get this implementation so it's expected to work for all architectures clang supports I'd say.
> 
> > I do worry about `#include_next` as I highly suspect it's behavior is non-deterministic in the face of `-I` (or perhaps `-isystem`) flags.
> 
> This does not use the `include_next` part, that's handled in clang.
> 
> > If we did do this change, I think we could+should replace our `#include <stdint.h>` with including our stdint.h.
> > ```shell
> > $ grep -rn '<stdint' libc | wc -l
> > 208
> > ```
> 
> If we replaced this it would have equivalent behavior to compiling with `clang -ffreestanding`.

For those completely independent headers like this, it would be actually easier to provide our own complete freestanding headers.  It might actually be easier to add support for other platforms when we can control these ourselves.

On the other hands, now we also have `uint24_t, uint48_t, uint56_t`, but still not `uint128_t` [[sad face]].

https://github.com/llvm/llvm-project/pull/83353


More information about the libc-commits mailing list