[libcxx-commits] [PATCH] D148542: [libc++] cuchar redeclares ::mbstate_t when it's in its own clang module
Ian Anderson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 25 12:23:15 PDT 2023
iana added inline comments.
================
Comment at: libcxx/include/uchar.h:49
+// When the platform doesn't provide <uchar.h>, try to get the declaration
+// for mbstate_t.
+# if __has_include(<bits/types/mbstate_t.h>)
----------------
ldionne wrote:
> Shouldn't we include `__mbstate_t.h` instead? Then we can tweak what that header does as needed to avoid including `wchar.h` from it unconditionally, perhaps?
The problem with including `__mbstate_t.h` here is it adds `::mbstate_t` which I don't think we want in the C header. I was originally doing that in `cuchar`, but then that was kind of weird because it would declare `::mbstate_t` all the time when the rest of the file is gated on `_LIBCPP_CXX03_LANG`. People thought it was weird to conditionally include `__mbstate_t.h` in `cuchar` too. Also `__mbstate_t.h` starts off trying to include all of `wchar.h` which seems counter to the comment at its top?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148542/new/
https://reviews.llvm.org/D148542
More information about the libcxx-commits
mailing list