[libc++] Add an option to disable wide character support in libc++

Some embedded platforms do not wish to support the C library functionality
for handling wchar_t because they have no use for it. It makes sense for
libc++ to work properly on those platforms, so this commit adds a carve-out
of functionality for wchar_t.

Unfortunately, unlike some other carve-outs (e.g. random device), this
patch touches several parts of the library. However, despite the wide
impact of this patch, I still think it is important to support this
configuration since it makes it much simpler to port libc++ to some
embedded platforms.

Differential Revision: https://reviews.llvm.org/D111265
This commit is contained in:
Louis Dionne
2021-08-23 15:32:36 -04:00
parent c6828e0cea
commit f4c1258d56
612 changed files with 3833 additions and 1633 deletions

View File

@@ -120,6 +120,12 @@ option(LIBCXX_ENABLE_UNICODE
"Whether to include support for Unicode in the library. Disabling Unicode can
be useful when porting to platforms that don't support UTF-8 encoding (e.g.
embedded)." ON)
option(LIBCXX_ENABLE_WIDE_CHARACTERS
"Whether to include support for wide characters in the library. Disabling
wide character support can be useful when porting to platforms that don't
support the C functionality for wide characters. When wide characters are
not supported, several parts of the library will be disabled, notably the
wide character specializations of std::basic_string." ON)
option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
"Whether to turn on vendor availability annotations on declarations that depend
on definitions in a shared library. By default, we assume that we're not building
@@ -893,6 +899,7 @@ config_define_if_not(LIBCXX_ENABLE_FILESYSTEM _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE)
config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
# Incomplete features get their own specific disabling flags. This makes it
# easier to grep for target specific flags once the feature is complete.

View File

@@ -0,0 +1 @@
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")

View File

@@ -251,6 +251,15 @@ libc++ specific options
This option can be used to enable or disable the filesystem components on
platforms that may not support them. For example on Windows when using MSVC.
.. option:: LIBCXX_ENABLE_WIDE_CHARACTERS:BOOL
**Default**: ``ON``
This option can be used to disable support for ``wchar_t`` in the library. It also
allows the library to work on top of a C Standard Library that does not provide
support for ``wchar_t``. This is especially useful in embedded settings where
C Standard Libraries don't always provide all the usual bells and whistles.
.. option:: LIBCXX_ENABLE_INCOMPLETE_FEATURES:BOOL
**Default**: ``ON``

View File

@@ -49,7 +49,9 @@ New Features
API Changes
-----------
- ...
- Support for building libc++ on top of a C Standard Library that does not support ``wchar_t`` was
added. This is useful for building libc++ in an embedded setting, and it adds itself to the various
freestanding-friendly options provided by libc++.
Build System Changes
--------------------

View File

@@ -211,6 +211,7 @@ set(files
__iterator/wrap_iter.h
__libcpp_version
__locale
__mbstate_t.h
__memory/addressof.h
__memory/allocation_guard.h
__memory/allocator_arg_t.h

View File

@@ -463,7 +463,9 @@ __sort(_Tp** __first, _Tp** __last, __less<_Tp*>&)
}
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
#endif
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<short>&, short*>(short*, short*, __less<short>&))
@@ -479,7 +481,9 @@ _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(d
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&))
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
#endif
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&))

View File

@@ -30,6 +30,7 @@ decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
return MB_CUR_MAX;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_INLINE_VISIBILITY
wint_t __libcpp_btowc_l(int __c, locale_t __l)
{
@@ -88,6 +89,7 @@ size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t
__libcpp_locale_guard __current(__l);
return mbrlen(__s, __n, __ps);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_INLINE_VISIBILITY
lconv *__libcpp_localeconv_l(locale_t __l)
@@ -96,6 +98,7 @@ lconv *__libcpp_localeconv_l(locale_t __l)
return localeconv();
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_INLINE_VISIBILITY
size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
mbstate_t *__ps, locale_t __l)
@@ -103,6 +106,7 @@ size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
__libcpp_locale_guard __current(__l);
return mbsrtowcs(__dest, __src, __len, __ps);
}
#endif
inline
int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {

View File

@@ -1241,6 +1241,16 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_PREFERRED_NAME(x)
#endif
// We often repeat things just for handling wide characters in the library.
// When wide characters are disabled, it can be useful to have a quick way of
// disabling it without having to resort to #if-#endif, which has a larger
// impact on readability.
#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
# define _LIBCPP_IF_WIDE_CHARACTERS(...)
#else
# define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__
#endif
#if defined(_LIBCPP_ABI_MICROSOFT) && \
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)

View File

@@ -30,6 +30,7 @@
#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS
#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
#cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS
#cmakedefine _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#cmakedefine _LIBCPP_HAS_NO_INCOMPLETE_RANGES

View File

@@ -146,8 +146,9 @@ private:
// (such as a span<charT>) and polymorphic reallocation. - end note]
using format_context = basic_format_context<back_insert_iterator<string>, char>;
using wformat_context =
basic_format_context<back_insert_iterator<wstring>, wchar_t>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_context = basic_format_context<back_insert_iterator<wstring>, wchar_t>;
#endif
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)

View File

@@ -96,7 +96,9 @@ private:
};
using format_parse_context = basic_format_parse_context<char>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_parse_context = basic_format_parse_context<wchar_t>;
#endif
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)

View File

@@ -85,11 +85,13 @@ struct _LIBCPP_TEMPLATE_VIS __bool_strings<char> {
static constexpr string_view __false{"false"};
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
struct _LIBCPP_TEMPLATE_VIS __bool_strings<wchar_t> {
static constexpr wstring_view __true{L"true"};
static constexpr wstring_view __false{L"false"};
};
#endif
template <class _CharT>
using __formatter_bool = __formatter_integral<__parser_bool<_CharT>>;

View File

@@ -78,6 +78,7 @@ template <>
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<char, char>
: public __format_spec::__formatter_char<char> {};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<char, wchar_t>
: public __format_spec::__formatter_char<wchar_t> {
@@ -93,7 +94,7 @@ template <>
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
formatter<wchar_t, wchar_t>
: public __format_spec::__formatter_char<wchar_t> {};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
#endif //_LIBCPP_STD_VER > 17

View File

@@ -561,6 +561,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
@@ -576,6 +577,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
_LIBCPP_INLINE_VISIBILITY
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>

View File

@@ -338,7 +338,9 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
#endif
// template <class CharT> class collate_byname;
@@ -363,6 +365,7 @@ protected:
virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
: public collate<wchar_t>
@@ -382,6 +385,7 @@ protected:
const char_type* __lo2, const char_type* __hi2) const;
virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
};
#endif
template <class _CharT, class _Traits, class _Allocator>
bool
@@ -516,6 +520,7 @@ public:
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS ctype<wchar_t>
: public locale::facet,
@@ -617,6 +622,7 @@ protected:
virtual char do_narrow(char_type, char __dfault) const;
virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS ctype<char>
@@ -761,6 +767,7 @@ protected:
virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
: public ctype<wchar_t>
@@ -786,6 +793,7 @@ protected:
virtual char do_narrow(char_type, char __dfault) const;
virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
@@ -992,6 +1000,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
: public locale::facet,
@@ -1072,6 +1081,7 @@ protected:
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const _NOEXCEPT;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
@@ -1450,7 +1460,9 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
_LIBCPP_SUPPRESS_DEPRECATED_POP
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
#endif
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20
#ifndef _LIBCPP_HAS_NO_CHAR8_T
@@ -1681,6 +1693,7 @@ protected:
string __grouping_;
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS numpunct<wchar_t>
: public locale::facet
@@ -1711,6 +1724,7 @@ protected:
char_type __thousands_sep_;
string __grouping_;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// template <class charT> class numpunct_byname
@@ -1734,6 +1748,7 @@ private:
void __init(const char*);
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
: public numpunct<wchar_t>
@@ -1751,6 +1766,7 @@ protected:
private:
void __init(const char*);
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_END_NAMESPACE_STD

View File

@@ -0,0 +1,44 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___MBSTATE_T_H
#define _LIBCPP___MBSTATE_T_H
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
// TODO(ldionne):
// The goal of this header is to provide mbstate_t without having to pull in
// <wchar.h> or <uchar.h>. This is necessary because we need that type even
// when we don't have (or try to provide) support for wchar_t, because several
// types like std::fpos are defined in terms of mbstate_t.
//
// This is a gruesome hack, but I don't know how to make it cleaner for
// the time being.
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wchar.h> // for mbstate_t
#elif __has_include(<bits/types/mbstate_t.h>)
# include <bits/types/mbstate_t.h> // works on most Unixes
#elif __has_include(<sys/_types/_mbstate_t.h>)
# include <sys/_types/_mbstate_t.h> // works on Darwin
#else
# 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."
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___MBSTATE_T_H

View File

@@ -23,8 +23,12 @@
#include <cstdio> // for EOF
#include <cstdint> // for uint_least16_t
#include <cstring> // for memcpy
#include <cwchar> // for wmemcpy
#include <type_traits> // for __libcpp_is_constant_evaluated
#include <iosfwd> // for streampos & friends
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar> // for wmemcpy
#endif
#include <__debug>
@@ -423,6 +427,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
// char_traits<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
{
@@ -539,6 +544,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
return nullptr;
#endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _Traits>
_LIBCPP_INLINE_VISIBILITY

View File

@@ -30,14 +30,17 @@ struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {};
template<class _Tp>
concept __is_safe_integral_cmp = is_integral_v<_Tp> &&
!_IsSameAsAny<_Tp, bool, char,
!_IsSameAsAny<_Tp, bool, char
#ifndef _LIBCPP_HAS_NO_CHAR8_T
char8_t,
, char8_t
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
char16_t, char32_t,
, char16_t, char32_t
#endif
wchar_t>::value;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
, wchar_t
#endif
>::value;
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
_LIBCPP_INLINE_VISIBILITY constexpr

View File

@@ -1473,7 +1473,9 @@ template<> struct __cxx_is_always_lock_free<char8_t> { enum { __value = 2 == ATO
#endif
template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
#endif
template<> struct __cxx_is_always_lock_free<short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<unsigned short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
template<> struct __cxx_is_always_lock_free<int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
@@ -2672,7 +2674,9 @@ typedef atomic<char8_t> atomic_char8_t;
#endif
typedef atomic<char16_t> atomic_char16_t;
typedef atomic<char32_t> atomic_char32_t;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef atomic<wchar_t> atomic_wchar_t;
#endif
typedef atomic<int_least8_t> atomic_int_least8_t;
typedef atomic<uint_least8_t> atomic_uint_least8_t;

View File

@@ -74,6 +74,7 @@ enum codecvt_mode
template <class _Elem> class __codecvt_utf8;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
: public codecvt<wchar_t, char, mbstate_t>
@@ -108,6 +109,7 @@ protected:
size_t __mx) const;
virtual int do_max_length() const _NOEXCEPT;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
@@ -203,6 +205,7 @@ public:
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
: public codecvt<wchar_t, char, mbstate_t>
@@ -272,6 +275,7 @@ protected:
size_t __mx) const;
virtual int do_max_length() const _NOEXCEPT;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
@@ -443,6 +447,7 @@ public:
template <class _Elem> class __codecvt_utf8_utf16;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
: public codecvt<wchar_t, char, mbstate_t>
@@ -477,6 +482,7 @@ protected:
size_t __mx) const;
virtual int do_max_length() const _NOEXCEPT;
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>

