[libcxx-commits] [libcxx] [libc++] Update `__mbstate_t.h` to include path to Android's `mbstate_t.h` (PR #192307)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 15 11:34:08 PDT 2026
https://github.com/finagolfin created https://github.com/llvm/llvm-project/pull/192307
Ever since ce4ac9945 started including `__mbstate_t.h` in this C++ `wchar.h`, the Android NDK sees redefinition errors, likely because this Android `mbstate_t.h` was not included. @enh-google suggested this inclusion to fix it, and it worked for me in my local testing: see swiftlang/swift#85365 for the errors and more info.
>From 43543fa283128c3e6cbee4515ff6d0ac62d46856 Mon Sep 17 00:00:00 2001
From: Finagolfin <finagolfin at tuta.io>
Date: Wed, 15 Apr 2026 21:21:35 +0530
Subject: [PATCH] [libc++] Update `__mbstate_t.h` to include path to Android's
`mbstate_t.h`
Ever since ce4ac9945 started including `__mbstate_t.h` in this C++ `wchar.h`,
the Android NDK sees redefinition errors, likely because this Android
`mbstate_t.h` was not included. @enh-google suggested this inclusion to fix it,
and it worked for me in my local testing: see swiftlang/swift#85365 for the
errors and more info.
---
libcxx/include/__mbstate_t.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
index c23ea7113ca70..d331ba622d37f 100644
--- a/libcxx/include/__mbstate_t.h
+++ b/libcxx/include/__mbstate_t.h
@@ -43,6 +43,8 @@
# 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 __has_include(<bits/mbstate_t.h>)
+# include <bits/mbstate_t.h> // works for Android
#elif __has_include_next(<wchar.h>)
# include_next <wchar.h> // use the C standard provider of mbstate_t if present
#elif __has_include_next(<uchar.h>)
More information about the libcxx-commits
mailing list