[libc++] cuchar redeclares ::mbstate_t when it's in its own clang module
authorIan Anderson <iana@apple.com>
Mon, 17 Apr 2023 16:38:38 +0000 (09:38 -0700)
committerIan Anderson <iana@apple.com>
Mon, 1 May 2023 18:48:20 +0000 (13:48 -0500)
commita595b931f1f91897317a4257df313bddfeb029a6
tree6fb5a55c80821d3707f8f842966d7eae3d327f6d
parent7f3b0e584513611bb1d804892eb269ae45d8e715
[libc++] cuchar redeclares ::mbstate_t when it's in its own clang module

When cuchar is compiled independently on platforms that don't have <uchar.h>, it doesn't get a declaration of mbstate_t, and so makes an empty declaration for ::mbstate_t. That conflicts with the declarations in __mbstate_t.h and cwchar since both of those headers do get mbstate_t before making ::mbstate_t.

Change `__mbstate_t.h` to just get the underlying declaration for mbstate_t and not make a declaration for ::mbstate_t. Include __mbstate_t.h in uchar.h and wchar.h when their next headers aren't available so that at least mbstate_t gets defined.

Add __std_mbstate_t.h to declare ::mbstate_t for headers that need that when cuchar or cwchar aren't available (because either _LIBCPP_HAS_NO_WIDE_CHARACTERS or _LIBCPP_CXX03_LANG).

Reviewed By: ldionne, Mordante, #libc, philnik

Differential Revision: https://reviews.llvm.org/D148542
libcxx/include/CMakeLists.txt
libcxx/include/__locale
libcxx/include/__mbstate_t.h
libcxx/include/__std_mbstate_t.h [new file with mode: 0644]
libcxx/include/iosfwd
libcxx/include/module.modulemap.in
libcxx/include/uchar.h
libcxx/include/wchar.h
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/utils/generate_iwyu_mapping.py