View File

@@ -58,7 +58,9 @@ template <> struct __libcpp_is_integral<bool> { enum { va
template <> struct __libcpp_is_integral<char> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<signed char> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<unsigned char> { enum { value = 1 }; };
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <> struct __libcpp_is_integral<wchar_t> { enum { value = 1 }; };
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; };
#endif

View File

@@ -52,9 +52,11 @@ using match_results =
polymorphic_allocator<_VSTD::sub_match<_BiDirIter>>>;
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch;
#endif
_LIBCPP_END_NAMESPACE_LFTS_PMR

View File

@@ -54,7 +54,9 @@ using basic_string =
typedef basic_string<char> string;
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_string<wchar_t> wstring;
#endif
_LIBCPP_END_NAMESPACE_LFTS_PMR

View File

@@ -1283,9 +1283,11 @@ public:
return __s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_INLINE_VISIBILITY _VSTD::wstring wstring() const {
return string<wchar_t>();
}
#endif
_LIBCPP_INLINE_VISIBILITY _VSTD::u16string u16string() const {
return string<char16_t>();
}
@@ -1310,7 +1312,9 @@ public:
return string<_ECharT, _Traits, _Allocator>(__a);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_VSTD::wstring generic_wstring() const { return string<wchar_t>(); }
#endif
_VSTD::u16string generic_u16string() const { return string<char16_t>(); }
_VSTD::u32string generic_u32string() const { return string<char32_t>(); }
#endif /* !_LIBCPP_HAS_NO_LOCALIZATION */

View File

@@ -318,7 +318,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// to do this optimization now.
using format_args = basic_format_args<format_context>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using wformat_args = basic_format_args<wformat_context>;
#endif
template <class _OutIt, class _CharT>
using format_args_t = basic_format_args<basic_format_context<_OutIt, _CharT>>;
@@ -335,11 +337,14 @@ make_format_args(const _Args&... __args) {
return {basic_format_arg<_Context>(__args)...};
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...>
make_wformat_args(const _Args&... __args) {
return _VSTD::make_format_args<wformat_context>(__args...);
}
#endif
namespace __format {
template <class _Tp, class _CharT>
@@ -363,11 +368,13 @@ private:
__convert(_Uv __value) requires(same_as<_CharT, char>) {
return _VSTD::to_string(__value);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _Uv>
_LIBCPP_HIDDEN static wstring
__convert(_Uv __value) requires(same_as<_CharT, wchar_t>) {
return _VSTD::to_wstring(__value);
}
#endif
template <class _Uv>
_LIBCPP_HIDDEN auto __handle_format(_Uv __value, auto& __ctx)
@@ -514,12 +521,14 @@ vformat_to(_OutIt __out_it, string_view __fmt,
return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt
vformat_to(_OutIt __out_it, wstring_view __fmt,
format_args_t<type_identity_t<_OutIt>, wchar_t> __args) {
return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args);
}
#endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt
@@ -529,6 +538,7 @@ format_to(_OutIt __out_it, string_view __fmt, const _Args&... __args) {
_VSTD::make_format_args<basic_format_context<_OutIt, char>>(__args...));
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt
format_to(_OutIt __out_it, wstring_view __fmt, const _Args&... __args) {
@@ -537,6 +547,7 @@ format_to(_OutIt __out_it, wstring_view __fmt, const _Args&... __args) {
_VSTD::make_format_args<basic_format_context<_OutIt, wchar_t>>(
__args...));
}
#endif
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string
vformat(string_view __fmt, format_args __args) {
@@ -545,12 +556,14 @@ vformat(string_view __fmt, format_args __args) {
return __res;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring
vformat(wstring_view __fmt, wformat_args __args) {
wstring __res;
_VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args);
return __res;
}
#endif
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string
@@ -558,11 +571,13 @@ format(string_view __fmt, const _Args&... __args) {
return _VSTD::vformat(__fmt, _VSTD::make_format_args(__args...));
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring
format(wstring_view __fmt, const _Args&... __args) {
return _VSTD::vformat(__fmt, _VSTD::make_wformat_args(__args...));
}
#endif
template <class _OutIt>
struct _LIBCPP_TEMPLATE_VIS format_to_n_result {
@@ -583,6 +598,7 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, string_view __fmt,
return {_VSTD::move(__out_it), __s};
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt>
format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wstring_view __fmt,
@@ -595,6 +611,7 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wstring_view __fmt,
__out_it = _VSTD::copy_n(__str.begin(), __m, _VSTD::move(__out_it));
return {_VSTD::move(__out_it), __s};
}
#endif
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t
@@ -603,12 +620,14 @@ formatted_size(string_view __fmt, const _Args&... __args) {
return _VSTD::vformat(__fmt, _VSTD::make_format_args(__args...)).size();
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t
formatted_size(wstring_view __fmt, const _Args&... __args) {
// TODO FMT Improve PoC: using std::string is inefficient.
return _VSTD::vformat(__fmt, _VSTD::make_wformat_args(__args...)).size();
}
#endif
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
@@ -630,6 +649,7 @@ vformat_to(_OutIt __out_it, locale __loc, string_view __fmt,
__args);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt
vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt,
@@ -637,6 +657,7 @@ vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt,
return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt,
__args);
}
#endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(
@@ -646,6 +667,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(
_VSTD::make_format_args<basic_format_context<_OutIt, char>>(__args...));
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(
_OutIt __out_it, locale __loc, wstring_view __fmt, const _Args&... __args) {
@@ -654,6 +676,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(
_VSTD::make_format_args<basic_format_context<_OutIt, wchar_t>>(
__args...));
}
#endif
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string
vformat(locale __loc, string_view __fmt, format_args __args) {
@@ -663,6 +686,7 @@ vformat(locale __loc, string_view __fmt, format_args __args) {
return __res;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring
vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
wstring __res;
@@ -670,6 +694,7 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
__args);
return __res;
}
#endif
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string
@@ -678,12 +703,14 @@ format(locale __loc, string_view __fmt, const _Args&... __args) {
_VSTD::make_format_args(__args...));
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring
format(locale __loc, wstring_view __fmt, const _Args&... __args) {
return _VSTD::vformat(_VSTD::move(__loc), __fmt,
_VSTD::make_wformat_args(__args...));
}
#endif
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt>
@@ -699,6 +726,7 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc,
return {_VSTD::move(__out_it), __s};
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <output_iterator<const wchar_t&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt>
format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc,
@@ -712,6 +740,7 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc,
__out_it = _VSTD::copy_n(__str.begin(), __m, _VSTD::move(__out_it));
return {_VSTD::move(__out_it), __s};
}
#endif
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t
@@ -722,6 +751,7 @@ formatted_size(locale __loc, string_view __fmt, const _Args&... __args) {
.size();
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t
formatted_size(locale __loc, wstring_view __fmt, const _Args&... __args) {
@@ -730,6 +760,7 @@ formatted_size(locale __loc, wstring_view __fmt, const _Args&... __args) {
_VSTD::make_wformat_args(__args...))
.size();
}
#endif
#endif // _LIBCPP_HAS_NO_LOCALIZATION

View File

@@ -95,7 +95,7 @@ using u32streampos = fpos<char_traits<char32_t>::state_type>;
*/
#include <__config>
#include <wchar.h> // for mbstate_t
#include <__mbstate_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -112,7 +112,9 @@ template<> struct char_traits<char8_t>;
#endif
template<> struct char_traits<char16_t>;
template<> struct char_traits<char32_t>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<> struct char_traits<wchar_t>;
#endif
template<class _Tp> class _LIBCPP_TEMPLATE_VIS allocator;
@@ -156,7 +158,9 @@ template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator;
typedef basic_ios<char> ios;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_ios<wchar_t> wios;
#endif
typedef basic_streambuf<char> streambuf;
typedef basic_istream<char> istream;
@@ -173,6 +177,7 @@ typedef basic_ifstream<char> ifstream;
typedef basic_ofstream<char> ofstream;
typedef basic_fstream<char> fstream;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_streambuf<wchar_t> wstreambuf;
typedef basic_istream<wchar_t> wistream;
typedef basic_ostream<wchar_t> wostream;
@@ -187,36 +192,37 @@ typedef basic_filebuf<wchar_t> wfilebuf;
typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
#endif
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_PREFERRED_NAME(wios) basic_ios;
class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wios)) basic_ios;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_PREFERRED_NAME(wstreambuf) basic_streambuf;
class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstreambuf)) basic_streambuf;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_PREFERRED_NAME(wistream) basic_istream;
class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistream)) basic_istream;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_PREFERRED_NAME(wostream) basic_ostream;
class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostream)) basic_ostream;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_PREFERRED_NAME(wiostream) basic_iostream;
class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wiostream)) basic_iostream;
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_PREFERRED_NAME(wstringbuf) basic_stringbuf;
class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringbuf)) basic_stringbuf;
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_PREFERRED_NAME(wistringstream) basic_istringstream;
class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wistringstream)) basic_istringstream;
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_PREFERRED_NAME(wostringstream) basic_ostringstream;
class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wostringstream)) basic_ostringstream;
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_PREFERRED_NAME(wstringstream) basic_stringstream;
class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstringstream)) basic_stringstream;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_PREFERRED_NAME(wfilebuf) basic_filebuf;
class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfilebuf)) basic_filebuf;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_PREFERRED_NAME(wifstream) basic_ifstream;
class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wifstream)) basic_ifstream;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_PREFERRED_NAME(wofstream) basic_ofstream;
class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wofstream)) basic_ofstream;
template <class _CharT, class _Traits>
class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_PREFERRED_NAME(wfstream) basic_fstream;
class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wfstream)) basic_fstream;
template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
typedef fpos<mbstate_t> streampos;
@@ -241,10 +247,12 @@ template <class _CharT, // for <stdexcept>
class _Allocator = allocator<_CharT> >
class _LIBCPP_TEMPLATE_VIS basic_string;
typedef basic_string<char, char_traits<char>, allocator<char> > string;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
#endif
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_PREFERRED_NAME(wstring) basic_string;
class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring)) basic_string;
// Include other forward declarations here
template <class _Tp, class _Alloc = allocator<_Tp> >

