[libcxx-commits] [PATCH] D148542: [libc++] cuchar redeclares ::mbstate_t
Ian Anderson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 19 14:06:27 PDT 2023
iana updated this revision to Diff 515086.
iana added a comment.
Redo the fix to make the libc++ uchar.h try harder to find mbstate_t.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148542/new/
https://reviews.llvm.org/D148542
Files:
libcxx/include/uchar.h
Index: libcxx/include/uchar.h
===================================================================
--- libcxx/include/uchar.h
+++ libcxx/include/uchar.h
@@ -41,12 +41,23 @@
#if !defined(_LIBCPP_CXX03_LANG)
// Some platforms don't implement <uchar.h> and we don't want to give a hard
-// error on those platforms. When the platform doesn't provide <uchar.h>, at
-// least include <stddef.h> so we get the declaration for size_t.
+// error on those platforms.
#if __has_include_next(<uchar.h>)
# include_next <uchar.h>
#else
+// When the platform doesn't provide <uchar.h>, try to get the declaration
+// for mbstate_t.
+# if __has_include(<bits/types/mbstate_t.h>)
+# include <bits/types/mbstate_t.h> // works on most Unixes
+# elif __has_include(<sys/_types/_mbstate_t.h>)
+# include <sys/_types/_mbstate_t.h> // works on Darwin
+# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+# include_next <wchar.h>
+#endif
+
+// Get the declaration for size_t.
# include <stddef.h>
+
#endif
#endif // _LIBCPP_CXX03_LANG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148542.515086.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230419/4e9491a8/attachment.bin>
More information about the libcxx-commits
mailing list