[clang] [Headers] Don't declare unreachable() from stddef.h in C++ (PR #86748)
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 28 12:28:58 PDT 2024
ldionne wrote:
Thanks for the explanation, @AaronBallman . I think I am generally deeply confused about what should be provided by the compiler and what should be provided by the C Standard Library on any given platform. From your reply, it looks like there's no clear rule and Clang basically provides anything that seems "easy enough" to provide. I still don't understand how that works in case you do end up including a header from the platform that (re)defines `unreachable`, for example.
The same problem also applies today to e.g. `size_t` and anything else provided by the Clang builtin headers. If a platform decides to define `size_t` differently than what the Clang builtin headers define it to, I guess we run into issues? I assume it's not something that happens often because it's pretty unambiguous what these typedefs should be, but still.
Anyway, this might turn out to be nothing more than a documentation issue, but in any case I think it would be valuable to write down how this is intended to work somewhere (even if only in a comment), since I suspect it's not clear to most people. I work on the C++ Standard Library and I don't understand how this works in our own implementation :-)
https://github.com/llvm/llvm-project/pull/86748
More information about the cfe-commits
mailing list