View File

@@ -46,13 +46,16 @@ extern wostream wclog;
_LIBCPP_BEGIN_NAMESPACE_STD
extern _LIBCPP_FUNC_VIS istream cin;
extern _LIBCPP_FUNC_VIS wistream wcin;
extern _LIBCPP_FUNC_VIS ostream cout;
extern _LIBCPP_FUNC_VIS wostream wcout;
extern _LIBCPP_FUNC_VIS ostream cerr;
extern _LIBCPP_FUNC_VIS wostream wcerr;
extern _LIBCPP_FUNC_VIS ostream clog;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
extern _LIBCPP_FUNC_VIS wistream wcin;
extern _LIBCPP_FUNC_VIS wostream wcout;
extern _LIBCPP_FUNC_VIS wostream wcerr;
extern _LIBCPP_FUNC_VIS wostream wclog;
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@@ -1628,7 +1628,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>)
#endif
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>)
_LIBCPP_END_NAMESPACE_STD

View File

@@ -573,7 +573,9 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>)
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS num_get
@@ -1111,7 +1113,9 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>)
#endif
struct _LIBCPP_TYPE_VIS __num_put_base
{
@@ -1261,7 +1265,9 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>)
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS num_put
@@ -1694,7 +1700,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>)
#endif
template <class _CharT, class _InputIterator>
_LIBCPP_HIDDEN
@@ -1761,6 +1769,7 @@ template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__r() con
template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__x() const;
template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__X() const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__months() const;
template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__am_pm() const;
@@ -1768,6 +1777,7 @@ template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__c()
template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__r() const;
template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__x() const;
template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__X() const;
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS time_get
@@ -2380,7 +2390,9 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>)
#endif
class _LIBCPP_TYPE_VIS __time_get
{
@@ -2480,7 +2492,9 @@ private:
};
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>)
#endif
class _LIBCPP_TYPE_VIS __time_put
{
@@ -2593,7 +2607,9 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>)
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS time_put_byname
@@ -2614,7 +2630,9 @@ protected:
};
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>)
#endif
// money_base
@@ -2682,8 +2700,10 @@ moneypunct<_CharT, _International>::intl;
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>)
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>)
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>)
#endif
// moneypunct_byname
@@ -2734,13 +2754,15 @@ private:
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, false>::init(const char*);
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*);
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*);
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*);
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>)
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*);
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*);
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>)
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>)
#endif
// money_get
@@ -2797,7 +2819,9 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>)
#endif
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS money_get
@@ -3184,7 +3208,9 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>)
#endif
// money_put
@@ -3359,7 +3385,9 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>)
#endif
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS money_put
@@ -3512,7 +3540,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>)
#endif
// messages
@@ -3628,7 +3658,9 @@ messages<_CharT>::do_close(catalog __c) const
}
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>)
#endif
template <class _CharT>
class _LIBCPP_TEMPLATE_VIS messages_byname
@@ -3652,7 +3684,9 @@ protected:
};
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>)
#endif
template<class _Codecvt, class _Elem = wchar_t,
class _Wide_alloc = allocator<_Elem>,

View File

@@ -869,6 +869,7 @@ module std [system] {
module __function_like { private header "__function_like.h" export * }
module __hash_table { header "__hash_table" export * }
module __locale { private header "__locale" export * }
module __mbstate { private header "__mbstate_t.h" export * }
module __mutex_base { private header "__mutex_base" export * }
module __node_handle { private header "__node_handle" export * }
module __nullptr { header "__nullptr" export * }

View File

@@ -1087,7 +1087,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>)
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@@ -1072,32 +1072,38 @@ private:
template <class _ForwardIterator>
string_type
__transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _ForwardIterator>
string_type
__transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
#endif
template <class _ForwardIterator>
string_type
__lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _ForwardIterator>
string_type
__lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
#endif
template <class _ForwardIterator>
char_class_type
__lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
bool __icase, char) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _ForwardIterator>
char_class_type
__lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
bool __icase, wchar_t) const;
#endif
static int __regex_traits_value(unsigned char __ch, int __radix);
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(char __ch, int __radix) const
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(wchar_t __ch, int __radix) const;
#endif
};
template <class _CharT>
@@ -1168,6 +1174,7 @@ regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
return __d;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
@@ -1189,6 +1196,7 @@ regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
}
return __d;
}
#endif
// lookup_collatename is very FreeBSD-specific
@@ -1217,6 +1225,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
return __r;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::string_type
@@ -1250,6 +1259,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
}
return __r;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// lookup_classname
@@ -1268,6 +1278,7 @@ regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
return __get_classname(__s.c_str(), __icase);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
template <class _ForwardIterator>
typename regex_traits<_CharT>::char_class_type
@@ -1288,6 +1299,7 @@ regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
}
return __get_classname(__n.c_str(), __icase);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
bool
@@ -1318,6 +1330,7 @@ regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
return -1;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class _CharT>
inline
int
@@ -1325,6 +1338,7 @@ regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
{
return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
}
#endif
template <class _CharT> class __node;
@@ -2135,7 +2149,9 @@ public:
};
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<char>::__exec(__state&) const;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<wchar_t>::__exec(__state&) const;
#endif
// __match_char
@@ -2542,13 +2558,15 @@ template <class _CharT, class _Traits = regex_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS basic_regex;
typedef basic_regex<char> regex;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_regex<wchar_t> wregex;
#endif
template <class _CharT, class _Traits>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(regex)
_LIBCPP_PREFERRED_NAME(wregex)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wregex))
basic_regex
{
public:
@@ -4897,17 +4915,19 @@ basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
// sub_match
typedef sub_match<const char*> csub_match;
typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<string::const_iterator> ssub_match;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<wstring::const_iterator> wssub_match;
#endif
template <class _BidirectionalIterator>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(csub_match)
_LIBCPP_PREFERRED_NAME(wcsub_match)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcsub_match))
_LIBCPP_PREFERRED_NAME(ssub_match)
_LIBCPP_PREFERRED_NAME(wssub_match)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wssub_match))
sub_match
: public pair<_BidirectionalIterator, _BidirectionalIterator>
{
@@ -5326,17 +5346,19 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
}
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<string::const_iterator> smatch;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<wstring::const_iterator> wsmatch;
#endif
template <class _BidirectionalIterator, class _Allocator>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(cmatch)
_LIBCPP_PREFERRED_NAME(wcmatch)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcmatch))
_LIBCPP_PREFERRED_NAME(smatch)
_LIBCPP_PREFERRED_NAME(wsmatch)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsmatch))
match_results
{
public:
@@ -6244,17 +6266,19 @@ template <class _BidirectionalIterator,
class _LIBCPP_TEMPLATE_VIS regex_iterator;
typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
#endif
template <class _BidirectionalIterator, class _CharT, class _Traits>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(cregex_iterator)
_LIBCPP_PREFERRED_NAME(wcregex_iterator)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator))
_LIBCPP_PREFERRED_NAME(sregex_iterator)
_LIBCPP_PREFERRED_NAME(wsregex_iterator)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator))
regex_iterator
{
public:
@@ -6372,17 +6396,19 @@ template <class _BidirectionalIterator,
class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
typedef regex_token_iterator<const char*> cregex_token_iterator;
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#endif
template <class _BidirectionalIterator, class _CharT, class _Traits>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(cregex_token_iterator)
_LIBCPP_PREFERRED_NAME(wcregex_token_iterator)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_token_iterator))
_LIBCPP_PREFERRED_NAME(sregex_token_iterator)
_LIBCPP_PREFERRED_NAME(wsregex_token_iterator)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_token_iterator))
regex_token_iterator
{
public:

View File

@@ -524,7 +524,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
#include <cstdio> // EOF
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <initializer_list>
#include <iosfwd>
#include <iterator>
@@ -535,6 +534,10 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
#include <utility>
#include <version>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
# include <cstdint>
#endif
@@ -1729,11 +1732,15 @@ private:
// These declarations must appear before any functions are implicitly used
// so that they have the correct visibility specifier.
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char)
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char)
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
# endif
#else
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char)
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char)
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
# endif
#endif
@@ -4395,6 +4402,7 @@ _LIBCPP_FUNC_VIS string to_string(float __val);
_LIBCPP_FUNC_VIS string to_string(double __val);
_LIBCPP_FUNC_VIS string to_string(long double __val);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
_LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
_LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
@@ -4414,6 +4422,7 @@ _LIBCPP_FUNC_VIS wstring to_wstring(unsigned long long __val);
_LIBCPP_FUNC_VIS wstring to_wstring(float __val);
_LIBCPP_FUNC_VIS wstring to_wstring(double __val);
_LIBCPP_FUNC_VIS wstring to_wstring(long double __val);
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_TEMPLATE_DATA_VIS
@@ -4535,11 +4544,13 @@ inline namespace literals
return basic_string<char> (__str, __len);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_INLINE_VISIBILITY
basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
{
return basic_string<wchar_t> (__str, __len);
}
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
inline _LIBCPP_INLINE_VISIBILITY

View File

