Path: blob/main/contrib/llvm-project/libcxx/include/__mbstate_t.h
35154 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___MBSTATE_T_H10#define _LIBCPP___MBSTATE_T_H1112#include <__config>1314#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)15# pragma GCC system_header16#endif1718// The goal of this header is to provide mbstate_t without requiring all of19// <uchar.h> or <wchar.h>. It's also used by the libc++ versions of <uchar.h>20// and <wchar.h> to get mbstate_t when the C library doesn't provide <uchar.h>21// or <wchar.h>, hence the #include_next of those headers instead of #include.22// (e.g. if <wchar.h> isn't present in the C library, the libc++ <wchar.h>23// will include this header. This header needs to not turn around and cyclically24// include <wchar.h>, but fall through to <uchar.h>.)25//26// This does not define std::mbstate_t -- this only brings in the declaration27// in the global namespace.2829// We define this here to support older versions of glibc <wchar.h> that do30// not define this for clang. This is also set in libc++'s <wchar.h> header,31// and we need to do so here too to avoid a different function signature given32// a different include order.33#ifdef __cplusplus34# define __CORRECT_ISO_CPP_WCHAR_H_PROTO35#endif3637#if defined(_LIBCPP_HAS_MUSL_LIBC)38# define __NEED_mbstate_t39# include <bits/alltypes.h>40# undef __NEED_mbstate_t41#elif __has_include(<bits/types/mbstate_t.h>)42# include <bits/types/mbstate_t.h> // works on most Unixes43#elif __has_include(<sys/_types/_mbstate_t.h>)44# include <sys/_types/_mbstate_t.h> // works on Darwin45#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)46# include_next <wchar.h> // fall back to the C standard provider of mbstate_t47#elif __has_include_next(<uchar.h>)48# include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible49#else50# error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."51#endif5253#endif // _LIBCPP___MBSTATE_T_H545556