diff options
author | hiddenpath <hiddenpath@yandex-team.com> | 2024-02-21 23:16:42 +0300 |
---|---|---|
committer | hiddenpath <hiddenpath@yandex-team.com> | 2024-02-21 23:33:25 +0300 |
commit | 9052eb5cc304b8da8885fc4e3364ebddc16945f3 (patch) | |
tree | 3c252f6161dd0745c7732d74c9304c000645ab47 /contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h | |
parent | f5eb715f103692e7c7536e13bef3f281fd78e5e7 (diff) | |
download | ydb-9052eb5cc304b8da8885fc4e3364ebddc16945f3.tar.gz |
Update libcxx to llvmorg-17.0.6
Update libcxx to llvmorg-17.0.6
c871ef572c71b4fef22d4a9e65bcebc57e625aea
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h b/contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h index 487a6d092c..2b9e719b1f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h @@ -16,29 +16,39 @@ # pragma GCC system_header #endif -// TODO(ldionne): -// The goal of this header is to provide mbstate_t without having to pull in -// <wchar.h> or <uchar.h>. This is necessary because we need that type even -// when we don't have (or try to provide) support for wchar_t, because several -// types like std::fpos are defined in terms of mbstate_t. +// The goal of this header is to provide mbstate_t without requiring all of +// <uchar.h> or <wchar.h>. It's also used by the libc++ versions of <uchar.h> +// and <wchar.h> to get mbstate_t when the C library doesn't provide <uchar.h> +// or <wchar.h>, hence the #include_next of those headers instead of #include. +// (e.g. if <wchar.h> isn't present in the C library, the libc++ <wchar.h> +// will include this header. This header needs to not turn around and cyclically +// include <wchar.h>, but fall through to <uchar.h>.) // -// This is a gruesome hack, but I don't know how to make it cleaner for -// the time being. +// This does not define std::mbstate_t -- this only brings in the declaration +// in the global namespace. + +// We define this here to support older versions of glibc <wchar.h> that do +// not define this for clang. This is also set in libc++'s <wchar.h> header, +// and we need to do so here too to avoid a different function signature given +// a different include order. +#ifdef __cplusplus +# define __CORRECT_ISO_CPP_WCHAR_H_PROTO +#endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include <wchar.h> // for mbstate_t +#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 +#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>) +# include_next <wchar.h> // fall back to the C standard provider of mbstate_t +#elif __has_include_next(<uchar.h>) +# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible #else -# error "The library was configured without support for wide-characters, but we don't know how to get the definition of mbstate_t without <wchar.h> on your platform." +# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform." #endif -_LIBCPP_BEGIN_NAMESPACE_STD - -using ::mbstate_t _LIBCPP_USING_IF_EXISTS; - -_LIBCPP_END_NAMESPACE_STD - #endif // _LIBCPP___MBSTATE_T_H |