@@ -225,7 +225,9 @@ typedef basic_string_view<char8_t> u8string_view;
#endif
typedef basic_string_view<char16_t> u16string_view;
typedef basic_string_view<char32_t> u32string_view;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef basic_string_view<wchar_t> wstring_view;
#endif
template<class _CharT, class _Traits>
class
@@ -235,7 +237,7 @@ class
#endif
_LIBCPP_PREFERRED_NAME(u16string_view)
_LIBCPP_PREFERRED_NAME(u32string_view)
_LIBCPP_PREFERRED_NAME(wstring_view)
_LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring_view))
basic_string_view {
public:
// types
@@ -885,11 +887,13 @@ inline namespace literals
return basic_string_view<char> (__str, __len);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len) _NOEXCEPT
{
return basic_string_view<wchar_t> (__str, __len);
}
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR

View File

@@ -108,6 +108,10 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <stddef.h>
#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
# error "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

View File

@@ -46,6 +46,10 @@ wctrans_t wctrans(const char* property);
#include <__config>
#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
# error "The <wctype.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

View File

@@ -11,7 +11,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
#endif
template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
template void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
@@ -27,7 +29,9 @@ template void __sort<__less<double>&, double*>(double*, double*, __less<double>&
template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
#endif
template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);

View File

@@ -19,15 +19,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Original explicit instantiations provided in the library
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
#endif
// Additional instantiations added later. Whether programs rely on these being
// available is protected by _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1.
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringbuf<char>;

View File

@@ -24,6 +24,8 @@ __asm__("?cin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@DU?$char_trai
;
_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin[sizeof(__stdinbuf <char>)];
static mbstate_t mb_cin;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
@@ -31,6 +33,7 @@ __asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_tr
;
_ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin[sizeof(__stdinbuf <wchar_t>)];
static mbstate_t mb_wcin;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
@@ -39,6 +42,8 @@ __asm__("?cout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_tra
;
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
static mbstate_t mb_cout;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
@@ -46,6 +51,7 @@ __asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_t
;
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
static mbstate_t mb_wcout;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
@@ -54,6 +60,8 @@ __asm__("?cerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_tra
;
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
static mbstate_t mb_cerr;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
@@ -61,17 +69,21 @@ __asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_t
;
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
static mbstate_t mb_wcerr;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?clog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
#endif
;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
#endif
;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// Hacky way to make the compiler believe that we're inside a system header so
// it doesn't flag the use of the init_priority attribute with a value that's
@@ -109,33 +121,38 @@ DoIOSInit::DoIOSInit()
force_locale_initialization();
istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin));
wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin));
ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, &mb_cout));
wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout));
ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, &mb_cerr));
::new(clog) ostream(cerr_ptr->rdbuf());
cin_ptr->tie(cout_ptr);
_VSTD::unitbuf(*cerr_ptr);
cerr_ptr->tie(cout_ptr);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin));
wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout));
wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr));
::new(wclog) wostream(wcerr_ptr->rdbuf());
cin_ptr->tie(cout_ptr);
wcin_ptr->tie(wcout_ptr);
_VSTD::unitbuf(*cerr_ptr);
_VSTD::unitbuf(*wcerr_ptr);
cerr_ptr->tie(cout_ptr);
wcerr_ptr->tie(wcout_ptr);
#endif
}
DoIOSInit::~DoIOSInit()
{
ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
cout_ptr->flush();
wcout_ptr->flush();
ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
clog_ptr->flush();
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
wcout_ptr->flush();
wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);
wclog_ptr->flush();
#endif
}
ios_base::Init::Init()

View File

