[libcxx-commits] [PATCH] D68480: Implementation of C++20's P1135R6 for libcxx

JF Bastien via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 14:11:39 PST 2020


jfb added a comment.

In D68480#1894192 <https://reviews.llvm.org/D68480#1894192>, @leonardchan wrote:

> > @leonardchan @phosek Is there a way that you could add a libc++ builder that runs freestanding?
>
> We have it as a TODO but can bump it in priority.
>
> > Agreed, it seems like we want to figure out what individual freestanding subsets can "carve out" of regular C++, and how to do so cleanly. "time" seems like an easy thing to carve out, but it shouldn't just be done here, it should be part of the configuration header, applied consistently through libc++, and extensively tested. Ideally it wouldn't just be a builder: you'd have a directory which tests freestanding configuration options (i.e. "can I include atomic without time support?").
>
> How simple would it be to carve specifically time.h out? I'm unfamiliar with libcxx internals + configurations. I'm also not insisting that progress on this patch be halted, but I'd like to know if there's anything we could do at least now to provide a workaround for freestanding targets,


As a non-libc++ maintainer (so take what I say with some doubt), I'd imagine things being detected in `libcxx/include/__config`, say through `__has_include(time.h)`, and then you'd have a macro which says "no time". I'd then figure out the transitive inclusions of `time.h` in all libc++ headers, figure out want pulls them it, and use the macro to not expose the corresponding functions / types on those platforms.

You'd then need a decent amount of testing to make sure this works well.

Concretely here, there are a few atomic functions which require `chrono`, so you'd want to conditionally include `chrono` and conditionally define those functions. I think the patch which does this should also handle time in other libc++ headers, so we're not in a situation of "we kinda support having no `time.h`, but not consistently".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68480/new/

https://reviews.llvm.org/D68480





More information about the libcxx-commits mailing list