[clang] [Headers] Don't declare unreachable() from stddef.h in C++ (PR #86748)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 09:07:16 PDT 2024


ldionne wrote:

> > Why do the Clang builtin headers even try to define this? Shouldn't this be provided by the platform's C library instead? I am really confused about what's the intended layering here and it seems to me like Clang is overstepping its responsibilities by basically implementing parts of the C library.
> 
> I did that in [a9797d7](https://github.com/llvm/llvm-project/commit/a9797d7d2d7878464868312e0c147b4e747a31c6)
> 
> It's a freestanding feature in C23, so we need to expose it from `stddef.h` at least when not in hosted builds. I don't understand why this is making into C++ builds at all:

Thanks for the explanation. I think I don't understand the relationship between that feature being freestanding and the fact that it's implemented in the Clang builtin headers. I might be misunderstanding (or just ignorant of) the Clang approach for freestanding in C. Doesn't Clang still rely on there being a C library even in Freestanding mode?

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


More information about the cfe-commits mailing list