[llvm-branch-commits] [libcxx] 6f62347 - [libcxx] don't `#include <cwchar>` if wide chars aren't enabled (#99911)
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Sep 1 01:20:50 PDT 2024
Author: Ties Stuij
Date: 2024-09-01T10:20:37+02:00
New Revision: 6f623478d48c171d59e95b25ea2aca49dca8f135
URL: https://github.com/llvm/llvm-project/commit/6f623478d48c171d59e95b25ea2aca49dca8f135
DIFF: https://github.com/llvm/llvm-project/commit/6f623478d48c171d59e95b25ea2aca49dca8f135.diff
LOG: [libcxx] don't `#include <cwchar>` if wide chars aren't enabled (#99911)
Pull request #96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).
This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.
For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.
(cherry picked from commit ec56790c3b27df4fa1513594ca9a74fd8ad5bf7f)
Added:
Modified:
libcxx/include/format
Removed:
################################################################################
diff --git a/libcxx/include/format b/libcxx/include/format
index c3f2b45f0f7305..a88b3ef8528e2d 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -237,21 +237,21 @@ namespace std {
# include <cstdint>
# include <cstdlib>
# include <cstring>
-# include <cwchar>
# include <initializer_list>
# include <limits>
+# include <locale>
# include <new>
# include <optional>
+# include <queue>
+# include <stack>
# include <stdexcept>
# include <string>
# include <string_view>
# include <tuple>
-#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <locale>
-# include <queue>
-# include <stack>
+# if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+# include <cwchar>
+# endif
#endif
#endif // _LIBCPP_FORMAT
More information about the llvm-branch-commits
mailing list