[libcxx-commits] [PATCH] D151740: [libc++] Include "bits/alltypes.h" to provide mbstate_t when using musl libc

Pengxuan Zheng via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 30 13:17:29 PDT 2023


pzheng updated this revision to Diff 526764.
pzheng added a comment.

Add undef after include


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151740

Files:
  libcxx/include/__mbstate_t.h


Index: libcxx/include/__mbstate_t.h
===================================================================
--- libcxx/include/__mbstate_t.h
+++ libcxx/include/__mbstate_t.h
@@ -35,7 +35,11 @@
 #  define __CORRECT_ISO_CPP_WCHAR_H_PROTO
 #endif
 
-#if __has_include(<bits/types/mbstate_t.h>)
+#if defined(_LIBCPP_HAS_MUSL_LIBC)
+#   define __NEED_mbstate_t
+#   include <bits/alltypes.h>
+#   undef __NEED_mbstate_t
+#elif __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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151740.526764.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230530/43aa9e32/attachment.bin>


More information about the libcxx-commits mailing list