[libcxx-commits] [PATCH] D97870: [libc++] Add missing header <cuchar>

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 5 12:12:53 PDT 2021


ldionne marked an inline comment as done.
ldionne added a comment.

In D97870#2607828 <https://reviews.llvm.org/D97870#2607828>, @curdeius wrote:

> I see from the build failures that char16_t typedefs should be guarded not to conflict with C++ built-in types. At least for glibc the solution will be to define `__USE_ISOCXX11`, cf. https://sourceware.org/git/?p=glibc.git;a=blob;f=wcsmbs/uchar.h;h=6020f66cf6d27d86d78213c3efdf17a9e52f45e7;hb=HEAD.

So the root cause of the issue here is that libc++ tries to define its own `char16_t` type inside `__config` in C++03 mode (those types were added in C++11). If we didn't try to provide those as extensions in C++03 mode, we wouldn't hit this issue.

Since I don't think it's going to be easy to stop providing those in C++03 mode, instead what I'll do is mark `<cuchar>` and `<uchar.h>` as unsupported in C++03 mode. Those headers were added in C++11, so it seems reasonable if they don't work as intended in C++03.

> Other thing, with this patch you add cuchar header, but there is no intermediate uchar.h in libc++ as it's done for other headers (which then #include_next their C library equivalent). I guess that it should be added here and it will probably be the place to define the aforementioned macro guard.

I added `uchar.h`, thanks for the catch. TBH, I'm not a big fan of defining headers that should be provided by the underlying C library, however we do it for all other libc++ headers, so let's do it for consistency if nothing else.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97870



More information about the libcxx-commits mailing list