@@ -18,13 +18,16 @@
#include "cstdio"
#include "cstdlib"
#include "cstring"
#include "cwctype"
#include "locale"
#include "string"
#include "type_traits"
#include "typeinfo"
#include "vector"
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include "cwctype"
#endif
#if defined(_LIBCPP_MSVCRT)
# define _CTYPE_DISABLE_MACROS
#endif
@@ -176,11 +179,17 @@ locale::__imp::__imp(size_t refs)
{
facets_.clear();
install(&make<_VSTD::collate<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<_VSTD::collate<wchar_t> >(1u));
#endif
install(&make<_VSTD::ctype<char> >(nullptr, false, 1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<_VSTD::ctype<wchar_t> >(1u));
#endif
install(&make<codecvt<char, char, mbstate_t> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
#endif
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
@@ -190,25 +199,43 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u));
#endif
install(&make<numpunct<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<numpunct<wchar_t> >(1u));
#endif
install(&make<num_get<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<num_get<wchar_t> >(1u));
#endif
install(&make<num_put<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<num_put<wchar_t> >(1u));
#endif
install(&make<moneypunct<char, false> >(1u));
install(&make<moneypunct<char, true> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<moneypunct<wchar_t, false> >(1u));
install(&make<moneypunct<wchar_t, true> >(1u));
#endif
install(&make<money_get<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<money_get<wchar_t> >(1u));
#endif
install(&make<money_put<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<money_put<wchar_t> >(1u));
#endif
install(&make<time_get<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<time_get<wchar_t> >(1u));
#endif
install(&make<time_put<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<time_put<wchar_t> >(1u));
#endif
install(&make<_VSTD::messages<char> >(1u));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(&make<_VSTD::messages<wchar_t> >(1u));
#endif
}
locale::__imp::__imp(const string& name, size_t refs)
@@ -225,11 +252,17 @@ locale::__imp::__imp(const string& name, size_t refs)
if (facets_[i])
facets_[i]->__add_shared();
install(new collate_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new collate_byname<wchar_t>(name_));
#endif
install(new ctype_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new ctype_byname<wchar_t>(name_));
#endif
install(new codecvt_byname<char, char, mbstate_t>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
#endif
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
@@ -239,17 +272,27 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
#endif
install(new numpunct_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new numpunct_byname<wchar_t>(name_));
#endif
install(new moneypunct_byname<char, false>(name_));
install(new moneypunct_byname<char, true>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new moneypunct_byname<wchar_t, false>(name_));
install(new moneypunct_byname<wchar_t, true>(name_));
#endif
install(new time_get_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new time_get_byname<wchar_t>(name_));
#endif
install(new time_put_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new time_put_byname<wchar_t>(name_));
#endif
install(new messages_byname<char>(name_));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new messages_byname<wchar_t>(name_));
#endif
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -287,14 +330,20 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
if (c & locale::collate)
{
install(new collate_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new collate_byname<wchar_t>(name));
#endif
}
if (c & locale::ctype)
{
install(new ctype_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new ctype_byname<wchar_t>(name));
#endif
install(new codecvt_byname<char, char, mbstate_t>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
#endif
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
install(new codecvt_byname<char16_t, char, mbstate_t>(name));
install(new codecvt_byname<char32_t, char, mbstate_t>(name));
@@ -308,25 +357,35 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
{
install(new moneypunct_byname<char, false>(name));
install(new moneypunct_byname<char, true>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new moneypunct_byname<wchar_t, false>(name));
install(new moneypunct_byname<wchar_t, true>(name));
#endif
}
if (c & locale::numeric)
{
install(new numpunct_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new numpunct_byname<wchar_t>(name));
#endif
}
if (c & locale::time)
{
install(new time_get_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new time_get_byname<wchar_t>(name));
#endif
install(new time_put_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new time_put_byname<wchar_t>(name));
#endif
}
if (c & locale::messages)
{
install(new messages_byname<char>(name));
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install(new messages_byname<wchar_t>(name));
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -364,12 +423,16 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
if (c & locale::collate)
{
install_from<_VSTD::collate<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<_VSTD::collate<wchar_t> >(one);
#endif
}
if (c & locale::ctype)
{
install_from<_VSTD::ctype<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<_VSTD::ctype<wchar_t> >(one);
#endif
install_from<_VSTD::codecvt<char, char, mbstate_t> >(one);
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
install_from<_VSTD::codecvt<char16_t, char, mbstate_t> >(one);
@@ -379,39 +442,59 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
install_from<_VSTD::codecvt<char16_t, char8_t, mbstate_t> >(one);
install_from<_VSTD::codecvt<char32_t, char8_t, mbstate_t> >(one);
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<_VSTD::codecvt<wchar_t, char, mbstate_t> >(one);
#endif
}
if (c & locale::monetary)
{
install_from<moneypunct<char, false> >(one);
install_from<moneypunct<char, true> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<moneypunct<wchar_t, false> >(one);
install_from<moneypunct<wchar_t, true> >(one);
#endif
install_from<money_get<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<money_get<wchar_t> >(one);
#endif
install_from<money_put<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<money_put<wchar_t> >(one);
#endif
}
if (c & locale::numeric)
{
install_from<numpunct<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<numpunct<wchar_t> >(one);
#endif
install_from<num_get<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<num_get<wchar_t> >(one);
#endif
install_from<num_put<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<num_put<wchar_t> >(one);
#endif
}
if (c & locale::time)
{
install_from<time_get<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<time_get<wchar_t> >(one);
#endif
install_from<time_put<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<time_put<wchar_t> >(one);
#endif
}
if (c & locale::messages)
{
install_from<_VSTD::messages<char> >(one);
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
install_from<_VSTD::messages<wchar_t> >(one);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -702,6 +785,7 @@ collate_byname<char>::do_transform(const char_type* lo, const char_type* hi) con
// template <> class collate_byname<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
: collate<wchar_t>(refs),
__l(newlocale(LC_ALL_MASK, n, 0))
@@ -747,6 +831,7 @@ collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi)
wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size()+1, __l);
return out;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
const ctype_base::mask ctype_base::space;
const ctype_base::mask ctype_base::print;
@@ -763,6 +848,7 @@ const ctype_base::mask ctype_base::graph;
// template <> class ctype<wchar_t>;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
locale::id ctype<wchar_t>::id;
ctype<wchar_t>::~ctype()
@@ -892,6 +978,7 @@ ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfau
*dest = dfault;
return low;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// template <> class ctype<char>;
@@ -1223,6 +1310,7 @@ ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const
// template <> class ctype_byname<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
: ctype<wchar_t>(refs),
__l(newlocale(LC_ALL_MASK, name, 0))
@@ -1422,6 +1510,7 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
}
return low;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// template <> class codecvt<char, char, mbstate_t>
@@ -1486,6 +1575,7 @@ codecvt<char, char, mbstate_t>::do_max_length() const noexcept
// template <> class codecvt<wchar_t, char, mbstate_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
locale::id codecvt<wchar_t, char, mbstate_t>::id;
codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs)
@@ -1698,6 +1788,7 @@ codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept
{
return __l == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l));
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// Valid UTF ranges
// UTF-32 UTF-16 UTF-8 # of code points
@@ -3404,6 +3495,7 @@ codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const noexcept
// __codecvt_utf8<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
__codecvt_utf8<wchar_t>::result
__codecvt_utf8<wchar_t>::do_out(state_type&,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
@@ -3505,6 +3597,7 @@ __codecvt_utf8<wchar_t>::do_max_length() const noexcept
return 4;
#endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// __codecvt_utf8<char16_t>
@@ -3658,6 +3751,7 @@ __codecvt_utf8<char32_t>::do_max_length() const noexcept
// __codecvt_utf16<wchar_t, false>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
__codecvt_utf16<wchar_t, false>::result
__codecvt_utf16<wchar_t, false>::do_out(state_type&,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
@@ -3863,6 +3957,7 @@ __codecvt_utf16<wchar_t, true>::do_max_length() const noexcept
return 4;
#endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// __codecvt_utf16<char16_t, false>
@@ -4166,6 +4261,7 @@ __codecvt_utf16<char32_t, true>::do_max_length() const noexcept
// __codecvt_utf8_utf16<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
__codecvt_utf8_utf16<wchar_t>::result
__codecvt_utf8_utf16<wchar_t>::do_out(state_type&,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
@@ -4250,6 +4346,7 @@ __codecvt_utf8_utf16<wchar_t>::do_max_length() const noexcept
return 7;
return 4;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// __codecvt_utf8_utf16<char16_t>
@@ -4425,7 +4522,7 @@ __widen_from_utf8<32>::~__widen_from_utf8()
{
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
static bool checked_string_to_wchar_convert(wchar_t& dest,
const char* ptr,
locale_t loc) {
@@ -4440,6 +4537,7 @@ static bool checked_string_to_wchar_convert(wchar_t& dest,
dest = out;
return true;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
static bool checked_string_to_char_convert(char& dest,
const char* ptr,
@@ -4450,6 +4548,8 @@ static bool checked_string_to_char_convert(char& dest,
dest = *ptr;
return true;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
// First convert the MBS into a wide char then attempt to narrow it using
// wctob_l.
wchar_t wout;
@@ -4470,6 +4570,9 @@ static bool checked_string_to_char_convert(char& dest,
default:
return false;
}
#else // _LIBCPP_HAS_NO_WIDE_CHARACTERS
return false;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_UNREACHABLE();
}
@@ -4477,7 +4580,9 @@ static bool checked_string_to_char_convert(char& dest,
// numpunct<char> && numpunct<wchar_t>
locale::id numpunct< char >::id;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
locale::id numpunct<wchar_t>::id;
#endif
numpunct<char>::numpunct(size_t refs)
: locale::facet(refs),
@@ -4486,35 +4591,49 @@ numpunct<char>::numpunct(size_t refs)
{
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
numpunct<wchar_t>::numpunct(size_t refs)
: locale::facet(refs),
__decimal_point_(L'.'),
__thousands_sep_(L',')
{
}
#endif
numpunct<char>::~numpunct()
{
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
numpunct<wchar_t>::~numpunct()
{
}
#endif
char numpunct< char >::do_decimal_point() const {return __decimal_point_;}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wchar_t numpunct<wchar_t>::do_decimal_point() const {return __decimal_point_;}
#endif
char numpunct< char >::do_thousands_sep() const {return __thousands_sep_;}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wchar_t numpunct<wchar_t>::do_thousands_sep() const {return __thousands_sep_;}
#endif
string numpunct< char >::do_grouping() const {return __grouping_;}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
string numpunct<wchar_t>::do_grouping() const {return __grouping_;}
#endif
string numpunct< char >::do_truename() const {return "true";}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wstring numpunct<wchar_t>::do_truename() const {return L"true";}
#endif
string numpunct< char >::do_falsename() const {return "false";}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wstring numpunct<wchar_t>::do_falsename() const {return L"false";}
#endif
// numpunct_byname<char>
@@ -4537,6 +4656,7 @@ numpunct_byname<char>::~numpunct_byname()
void
numpunct_byname<char>::__init(const char* nm)
{
typedef numpunct<char> base;
if (strcmp(nm, "C") != 0)
{
__libcpp_unique_locale loc(nm);
@@ -4545,10 +4665,12 @@ numpunct_byname<char>::__init(const char* nm)
" failed to construct for " + string(nm));
lconv* lc = __libcpp_localeconv_l(loc.get());
checked_string_to_char_convert(__decimal_point_, lc->decimal_point,
loc.get());
checked_string_to_char_convert(__thousands_sep_, lc->thousands_sep,
loc.get());
if (!checked_string_to_char_convert(__decimal_point_, lc->decimal_point,
loc.get()))
__decimal_point_ = base::do_decimal_point();
if (!checked_string_to_char_convert(__thousands_sep_, lc->thousands_sep,
loc.get()))
__thousands_sep_ = base::do_thousands_sep();
__grouping_ = lc->grouping;
// localization for truename and falsename is not available
}
@@ -4556,6 +4678,7 @@ numpunct_byname<char>::__init(const char* nm)
// numpunct_byname<wchar_t>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs)
: numpunct<wchar_t>(refs)
{
@@ -4591,6 +4714,7 @@ numpunct_byname<wchar_t>::__init(const char* nm)
// localization for truename and falsename is not available
}
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// num_get helpers
@@ -4766,6 +4890,7 @@ init_weeks()
return weeks;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
static
wstring*
init_wweeks()
@@ -4787,6 +4912,7 @@ init_wweeks()
weeks[13] = L"Sat";
return weeks;
}
#endif
template <>
const string*
@@ -4796,6 +4922,7 @@ __time_get_c_storage<char>::__weeks() const
return weeks;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring*
__time_get_c_storage<wchar_t>::__weeks() const
@@ -4803,6 +4930,7 @@ __time_get_c_storage<wchar_t>::__weeks() const
static const wstring* weeks = init_wweeks();
return weeks;
}
#endif
static
string*
@@ -4836,6 +4964,7 @@ init_months()
return months;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
static
wstring*
init_wmonths()
@@ -4867,6 +4996,7 @@ init_wmonths()
months[23] = L"Dec";
return months;
}
#endif
template <>
const string*
@@ -4876,6 +5006,7 @@ __time_get_c_storage<char>::__months() const
return months;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring*
__time_get_c_storage<wchar_t>::__months() const
@@ -4883,6 +5014,7 @@ __time_get_c_storage<wchar_t>::__months() const
static const wstring* months = init_wmonths();
return months;
}
#endif
static
string*
@@ -4894,6 +5026,7 @@ init_am_pm()
return am_pm;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
static
wstring*
init_wam_pm()
@@ -4903,6 +5036,7 @@ init_wam_pm()
am_pm[1] = L"PM";
return am_pm;
}
#endif
template <>
const string*
@@ -4912,6 +5046,7 @@ __time_get_c_storage<char>::__am_pm() const
return am_pm;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring*
__time_get_c_storage<wchar_t>::__am_pm() const
@@ -4919,6 +5054,7 @@ __time_get_c_storage<wchar_t>::__am_pm() const
static const wstring* am_pm = init_wam_pm();
return am_pm;
}
#endif
template <>
const string&
@@ -4928,6 +5064,7 @@ __time_get_c_storage<char>::__x() const
return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring&
__time_get_c_storage<wchar_t>::__x() const
@@ -4935,6 +5072,7 @@ __time_get_c_storage<wchar_t>::__x() const
static wstring s(L"%m/%d/%y");
return s;
}
#endif
template <>
const string&
@@ -4944,6 +5082,7 @@ __time_get_c_storage<char>::__X() const
return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring&
__time_get_c_storage<wchar_t>::__X() const
@@ -4951,6 +5090,7 @@ __time_get_c_storage<wchar_t>::__X() const
static wstring s(L"%H:%M:%S");
return s;
}
#endif
template <>
const string&
@@ -4960,6 +5100,7 @@ __time_get_c_storage<char>::__c() const
return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring&
__time_get_c_storage<wchar_t>::__c() const
@@ -4967,6 +5108,7 @@ __time_get_c_storage<wchar_t>::__c() const
static wstring s(L"%a %b %d %H:%M:%S %Y");
return s;
}
#endif
template <>
const string&
@@ -4976,6 +5118,7 @@ __time_get_c_storage<char>::__r() const
return s;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
const wstring&
__time_get_c_storage<wchar_t>::__r() const
@@ -4983,6 +5126,7 @@ __time_get_c_storage<wchar_t>::__r() const
static wstring s(L"%I:%M:%S %p");
return s;
}
#endif
// time_get_byname
@@ -5161,6 +5305,7 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
wstring
__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
@@ -5310,6 +5455,7 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
}
return result;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
void
@@ -5348,6 +5494,7 @@ __time_get_storage<char>::init(const ctype<char>& ct)
__X_ = __analyze('X', ct);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
void
__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
@@ -5423,6 +5570,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
__x_ = __analyze('x', ct);
__X_ = __analyze('X', ct);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class CharT>
struct _LIBCPP_HIDDEN __time_get_temp
@@ -5450,6 +5598,7 @@ __time_get_storage<char>::__time_get_storage(const string& __nm)
init(ct);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
__time_get_storage<wchar_t>::__time_get_storage(const char* __nm)
: __time_get(__nm)
@@ -5465,6 +5614,7 @@ __time_get_storage<wchar_t>::__time_get_storage(const string& __nm)
const __time_get_temp<wchar_t> ct(__nm);
init(ct);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
time_base::dateorder
@@ -5553,6 +5703,7 @@ __time_get_storage<char>::__do_date_order() const
return time_base::no_order;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
time_base::dateorder
__time_get_storage<wchar_t>::__do_date_order() const
@@ -5639,6 +5790,7 @@ __time_get_storage<wchar_t>::__do_date_order() const
}
return time_base::no_order;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// time_put
@@ -5675,6 +5827,7 @@ __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm,
__ne = __nb + n;
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
void
__time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
char __fmt, char __mod) const
@@ -5689,6 +5842,7 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
__throw_runtime_error("locale not supported");
__we = __wb + j;
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// moneypunct_byname
@@ -6168,6 +6322,7 @@ moneypunct_byname<char, true>::init(const char* nm)
#endif // !_LIBCPP_MSVCRT
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<>
void
moneypunct_byname<wchar_t, false>::init(const char* nm)
@@ -6315,6 +6470,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
lc->int_n_sign_posn, L' ');
#endif // !_LIBCPP_MSVCRT
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
void __do_nothing(void*) {}
@@ -6328,63 +6484,63 @@ void __throw_runtime_error(const char* msg)
#endif
}
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_get<wchar_t>;)
template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<char>;
template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<wchar_t>;
template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_get<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS num_put<wchar_t>;)
template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<char>;
template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<wchar_t>;
template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template struct _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __num_put<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_get_byname<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS time_put_byname<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, false>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, true>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<wchar_t, false>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<wchar_t, true>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, false>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<char, true>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<wchar_t, false>;)
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct<wchar_t, true>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, false>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, true>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<wchar_t, false>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<wchar_t, true>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, false>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, true>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<wchar_t, false>;)
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<wchar_t, true>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_get<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_get<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS money_put<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __money_put<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<wchar_t>;)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;)
template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char, mbstate_t>;
template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char, mbstate_t>;
#ifndef _LIBCPP_HAS_NO_CHAR8_T

