Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:14:08

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___MBSTATE_T_H
0011 #define _LIBCPP___MBSTATE_T_H
0012 
0013 #include <__config>
0014 
0015 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0016 #  pragma GCC system_header
0017 #endif
0018 
0019 // The goal of this header is to provide mbstate_t without requiring all of
0020 // <uchar.h> or <wchar.h>. It's also used by the libc++ versions of <uchar.h>
0021 // and <wchar.h> to get mbstate_t when the C library doesn't provide <uchar.h>
0022 // or <wchar.h>, hence the #include_next of those headers instead of #include.
0023 // (e.g. if <wchar.h> isn't present in the C library, the libc++ <wchar.h>
0024 // will include this header. This header needs to not turn around and cyclically
0025 // include <wchar.h>, but fall through to <uchar.h>.)
0026 //
0027 // This does not define std::mbstate_t -- this only brings in the declaration
0028 // in the global namespace.
0029 
0030 // We define this here to support older versions of glibc <wchar.h> that do
0031 // not define this for clang. This is also set in libc++'s <wchar.h> header,
0032 // and we need to do so here too to avoid a different function signature given
0033 // a different include order.
0034 #ifdef __cplusplus
0035 #  define __CORRECT_ISO_CPP_WCHAR_H_PROTO
0036 #endif
0037 
0038 #if _LIBCPP_HAS_MUSL_LIBC
0039 #  define __NEED_mbstate_t
0040 #  include <bits/alltypes.h>
0041 #  undef __NEED_mbstate_t
0042 #elif __has_include(<bits/types/mbstate_t.h>)
0043 #  include <bits/types/mbstate_t.h> // works on most Unixes
0044 #elif __has_include(<sys/_types/_mbstate_t.h>)
0045 #  include <sys/_types/_mbstate_t.h> // works on Darwin
0046 #elif _LIBCPP_HAS_WIDE_CHARACTERS && __has_include_next(<wchar.h>)
0047 #  include_next <wchar.h> // fall back to the C standard provider of mbstate_t
0048 #elif __has_include_next(<uchar.h>)
0049 #  include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible
0050 #else
0051 #  error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
0052 #endif
0053 
0054 #endif // _LIBCPP___MBSTATE_T_H