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

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 08:54:15 PST 2024


jhuber6 wrote:

> `-ffreestanding` is more than just `<stdint.h>`; llvm will elide libcall optimizations.

I mostly meant this quite literally, if you include `clang/lib/Headers/stdint.h` without `__STDC_HOSTED__` set, you will literally get the header I have copied here. This is the behavior when compiling with `-ffreestanding` for this header, which means that there is no behavioral change at least for `clang`.

> Also, looking at [72ce629](https://github.com/llvm/llvm-project/commit/72ce6294157964042b7ed5576ce2c99257eeea9d), I wonder if this PR should be updating libc/spec/stdc.td in a similar manner?

Yeah, likely should be added. My original intention was to provide this in the install without using it internally. I personally don't think there is a large benefit to using it internally because `stdint.h` is pretty well defined with `-ffreestanding` enabled like we use now.

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


More information about the llvm-commits mailing list