Skip to content

Commit

Permalink
[libcxx] don't #include <cwchar> if wide chars aren't enabled (llvm…
Browse files Browse the repository at this point in the history
…#99911)

Pull request llvm#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.
  • Loading branch information
stuij authored and sgundapa committed Jul 23, 2024
1 parent 9209c25 commit 6cef597
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libcxx/include/format
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6cef597

Please sign in to comment.