brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 6c7cfaa Raw
55 lines · c
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___CXX03___MBSTATE_T_H11#define _LIBCPP___CXX03___MBSTATE_T_H12 13#include <__cxx03/__config>14 15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16#  pragma GCC system_header17#endif18 19// The goal of this header is to provide mbstate_t without requiring all of20// <uchar.h> or <wchar.h>. It's also used by the libc++ versions of <uchar.h>21// and <wchar.h> to get mbstate_t when the C library doesn't provide <uchar.h>22// or <wchar.h>, hence the #include_next of those headers instead of #include.23// (e.g. if <wchar.h> isn't present in the C library, the libc++ <wchar.h>24// will include this header. This header needs to not turn around and cyclically25// include <__cxx03/wchar.h>, but fall through to <uchar.h>.)26//27// This does not define std::mbstate_t -- this only brings in the declaration28// in the global namespace.29 30// We define this here to support older versions of glibc <wchar.h> that do31// not define this for clang. This is also set in libc++'s <wchar.h> header,32// and we need to do so here too to avoid a different function signature given33// a different include order.34#ifdef __cplusplus35#  define __CORRECT_ISO_CPP_WCHAR_H_PROTO36#endif37 38#if defined(_LIBCPP_HAS_MUSL_LIBC)39#  define __NEED_mbstate_t40#  include <bits/alltypes.h>41#  undef __NEED_mbstate_t42#elif __has_include(<bits/types/mbstate_t.h>)43#  include <bits/types/mbstate_t.h> // works on most Unixes44#elif __has_include(<sys/_types/_mbstate_t.h>)45#  include <sys/_types/_mbstate_t.h> // works on Darwin46#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)47#  include_next <wchar.h> // fall back to the C standard provider of mbstate_t48#elif __has_include_next(<uchar.h>)49#  include_next <uchar.h> // <uchar.h> is also required to make mbstate_t visible50#else51#  error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."52#endif53 54#endif // _LIBCPP___CXX03___MBSTATE_T_H55