View File

@@ -9,13 +9,16 @@
#include "string"
#include "charconv"
#include "cstdlib"
#include "cwchar"
#include "cerrno"
#include "limits"
#include "stdexcept"
#include <stdio.h>
#include "__debug"
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include "cwchar"
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
void __basic_string_common<true>::__throw_length_error() const {
@@ -28,11 +31,15 @@ void __basic_string_common<true>::__throw_out_of_range() const {
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
# endif
#else
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
# endif
#endif
#undef _LIBCPP_EXTERN_TEMPLATE_DEFINE
@@ -137,6 +144,7 @@ as_integer( const string& func, const string& s, size_t* idx, int base )
return as_integer_helper<unsigned long long>( func, s, idx, base, strtoull );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
// wstring
template<>
inline
@@ -181,6 +189,7 @@ as_integer( const string& func, const wstring& s, size_t* idx, int base )
{
return as_integer_helper<unsigned long long>( func, s, idx, base, wcstoull );
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
// as_float
@@ -232,6 +241,7 @@ as_float( const string& func, const string& s, size_t* idx )
return as_float_helper<long double>( func, s, idx, strtold );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template<>
inline
float
@@ -255,6 +265,7 @@ as_float( const string& func, const wstring& s, size_t* idx )
{
return as_float_helper<long double>( func, s, idx, wcstold );
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
} // unnamed namespace
@@ -264,11 +275,13 @@ stoi(const string& str, size_t* idx, int base)
return as_integer<int>( "stoi", str, idx, base );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
int
stoi(const wstring& str, size_t* idx, int base)
{
return as_integer<int>( "stoi", str, idx, base );
}
#endif
long
stol(const string& str, size_t* idx, int base)
@@ -276,11 +289,13 @@ stol(const string& str, size_t* idx, int base)
return as_integer<long>( "stol", str, idx, base );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
long
stol(const wstring& str, size_t* idx, int base)
{
return as_integer<long>( "stol", str, idx, base );
}
#endif
unsigned long
stoul(const string& str, size_t* idx, int base)
@@ -288,11 +303,13 @@ stoul(const string& str, size_t* idx, int base)
return as_integer<unsigned long>( "stoul", str, idx, base );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
unsigned long
stoul(const wstring& str, size_t* idx, int base)
{
return as_integer<unsigned long>( "stoul", str, idx, base );
}
#endif
long long
stoll(const string& str, size_t* idx, int base)
@@ -300,11 +317,13 @@ stoll(const string& str, size_t* idx, int base)
return as_integer<long long>( "stoll", str, idx, base );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
long long
stoll(const wstring& str, size_t* idx, int base)
{
return as_integer<long long>( "stoll", str, idx, base );
}
#endif
unsigned long long
stoull(const string& str, size_t* idx, int base)
@@ -312,11 +331,13 @@ stoull(const string& str, size_t* idx, int base)
return as_integer<unsigned long long>( "stoull", str, idx, base );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
unsigned long long
stoull(const wstring& str, size_t* idx, int base)
{
return as_integer<unsigned long long>( "stoull", str, idx, base );
}
#endif
float
stof(const string& str, size_t* idx)
@@ -324,11 +345,13 @@ stof(const string& str, size_t* idx)
return as_float<float>( "stof", str, idx );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
float
stof(const wstring& str, size_t* idx)
{
return as_float<float>( "stof", str, idx );
}
#endif
double
stod(const string& str, size_t* idx)
@@ -336,11 +359,13 @@ stod(const string& str, size_t* idx)
return as_float<double>( "stod", str, idx );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
double
stod(const wstring& str, size_t* idx)
{
return as_float<double>( "stod", str, idx );
}
#endif
long double
stold(const string& str, size_t* idx)
@@ -348,11 +373,13 @@ stold(const string& str, size_t* idx)
return as_float<long double>( "stold", str, idx );
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
long double
stold(const wstring& str, size_t* idx)
{
return as_float<long double>( "stold", str, idx );
}
#endif
// to_string
@@ -403,6 +430,7 @@ struct initial_string<string>
}
};
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <>
struct initial_string<wstring>
{
@@ -427,6 +455,7 @@ get_swprintf()
return static_cast<int (__cdecl*)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...)>(_snwprintf);
#endif
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <typename S, typename V>
S i_to_string(V v)
@@ -450,20 +479,23 @@ string to_string (unsigned val) { return i_to_string< string>(val); }
string to_string (unsigned long val) { return i_to_string< string>(val); }
string to_string (unsigned long long val) { return i_to_string< string>(val); }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wstring to_wstring(int val) { return i_to_string<wstring>(val); }
wstring to_wstring(long val) { return i_to_string<wstring>(val); }
wstring to_wstring(long long val) { return i_to_string<wstring>(val); }
wstring to_wstring(unsigned val) { return i_to_string<wstring>(val); }
wstring to_wstring(unsigned long val) { return i_to_string<wstring>(val); }
wstring to_wstring(unsigned long long val) { return i_to_string<wstring>(val); }
#endif
string to_string (float val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
string to_string (double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
string to_string (long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); }
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); }
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@@ -65,7 +65,9 @@ int main(int, char**) {
CHECK_ALIGNMENT(unsigned char);
CHECK_ALIGNMENT(char16_t);
CHECK_ALIGNMENT(char32_t);
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
CHECK_ALIGNMENT(wchar_t);
#endif
CHECK_ALIGNMENT(short);
CHECK_ALIGNMENT(unsigned short);
CHECK_ALIGNMENT(int);

View File

@@ -39,8 +39,10 @@ extern "C" {
// tgmath.h is not supported in extern "C".
#include <time.h>
// FIXME: #include <uchar.h>
#include <wchar.h>
#include <wctype.h>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wchar.h>
# include <wctype.h>
#endif
}
int main(int, char**) {

View File

@@ -0,0 +1,15 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// REQUIRES: modules-build
// WARNING: This test was generated by 'generate_private_header_tests.py'
// and should not be edited manually.
// expected-error@*:* {{use of private header from outside its module: '__mbstate_t.h'}}
#include <__mbstate_t.h>

View File

@@ -74,8 +74,12 @@
#include <ctgmath>
#include <ctime>
#include <ctype.h>
#include <cwchar>
#include <cwctype>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwctype>
#endif
#include <deque>
#include <errno.h>
#include <exception>
@@ -191,8 +195,12 @@
#include <variant>
#include <vector>
#include <version>
#include <wchar.h>
#include <wctype.h>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wchar.h>
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wctype.h>
#endif
// experimental headers
#if __cplusplus >= 201103L

View File

@@ -45,8 +45,10 @@
#ifndef _MSC_VER
# include <tgmath.h>
#endif
#include <wchar.h>
#include <wctype.h>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wchar.h>
# include <wctype.h>
#endif
int main(int argc, char **argv) {
(void)argc;

View File

@@ -146,7 +146,9 @@ int main(int, char**)
{
auto const& S = shortString;
doShortStringTest<char>(S);
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
doShortStringTest<wchar_t>(S);
#endif
doShortStringTest<char16_t>(S);
doShortStringTest<char32_t>(S);
#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t)
@@ -156,7 +158,9 @@ int main(int, char**)
{
auto const& S = longString;
doLongStringTest<char>(S);
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
doLongStringTest<wchar_t>(S);
#endif
doLongStringTest<char16_t>(S);
doLongStringTest<char32_t>(S);
#if TEST_STD_VER > 17 && defined(__cpp_lib_char8_t)

View File

@@ -97,7 +97,9 @@ struct MakeTestType {
int main(int, char**) {
MakeTestType<char>::Test();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
MakeTestType<wchar_t>::Test();
#endif
MakeTestType<char16_t>::Test();
MakeTestType<char32_t>::Test();

View File

@@ -13,6 +13,8 @@
// The char type of the stream and the char_type of the traits have to match
// UNSUPPORTED: libcpp-has-no-wide-characters
#include <istream>
#include <type_traits>
#include <cassert>

View File

@@ -13,6 +13,8 @@
// The char type of the stream and the char_type of the traits have to match
// UNSUPPORTED: libcpp-has-no-wide-characters
#include <ostream>
#include <type_traits>
#include <cassert>

View File

@@ -14,6 +14,8 @@
//
// The char type of the stream and the char_type of the traits have to match
// UNSUPPORTED: libcpp-has-no-wide-characters
#include <sstream>
int main(int, char**)

View File

@@ -225,10 +225,12 @@ int main(int, char**)
static_assert(( std::__is_cpp17_contiguous_iterator<std::string::const_iterator> ::value), "");
static_assert((!std::__is_cpp17_contiguous_iterator<std::string::reverse_iterator> ::value), "");
static_assert((!std::__is_cpp17_contiguous_iterator<std::string::const_reverse_iterator>::value), "");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(( std::__is_cpp17_contiguous_iterator<std::wstring::iterator> ::value), "");
static_assert(( std::__is_cpp17_contiguous_iterator<std::wstring::const_iterator> ::value), "");
static_assert((!std::__is_cpp17_contiguous_iterator<std::wstring::reverse_iterator> ::value), "");
static_assert((!std::__is_cpp17_contiguous_iterator<std::wstring::const_reverse_iterator>::value), "");
#endif
// deque is random-access but not contiguous
static_assert((!std::__is_cpp17_contiguous_iterator<std::deque<int>::iterator> ::value), "");

View File

@@ -25,10 +25,12 @@ int main(int, char**)
std::ostreambuf_iterator<char> i(nullptr);
assert(i.failed());
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::ostreambuf_iterator<wchar_t> i(nullptr);
assert(i.failed());
}
#endif
return 0;
}

View File

@@ -25,7 +25,9 @@ static_assert(std::__integer_like<unsigned long>);
static_assert(std::__integer_like<long long>);
static_assert(std::__integer_like<unsigned long long>);
static_assert(std::__integer_like<char>);
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(std::__integer_like<wchar_t>);
#endif
static_assert(std::__integer_like<char8_t>);
static_assert(std::__integer_like<char16_t>);
static_assert(std::__integer_like<char32_t>);
@@ -42,7 +44,9 @@ static_assert(!std::__signed_integer_like<unsigned int>);
static_assert(!std::__signed_integer_like<unsigned long>);
static_assert(!std::__signed_integer_like<unsigned long long>);
static_assert(std::__signed_integer_like<char> == std::signed_integral<char>);
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(std::__signed_integer_like<wchar_t> == std::signed_integral<wchar_t>);
#endif
static_assert(std::__signed_integer_like<char8_t> == std::signed_integral<char8_t>);
static_assert(std::__signed_integer_like<char16_t> == std::signed_integral<char16_t>);
static_assert(std::__signed_integer_like<char32_t> == std::signed_integral<char32_t>);

View File

@@ -9,6 +9,8 @@
// 'do_bytes' throws a std::range_error unexpectedly
// XFAIL: LIBCXX-WINDOWS-FIXME, powerpc-ibm-aix
// XFAIL: libcpp-has-no-wide-characters
// UNSUPPORTED: c++03
// <locale>

View File

@@ -112,10 +112,14 @@ TEST_MACROS();
TEST_MACROS();
#include <ctype.h>
TEST_MACROS();
#include <cwchar>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
TEST_MACROS();
#include <cwctype>
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwctype>
TEST_MACROS();
#endif
#include <deque>
TEST_MACROS();
#include <errno.h>
@@ -304,10 +308,14 @@ TEST_MACROS();
TEST_MACROS();
#include <version>
TEST_MACROS();
#include <wchar.h>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wchar.h>
TEST_MACROS();
#include <wctype.h>
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wctype.h>
TEST_MACROS();
#endif
// experimental headers
#if __cplusplus >= 201103L

View File

@@ -69,8 +69,12 @@
#include <ctgmath>
#include <ctime>
#include <ctype.h>
#include <cwchar>
#include <cwctype>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwctype>
#endif
#include <deque>
#include <errno.h>
#include <exception>
@@ -186,8 +190,12 @@
#include <variant>
#include <vector>
#include <version>
#include <wchar.h>
#include <wctype.h>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wchar.h>
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <wctype.h>
#endif
// experimental headers
#if __cplusplus >= 201103L

View File

@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-wide-characters
// <cwchar>
#include <cwchar>

View File

@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-wide-characters
// <cwctype>
#include <cwctype>

View File

@@ -87,7 +87,9 @@ int main(int, char**)
check_integral_types<char, int>();
check_integral_types<signed char, int>();
check_integral_types<unsigned char, int>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
check_integral_types<wchar_t, decltype(((wchar_t)1) + 1)>();
#endif
check_integral_types<char16_t, int>();
// On some platforms, unsigned int and long are the same size. These
// platforms have a choice of making uint32_t an int or a long. However

View File

@@ -350,7 +350,9 @@ void test() {
void test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
}
int main(int, char**) {

View File

@@ -304,7 +304,9 @@ void test() {
void test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
}
int main(int, char**) {

View File

@@ -430,7 +430,9 @@ constexpr void test() {
constexpr bool test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
return true;
}
@@ -440,10 +442,12 @@ int main(int, char**) {
// Make sure the parsers match the expectations. The layout of the
// subobjects is chosen to minimize the size required.
static_assert(sizeof(Parser<char>) == 2 * sizeof(uint32_t));
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(
sizeof(Parser<wchar_t>) ==
(sizeof(wchar_t) <= 2 ? 2 * sizeof(uint32_t) : 3 * sizeof(uint32_t)));
#endif
#endif // _WIN32
test();
static_assert(test());

View File

@@ -428,7 +428,9 @@ constexpr void test() {
constexpr bool test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
return true;
}
@@ -440,10 +442,12 @@ int main(int, char**) {
// Make sure the parsers match the expectations. The layout of the
// subobjects is chosen to minimize the size required.
static_assert(sizeof(Parser<char>) == 2 * sizeof(uint32_t));
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(
sizeof(Parser<wchar_t>) ==
(sizeof(wchar_t) <= 2 ? 2 * sizeof(uint32_t) : 3 * sizeof(uint32_t)));
#endif
#endif // _WIN32
test();
static_assert(test());

View File

@@ -323,7 +323,9 @@ constexpr void test() {
constexpr bool test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
return true;
}
@@ -333,10 +335,12 @@ int main(int, char**) {
// Make sure the parsers match the expectations. The layout of the
// subobjects is chosen to minimize the size required.
static_assert(sizeof(Parser<char>) == 2 * sizeof(uint32_t));
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert(
sizeof(Parser<wchar_t>) ==
(sizeof(wchar_t) <= 2 ? 2 * sizeof(uint32_t) : 3 * sizeof(uint32_t)));
#endif
#endif // _WIN32
test();
static_assert(test());

View File

@@ -351,7 +351,9 @@ constexpr void test() {
constexpr bool test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
@@ -368,10 +370,12 @@ int main(int, char**) {
// Make sure the parsers match the expectations. The layout of the
// subobjects is chosen to minimize the size required.
LIBCPP_STATIC_ASSERT(sizeof(Parser<char>) == 3 * sizeof(uint32_t));
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
LIBCPP_STATIC_ASSERT(
sizeof(Parser<wchar_t>) ==
(sizeof(wchar_t) <= 2 ? 3 * sizeof(uint32_t) : 4 * sizeof(uint32_t)));
#endif
#endif // _WIN32
test();
static_assert(test());

View File

@@ -91,7 +91,9 @@ constexpr void test() {
constexpr bool test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif

View File

@@ -251,7 +251,9 @@ constexpr void test() {
constexpr bool test() {
test<char>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif

View File

@@ -183,7 +183,9 @@ int main(int, char**)
test<std::atomic_char16_t, char16_t>();
test<std::atomic_char32_t, char32_t>();
#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<std::atomic_wchar_t, wchar_t>();
#endif
test<std::atomic_int8_t, int8_t>();
test<std::atomic_uint8_t, uint8_t>();
@@ -209,7 +211,9 @@ int main(int, char**)
test<volatile std::atomic_char16_t, char16_t>();
test<volatile std::atomic_char32_t, char32_t>();
#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<volatile std::atomic_wchar_t, wchar_t>();
#endif
test<volatile std::atomic_int8_t, int8_t>();
test<volatile std::atomic_uint8_t, uint8_t>();

View File

@@ -56,7 +56,9 @@ int main(int, char**)
static_assert((std::is_same<std::atomic<unsigned long>, std::atomic_ulong>::value), "");
static_assert((std::is_same<std::atomic<long long>, std::atomic_llong>::value), "");
static_assert((std::is_same<std::atomic<unsigned long long>, std::atomic_ullong>::value), "");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert((std::is_same<std::atomic<wchar_t>, std::atomic_wchar_t>::value), "");
#endif
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
static_assert((std::is_same<std::atomic<char8_t>, std::atomic_char8_t>::value), "");
#endif

View File

@@ -118,7 +118,9 @@ int main(int, char**)
#endif
test<char16_t> ();
test<char32_t> ();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t> ();
#endif
test<int_least8_t> ();
test<uint_least8_t> ();

View File

@@ -236,14 +236,18 @@ void test()
// Strings
test_true <std::string>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_true <std::wstring>();
#endif
test_true <std::u8string>();
test_true <std::u16string>();
test_true <std::u32string>();
// String views
test_true <std::string_view>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_true <std::wstring_view>();
#endif
test_true <std::u8string_view>();
test_true <std::u16string_view>();
test_true <std::u32string_view>();

View File

@@ -11,7 +11,6 @@
#include <stdint.h>
#include <cstddef>
#include <csignal>
#include <cwctype>
#include <climits>
#include <type_traits>
#include <limits>
@@ -19,6 +18,10 @@
#include "test_macros.h"
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
# include <cwctype>
#endif
int main(int, char**)
{
// typedef int8_t
@@ -238,6 +241,7 @@ int main(int, char**)
// SIZE_MAX
assert(SIZE_MAX == std::numeric_limits<size_t>::max());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
// WCHAR_MIN
assert(WCHAR_MIN == std::numeric_limits<wchar_t>::min());
@@ -249,6 +253,7 @@ int main(int, char**)
// WINT_MAX
assert(WINT_MAX == std::numeric_limits<wint_t>::max());
#endif
#ifndef INT8_C
#error INT8_C not defined

View File

@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-wide-characters
// <wchar.h>
#include <wchar.h>

View File

@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-wide-characters
// <wctype.h>
#include <wctype.h>

View File

@@ -28,33 +28,40 @@ namespace exper = std::experimental;
int main(int, char**) {
const char eight = '8';
const std::string nine = "9";
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
const std::wstring ten = L"10";
#endif
const int eleven = 11;
// Narrow streams w/rvalues
// Narrow streams w/rvalues
{ exper::ostream_joiner<char> oj(std::cout, '8'); }
{ exper::ostream_joiner<std::string> oj(std::cout, std::string("9")); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); }
#endif
{ exper::ostream_joiner<int> oj(std::cout, 11); }
// Narrow streams w/lvalues
// Narrow streams w/lvalues
{ exper::ostream_joiner<char> oj(std::cout, eight); }
{ exper::ostream_joiner<std::string> oj(std::cout, nine); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<std::wstring> oj(std::cout, ten); }
#endif
{ exper::ostream_joiner<int> oj(std::cout, eleven); }
// Wide streams w/rvalues
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
// Wide streams w/rvalues
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); }
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); }
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); }
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, 11); }
// Wide streams w/lvalues
// Wide streams w/lvalues
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, eight); }
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, nine); }
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, ten); }
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, eleven); }
#endif
return 0;
}

