[PATCH] D144889: [C2x] Support <string.h> in freestanding
Ben Craig via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 27 11:34:59 PST 2023
bcraig added a comment.
A freestanding implementation doesn't necessarily mean that everything is header-only. It's fine to require linking against a (freestanding) C runtime library. All header-only is fine too though, if you want to make that work.
Architecturally, I don't feel it is required that Clang be the location of all the freestanding headers for C. I think that's fine for the C library in the final toolchain to own those headers. I'm not super familiar with what interface contracts you have between the clang-provided C headers and the C-library provided C headers though.
> I'm not sure it makes sense to provide a "freestanding" strtok; it requires global state.
I agree with this, but the C committee felt otherwise. C++26 freestanding is most likely including strtok too, to stay consistent with C (the freestanding C library paper is through LWG and awaiting a C++26 plenary vote). It shouldn't be hard to implement in an OS-independent way, but it will be a low quality implementation with cross-thread races.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144889/new/
https://reviews.llvm.org/D144889
More information about the cfe-commits
mailing list