__mbstate_t.h 1.5 KB

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