xref: /freebsd/contrib/llvm-project/libcxx/include/__mbstate_t.h (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
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-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef _LIBCPP___MBSTATE_T_H
11 #define _LIBCPP___MBSTATE_T_H
12 
13 #include <__config>
14 
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #pragma GCC system_header
17 #endif
18 
19 // TODO(ldionne):
20 // The goal of this header is to provide mbstate_t without having to pull in
21 // <wchar.h> or <uchar.h>. This is necessary because we need that type even
22 // when we don't have (or try to provide) support for wchar_t, because several
23 // types like std::fpos are defined in terms of mbstate_t.
24 //
25 // This is a gruesome hack, but I don't know how to make it cleaner for
26 // the time being.
27 
28 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
29 #   include <wchar.h> // for mbstate_t
30 #elif __has_include(<bits/types/mbstate_t.h>)
31 #   include <bits/types/mbstate_t.h> // works on most Unixes
32 #elif __has_include(<sys/_types/_mbstate_t.h>)
33 #   include <sys/_types/_mbstate_t.h> // works on Darwin
34 #else
35 #   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."
36 #endif
37 
38 _LIBCPP_BEGIN_NAMESPACE_STD
39 
40 using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
41 
42 _LIBCPP_END_NAMESPACE_STD
43 
44 #endif // _LIBCPP___MBSTATE_T_H
45