View File

@@ -85,8 +85,10 @@ int main(int, char**) {
test("Z", chars, chars+10, "0Z1Z2Z3Z4Z5Z6Z7Z8Z9");
test("z", ints, ints+10, "10z11z12z13z14z15z16z17z18z19");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<char, const char *, wchar_t> ('X', chars, chars+10, L"0X1X2X3X4X5X6X7X8X9");
test<char, const int *, wchar_t> ('x', ints, ints+10, L"10x11x12x13x14x15x16x17x18x19");
#endif
// test<char, const char *, char16_t>('X', chars, chars+10, u"0X1X2X3X4X5X6X7X8X9");
// test<char, const int *, char16_t>('x', ints, ints+10, u"10x11x12x13x14x15x16x17x18x19");
// test<char, const char *, char32_t>('X', chars, chars+10, U"0X1X2X3X4X5X6X7X8X9");
@@ -96,6 +98,7 @@ int main(int, char**) {
test(mutating_delimiter2(), chars, chars+10, "0 1!2\"3#4$5%6&7'8(9");
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
const wchar_t chars[] = L"0123456789";
const int ints [] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
@@ -116,7 +119,7 @@ int main(int, char**) {
test(mutating_delimiter(), chars, chars+10, L"0 1!2\"3#4$5%6&7'8(9");
}
#endif // TEST_HAS_NO_WIDE_CHARACTERS
return 0;
}

View File

@@ -36,13 +36,17 @@ int main(int, char**) {
{ exper::ostream_joiner<char> oj(std::cout, '8'); test(oj); }
{ exper::ostream_joiner<std::string> oj(std::cout, std::string("9")); test(oj); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); test(oj); }
#endif
{ exper::ostream_joiner<int> oj(std::cout, 11); test(oj); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); test(oj); }
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); test(oj); }
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); test(oj); }
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, 11); test(oj); }
#endif
return 0;
}

View File

@@ -36,13 +36,17 @@ int main(int, char**) {
{ exper::ostream_joiner<char> oj(std::cout, '8'); test(oj); }
{ exper::ostream_joiner<std::string> oj(std::cout, std::string("9")); test(oj); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); test(oj); }
#endif
{ exper::ostream_joiner<int> oj(std::cout, 11); test(oj); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); test(oj); }
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); test(oj); }
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); test(oj); }
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, 11); test(oj); }
#endif
return 0;
}

View File

@@ -36,13 +36,17 @@ int main(int, char**) {
{ exper::ostream_joiner<char> oj(std::cout, '8'); test(oj); }
{ exper::ostream_joiner<std::string> oj(std::cout, std::string("9")); test(oj); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<std::wstring> oj(std::cout, std::wstring(L"10")); test(oj); }
#endif
{ exper::ostream_joiner<int> oj(std::cout, 11); test(oj); }
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{ exper::ostream_joiner<char, wchar_t> oj(std::wcout, '8'); test(oj); }
{ exper::ostream_joiner<std::string, wchar_t> oj(std::wcout, std::string("9")); test(oj); }
{ exper::ostream_joiner<std::wstring, wchar_t> oj(std::wcout, std::wstring(L"10")); test(oj); }
{ exper::ostream_joiner<int, wchar_t> oj(std::wcout, 11); test(oj); }
#endif
return 0;
}

View File

@@ -45,9 +45,11 @@ int main(int, char**)
{
{
test_match_result_typedef<const char*, pmr::cmatch>();
test_match_result_typedef<const wchar_t*, pmr::wcmatch>();
test_match_result_typedef<pmr::string::const_iterator, pmr::smatch>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_match_result_typedef<const wchar_t*, pmr::wcmatch>();
test_match_result_typedef<pmr::wstring::const_iterator, pmr::wsmatch>();
#endif
}
{
// Check that std::match_results has been included and is complete.

View File

@@ -54,13 +54,17 @@ int main(int, char**)
{
{
test_string_typedef<char, pmr::string>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_string_typedef<wchar_t, pmr::wstring>();
#endif
test_string_typedef<char16_t, pmr::u16string>();
test_string_typedef<char32_t, pmr::u32string>();
}
{
test_basic_string_alias<char, constexpr_char_traits<char>>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_basic_string_alias<wchar_t, constexpr_char_traits<wchar_t>>();
#endif
test_basic_string_alias<char16_t, constexpr_char_traits<char16_t>>();
test_basic_string_alias<char32_t, constexpr_char_traits<char32_t>>();
}

View File

@@ -927,8 +927,10 @@ int main(int, char**)
static_assert((std::is_same<decltype(std::imaxdiv(i, i)), std::imaxdiv_t>::value), "");
static_assert((std::is_same<decltype(std::strtoimax("", (char**)0, 0)), std::intmax_t>::value), "");
static_assert((std::is_same<decltype(std::strtoumax("", (char**)0, 0)), std::uintmax_t>::value), "");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert((std::is_same<decltype(std::wcstoimax(L"", (wchar_t**)0, 0)), std::intmax_t>::value), "");
static_assert((std::is_same<decltype(std::wcstoumax(L"", (wchar_t**)0, 0)), std::uintmax_t>::value), "");
#endif
return 0;
}

View File

@@ -36,6 +36,8 @@ int main(int, char**)
assert(f2.sgetc() == '2');
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
@@ -51,6 +53,7 @@ int main(int, char**)
assert(f2.sgetc() == L'2');
}
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -36,6 +36,8 @@ int main(int, char**)
assert(f2.sgetc() == '2');
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
@@ -51,6 +53,7 @@ int main(int, char**)
assert(f2.sgetc() == L'2');
}
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -38,6 +38,8 @@ int main(int, char**)
assert(f2.sgetc() == '2');
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
@@ -53,6 +55,7 @@ int main(int, char**)
assert(f2.sgetc() == L'2');
}
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -24,10 +24,12 @@ int main(int, char**)
std::filebuf f;
assert(!f.is_open());
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(!f.is_open());
}
#endif
return 0;
}

View File

@@ -35,6 +35,8 @@ int main(int, char**)
assert(f2.sgetc() == '2');
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
@@ -49,6 +51,7 @@ int main(int, char**)
assert(f2.sgetc() == L'2');
}
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -42,6 +42,8 @@ int main(int, char**) {
assert(f.sbumpc() == '3');
}
std::remove(p.string().c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(f.open(p, std::ios_base::out) != 0);
@@ -56,7 +58,8 @@ int main(int, char**) {
assert(f.sbumpc() == L'2');
assert(f.sbumpc() == L'3');
}
remove(p.string().c_str());
std::remove(p.string().c_str());
#endif
return 0;
}

View File

@@ -33,6 +33,8 @@ int main(int, char**)
assert(f.sbumpc() == '3');
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfilebuf f;
assert(f.open(temp.c_str(), std::ios_base::out) != 0);
@@ -47,7 +49,8 @@ int main(int, char**)
assert(f.sbumpc() == L'2');
assert(f.sbumpc() == L'3');
}
remove(temp.c_str());
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -80,6 +80,8 @@ int main(int, char**)
assert(f.sgetc() == 'a');
}
std::remove("overflow.dat");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test_buf<wchar_t> f;
assert(f.open("overflow.dat", std::ios_base::out) != 0);
@@ -143,6 +145,7 @@ int main(int, char**)
assert(f.sbumpc() == -1);
}
std::remove("overflow.dat");
#endif // TEST_HAS_NO_WIDE_CHARACTERS
return 0;
}

View File

@@ -43,6 +43,8 @@ int main(int, char**)
assert(f.sgetc() == 'l');
}
std::remove("seekoff.dat");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
wchar_t buf[10];
typedef std::filebuf::pos_type pos_type;
@@ -64,6 +66,7 @@ int main(int, char**)
assert(f.sgetc() == L'l');
}
std::remove("seekoff.dat");
#endif
return 0;
}

View File

@@ -78,6 +78,7 @@ int main(int, char**)
assert(*f.gptr() == '9');
assert(f.egptr() - f.gptr() == 1);
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
test_buf<wchar_t> f;
assert(f.open("underflow.dat", std::ios_base::in) != 0);
@@ -125,6 +126,7 @@ int main(int, char**)
assert(f.sbumpc() == 0x4E53);
assert(f.sbumpc() == static_cast<Traits::int_type>(-1));
}
#endif // TEST_HAS_NO_WIDE_CHARACTERS
return 0;
}

View File

@@ -65,6 +65,8 @@ int main(int, char**)
}
std::remove(temp1.c_str());
std::remove(temp2.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
@@ -88,6 +90,7 @@ int main(int, char**)
}
std::remove(temp1.c_str());
std::remove(temp2.c_str());
#endif
return 0;
}

View File

@@ -33,6 +33,8 @@ int main(int, char**)
assert(x == 3.25);
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
@@ -45,6 +47,7 @@ int main(int, char**)
assert(x == 3.25);
}
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -67,6 +67,8 @@ int main(int, char**)
}
std::remove(temp1.c_str());
std::remove(temp2.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
@@ -90,6 +92,7 @@ int main(int, char**)
}
std::remove(temp1.c_str());
std::remove(temp2.c_str());
#endif
return 0;
}

View File

@@ -23,9 +23,11 @@ int main(int, char**)
{
std::fstream fs;
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fs;
}
#endif
return 0;
}

View File

@@ -32,6 +32,8 @@ int main(int, char**)
assert(x == 3.25);
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
@@ -43,6 +45,7 @@ int main(int, char**)
assert(x == 3.25);
}
std::remove(temp.c_str());
#endif
return 0;
}

View File

@@ -40,6 +40,8 @@ int main(int, char**) {
assert(x == 3.25);
}
std::remove(p.string().c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fs(p, std::ios_base::in | std::ios_base::out |
std::ios_base::trunc);
@@ -50,6 +52,7 @@ int main(int, char**) {
assert(x == 3.25);
}
std::remove(p.string().c_str());
#endif
return 0;
}

View File

@@ -31,6 +31,8 @@ int main(int, char**)
assert(x == 3.25);
}
std::remove(temp.c_str());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
@@ -41,6 +43,7 @@ int main(int, char**)
assert(x == 3.25);
}
std::remove(temp.c_str());
#endif
return 0;
}

Some files were not shown because too many files have changed in this diff Show More