Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b13c5fc1a9 | ||
![]() |
4e66976786 | ||
![]() |
8074505c5d | ||
![]() |
efdce87766 | ||
![]() |
fd9aadef51 | ||
![]() |
6d50da017f | ||
![]() |
ae185c2977 | ||
![]() |
79356f49bd | ||
![]() |
9117a0a174 | ||
![]() |
591952787f | ||
![]() |
8082261d2c | ||
![]() |
b101cb1408 | ||
![]() |
cb5181c5a2 | ||
![]() |
c3089afe8d | ||
![]() |
be2e6396c3 | ||
![]() |
0428d2a325 | ||
![]() |
5ee0769693 | ||
![]() |
164d6b8bda | ||
![]() |
117920302f | ||
![]() |
16acf2ae93 | ||
![]() |
f9d6039245 | ||
![]() |
4cf42dadd4 | ||
![]() |
51ae55e510 | ||
![]() |
aeaeb51343 | ||
![]() |
b05cdf81ba | ||
![]() |
4a796725e0 | ||
![]() |
5a9ed2486b | ||
![]() |
beb21a0990 | ||
![]() |
12f526f712 | ||
![]() |
bd94c33cc3 | ||
![]() |
9dc188d64d | ||
![]() |
9055a62ed4 | ||
![]() |
17c8c462ae | ||
![]() |
ec97728ba0 |
@@ -13,6 +13,13 @@
|
|||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <yvals.h>
|
||||||
|
#undef _STD
|
||||||
|
#undef _C2
|
||||||
|
#define _LIBCPP_VISIBILITY_TAG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_VERSION 1000
|
#define _LIBCPP_VERSION 1000
|
||||||
|
|
||||||
#define _LIBCPP_ABI_VERSION 1
|
#define _LIBCPP_ABI_VERSION 1
|
||||||
@@ -47,6 +54,11 @@
|
|||||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
#endif // __FreeBSD__
|
#endif // __FreeBSD__
|
||||||
|
|
||||||
|
#if !defined(_LIBCPP_LITTLE_ENDIAN) && (defined(__i386__) || defined(__x86_64__))
|
||||||
|
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
|
#define _LIBCPP_BIG_ENDIAN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||||
# include <endian.h>
|
# include <endian.h>
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
@@ -98,7 +110,7 @@ typedef __char32_t char32_t;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_exceptions))
|
#if !(__has_feature(cxx_exceptions)) || defined(__MINGW32__)
|
||||||
#define _LIBCPP_NO_EXCEPTIONS
|
#define _LIBCPP_NO_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -19,7 +19,21 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
typedef _locale_t locale_t;
|
||||||
|
|
||||||
|
#include <xlocinfo.h>
|
||||||
|
#define LC_COLLATE_MASK _M_COLLATE
|
||||||
|
#define LC_CTYPE_MASK _M_CTYPE
|
||||||
|
#define LC_MONETARY_MASK _M_MONETARY
|
||||||
|
#define LC_NUMERIC_MASK _M_NUMERIC
|
||||||
|
#define LC_TIME_MASK _M_TIME
|
||||||
|
#define LC_MESSAGES_MASK _M_MESSAGES
|
||||||
|
#define LC_ALL_MASK _M_ALL
|
||||||
|
|
||||||
|
#else
|
||||||
#include <xlocale.h>
|
#include <xlocale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
@@ -302,7 +316,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
|||||||
class _LIBCPP_VISIBLE ctype_base
|
class _LIBCPP_VISIBLE ctype_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef __uint32_t mask;
|
typedef std::uint32_t mask;
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
static const mask space = _CTYPE_S;
|
static const mask space = _CTYPE_S;
|
||||||
@@ -315,6 +329,17 @@ public:
|
|||||||
static const mask punct = _CTYPE_P;
|
static const mask punct = _CTYPE_P;
|
||||||
static const mask xdigit = _CTYPE_X;
|
static const mask xdigit = _CTYPE_X;
|
||||||
static const mask blank = _CTYPE_B;
|
static const mask blank = _CTYPE_B;
|
||||||
|
#elif defined(__MINGW32__)
|
||||||
|
static const mask space = _SPACE;
|
||||||
|
static const mask print = (_BLANK|_PUNCT|_ALPHA|_DIGIT);
|
||||||
|
static const mask cntrl = _CONTROL;
|
||||||
|
static const mask upper = _UPPER;
|
||||||
|
static const mask lower = _LOWER;
|
||||||
|
static const mask alpha = _ALPHA;
|
||||||
|
static const mask digit = _DIGIT;
|
||||||
|
static const mask punct = _PUNCT;
|
||||||
|
static const mask xdigit = _HEX;
|
||||||
|
static const mask blank = _BLANK;
|
||||||
#else // __APPLE__
|
#else // __APPLE__
|
||||||
static const mask space = _ISspace;
|
static const mask space = _ISspace;
|
||||||
static const mask print = _ISprint;
|
static const mask print = _ISprint;
|
||||||
@@ -451,7 +476,7 @@ public:
|
|||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
bool is(mask __m, char_type __c) const
|
bool is(mask __m, char_type __c) const
|
||||||
{
|
{
|
||||||
return isascii(__c) ? (__tab_ ? __tab_[__c] & __m : isctype(__c, __m)) : false;
|
return isascii(__c) ? (__tab_ ? __tab_[__c] & __m : _isctype(__c, __m)) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
@@ -14,7 +14,35 @@
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
typedef unsigned pthread_t;
|
||||||
|
typedef unsigned pthread_mutex_t;
|
||||||
|
typedef unsigned pthread_mutexattr_t;
|
||||||
|
typedef unsigned pthread_cond_t;
|
||||||
|
typedef unsigned pthread_key_t;
|
||||||
|
#define PTHREAD_MUTEX_INITIALIZER 0
|
||||||
|
#define PTHREAD_COND_INITIALIZER 0
|
||||||
|
#define PTHREAD_MUTEX_RECURSIVE 0
|
||||||
|
#define pthread_mutex_init(a,b) (*(a) = 0, -1)
|
||||||
|
#define pthread_mutex_destroy(a) (-1)
|
||||||
|
#define pthread_mutex_lock(a) (-1)
|
||||||
|
#define pthread_mutex_trylock(a) (-1)
|
||||||
|
#define pthread_mutex_unlock(a) (-1)
|
||||||
|
#define pthread_mutexattr_settype(a,b) (*(a) = (b), -1)
|
||||||
|
#define pthread_mutexattr_init(a) (*(a) = 0, -1)
|
||||||
|
#define pthread_mutexattr_destroy(a) (-1)
|
||||||
|
#define pthread_self() (-1)
|
||||||
|
#define pthread_equal(a,b) (0)
|
||||||
|
#define pthread_getspecific(a) ((void*)0)
|
||||||
|
#define pthread_cond_destroy(a) (-1)
|
||||||
|
#define pthread_cond_signal(a) (-1)
|
||||||
|
#define pthread_cond_broadcast(a) (-1)
|
||||||
|
#define pthread_cond_wait(a,b) (-1)
|
||||||
|
#define pthread_cond_timedwait(a,b,c) (-1)
|
||||||
|
#define sched_yield() (-1)
|
||||||
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
@@ -173,6 +173,11 @@ typedef basic_fstream<wchar_t> wfstream;
|
|||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define fseeko fseek
|
||||||
|
#define ftello ftell
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
|
@@ -186,7 +186,10 @@ template <class charT> class messages_byname;
|
|||||||
#endif
|
#endif
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include <nl_types.h>
|
#include <nl_types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
@@ -303,7 +306,14 @@ __nolocale_asprintf(char** __ret,
|
|||||||
{
|
{
|
||||||
va_list __ap;
|
va_list __ap;
|
||||||
va_start(__ap, __format);
|
va_start(__ap, __format);
|
||||||
int __result = vasprintf(__ret, __format, __ap);
|
int __result;
|
||||||
|
#ifdef _WIN32
|
||||||
|
*__ret = (char*)malloc(4096);
|
||||||
|
__result = vsprintf(*__ret, __format, __ap);
|
||||||
|
*__ret = (char*)realloc(*__ret, __result + 1);
|
||||||
|
#else
|
||||||
|
__result = vasprintf(__ret, __format, __ap);
|
||||||
|
#endif
|
||||||
va_end(__ap);
|
va_end(__ap);
|
||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
@@ -748,7 +758,12 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
|||||||
int __save_errno = errno;
|
int __save_errno = errno;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *__p2;
|
char *__p2;
|
||||||
long long __ll = strtoll_l(__a, &__p2, __base, 0);
|
long long __ll;
|
||||||
|
#ifdef _WIN32
|
||||||
|
__ll = _strtoi64_l(__a, &__p2, __base, 0);
|
||||||
|
#else
|
||||||
|
__ll = strtoll_l(__a, &__p2, __base, 0);
|
||||||
|
#endif
|
||||||
int __current_errno = errno;
|
int __current_errno = errno;
|
||||||
if (__current_errno == 0)
|
if (__current_errno == 0)
|
||||||
errno = __save_errno;
|
errno = __save_errno;
|
||||||
@@ -788,7 +803,12 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
|||||||
int __save_errno = errno;
|
int __save_errno = errno;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *__p2;
|
char *__p2;
|
||||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
|
unsigned long long __ll;
|
||||||
|
#ifdef _WIN32
|
||||||
|
__ll = _strtoui64_l(__a, &__p2, __base, 0);
|
||||||
|
#else
|
||||||
|
__ll = strtoull_l(__a, &__p2, __base, 0);
|
||||||
|
#endif
|
||||||
int __current_errno = errno;
|
int __current_errno = errno;
|
||||||
if (__current_errno == 0)
|
if (__current_errno == 0)
|
||||||
errno = __save_errno;
|
errno = __save_errno;
|
||||||
@@ -816,7 +836,13 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
|
|||||||
if (__a != __a_end)
|
if (__a != __a_end)
|
||||||
{
|
{
|
||||||
char *__p2;
|
char *__p2;
|
||||||
long double __ld = strtold_l(__a, &__p2, 0);
|
long double __ld;
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Win32 does not use "long double".
|
||||||
|
__ld = _strtod_l(__a, &__p2, 0);
|
||||||
|
#else
|
||||||
|
__ld = strtold_l(__a, &__p2, 0);
|
||||||
|
#endif
|
||||||
if (__p2 != __a_end)
|
if (__p2 != __a_end)
|
||||||
{
|
{
|
||||||
__err = ios_base::failbit;
|
__err = ios_base::failbit;
|
||||||
@@ -1676,11 +1702,17 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
|||||||
template <class _CharT, class _OutputIterator>
|
template <class _CharT, class _OutputIterator>
|
||||||
_OutputIterator
|
_OutputIterator
|
||||||
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||||
char_type __fl, long double __v) const
|
char_type __fl, long double __lv) const
|
||||||
{
|
{
|
||||||
// Stage 1 - Get number in narrow char
|
// Stage 1 - Get number in narrow char
|
||||||
char __fmt[8] = {'%', 0};
|
char __fmt[8] = {'%', 0};
|
||||||
|
#ifdef _WIN32
|
||||||
|
const char* __len = "";
|
||||||
|
double __v = __lv;
|
||||||
|
#else
|
||||||
const char* __len = "L";
|
const char* __len = "L";
|
||||||
|
long double __v = __lv;
|
||||||
|
#endif
|
||||||
bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
|
bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
|
||||||
const unsigned __nbuf = 30;
|
const unsigned __nbuf = 30;
|
||||||
char __nar[__nbuf];
|
char __nar[__nbuf];
|
||||||
@@ -3565,10 +3597,14 @@ template <class _CharT>
|
|||||||
typename messages<_CharT>::catalog
|
typename messages<_CharT>::catalog
|
||||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||||
{
|
{
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
||||||
if (__cat != -1)
|
if (__cat != -1)
|
||||||
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
||||||
return __cat;
|
return __cat;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
@@ -3576,6 +3612,10 @@ typename messages<_CharT>::string_type
|
|||||||
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||||
const string_type& __dflt) const
|
const string_type& __dflt) const
|
||||||
{
|
{
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
string_type __w;
|
||||||
|
return __w;
|
||||||
|
#else
|
||||||
string __ndflt;
|
string __ndflt;
|
||||||
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
|
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
|
||||||
__dflt.c_str(),
|
__dflt.c_str(),
|
||||||
@@ -3588,16 +3628,19 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
|||||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||||
__n, __n + strlen(__n));
|
__n, __n + strlen(__n));
|
||||||
return __w;
|
return __w;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
void
|
void
|
||||||
messages<_CharT>::do_close(catalog __c) const
|
messages<_CharT>::do_close(catalog __c) const
|
||||||
{
|
{
|
||||||
|
#ifndef __MINGW32__
|
||||||
if (__c != -1)
|
if (__c != -1)
|
||||||
__c <<= 1;
|
__c <<= 1;
|
||||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||||
catclose(__cat);
|
catclose(__cat);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern template class messages<char>;
|
extern template class messages<char>;
|
||||||
|
12
include/new
12
include/new
@@ -90,6 +90,18 @@ _LIBCPP_VISIBLE new_handler get_new_handler() throw();
|
|||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
#include <cxxabi.h>
|
||||||
|
// On Darwin, there are two STL shared libraries and a lower level ABI
|
||||||
|
// shared libray. The global holding the current new handler is
|
||||||
|
// in the ABI library and named __cxa_new_handler.
|
||||||
|
#define __new_handler __cxxabiapple::__cxa_new_handler
|
||||||
|
#else // __APPLE__
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
extern ::std::new_handler __new_handler;
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
|
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
|
||||||
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
|
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
|
||||||
_LIBCPP_VISIBLE void operator delete(void*) throw();
|
_LIBCPP_VISIBLE void operator delete(void*) throw();
|
||||||
|
@@ -115,22 +115,22 @@ public:
|
|||||||
|
|
||||||
enum class errc
|
enum class errc
|
||||||
{
|
{
|
||||||
address_family_not_supported, // EAFNOSUPPORT
|
// address_family_not_supported, // EAFNOSUPPORT
|
||||||
address_in_use, // EADDRINUSE
|
// address_in_use, // EADDRINUSE
|
||||||
address_not_available, // EADDRNOTAVAIL
|
// address_not_available, // EADDRNOTAVAIL
|
||||||
already_connected, // EISCONN
|
// already_connected, // EISCONN
|
||||||
argument_list_too_long, // E2BIG
|
argument_list_too_long, // E2BIG
|
||||||
argument_out_of_domain, // EDOM
|
argument_out_of_domain, // EDOM
|
||||||
bad_address, // EFAULT
|
bad_address, // EFAULT
|
||||||
bad_file_descriptor, // EBADF
|
bad_file_descriptor, // EBADF
|
||||||
bad_message, // EBADMSG
|
// bad_message, // EBADMSG
|
||||||
broken_pipe, // EPIPE
|
broken_pipe, // EPIPE
|
||||||
connection_aborted, // ECONNABORTED
|
// connection_aborted, // ECONNABORTED
|
||||||
connection_already_in_progress, // EALREADY
|
// connection_already_in_progress, // EALREADY
|
||||||
connection_refused, // ECONNREFUSED
|
// connection_refused, // ECONNREFUSED
|
||||||
connection_reset, // ECONNRESET
|
// connection_reset, // ECONNRESET
|
||||||
cross_device_link, // EXDEV
|
cross_device_link, // EXDEV
|
||||||
destination_address_required, // EDESTADDRREQ
|
// destination_address_required, // EDESTADDRREQ
|
||||||
device_or_resource_busy, // EBUSY
|
device_or_resource_busy, // EBUSY
|
||||||
directory_not_empty, // ENOTEMPTY
|
directory_not_empty, // ENOTEMPTY
|
||||||
executable_format_error, // ENOEXEC
|
executable_format_error, // ENOEXEC
|
||||||
@@ -138,8 +138,8 @@ enum class errc
|
|||||||
file_too_large, // EFBIG
|
file_too_large, // EFBIG
|
||||||
filename_too_long, // ENAMETOOLONG
|
filename_too_long, // ENAMETOOLONG
|
||||||
function_not_supported, // ENOSYS
|
function_not_supported, // ENOSYS
|
||||||
host_unreachable, // EHOSTUNREACH
|
// host_unreachable, // EHOSTUNREACH
|
||||||
identifier_removed, // EIDRM
|
// identifier_removed, // EIDRM
|
||||||
illegal_byte_sequence, // EILSEQ
|
illegal_byte_sequence, // EILSEQ
|
||||||
inappropriate_io_control_operation, // ENOTTY
|
inappropriate_io_control_operation, // ENOTTY
|
||||||
interrupted, // EINTR
|
interrupted, // EINTR
|
||||||
@@ -147,16 +147,16 @@ enum class errc
|
|||||||
invalid_seek, // ESPIPE
|
invalid_seek, // ESPIPE
|
||||||
io_error, // EIO
|
io_error, // EIO
|
||||||
is_a_directory, // EISDIR
|
is_a_directory, // EISDIR
|
||||||
message_size, // EMSGSIZE
|
// message_size, // EMSGSIZE
|
||||||
network_down, // ENETDOWN
|
// network_down, // ENETDOWN
|
||||||
network_reset, // ENETRESET
|
// network_reset, // ENETRESET
|
||||||
network_unreachable, // ENETUNREACH
|
// network_unreachable, // ENETUNREACH
|
||||||
no_buffer_space, // ENOBUFS
|
// no_buffer_space, // ENOBUFS
|
||||||
no_child_process, // ECHILD
|
no_child_process, // ECHILD
|
||||||
no_link, // ENOLINK
|
// no_link, // ENOLINK
|
||||||
no_lock_available, // ENOLCK
|
no_lock_available, // ENOLCK
|
||||||
no_message_available, // ENODATA
|
no_message_available, // ENODATA
|
||||||
no_message, // ENOMSG
|
// no_message, // ENOMSG
|
||||||
no_protocol_option, // ENOPROTOOPT
|
no_protocol_option, // ENOPROTOOPT
|
||||||
no_space_on_device, // ENOSPC
|
no_space_on_device, // ENOSPC
|
||||||
no_stream_resources, // ENOSR
|
no_stream_resources, // ENOSR
|
||||||
@@ -246,22 +246,42 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
|
|||||||
struct errc
|
struct errc
|
||||||
{
|
{
|
||||||
enum _ {
|
enum _ {
|
||||||
|
#ifdef EAFNOSUPPORT
|
||||||
address_family_not_supported = EAFNOSUPPORT,
|
address_family_not_supported = EAFNOSUPPORT,
|
||||||
|
#endif
|
||||||
|
#ifdef EADDRINUSE
|
||||||
address_in_use = EADDRINUSE,
|
address_in_use = EADDRINUSE,
|
||||||
|
#endif
|
||||||
|
#ifdef EADDRNOTAVAIL
|
||||||
address_not_available = EADDRNOTAVAIL,
|
address_not_available = EADDRNOTAVAIL,
|
||||||
|
#endif
|
||||||
|
#ifdef EISCONN
|
||||||
already_connected = EISCONN,
|
already_connected = EISCONN,
|
||||||
|
#endif
|
||||||
argument_list_too_long = E2BIG,
|
argument_list_too_long = E2BIG,
|
||||||
argument_out_of_domain = EDOM,
|
argument_out_of_domain = EDOM,
|
||||||
bad_address = EFAULT,
|
bad_address = EFAULT,
|
||||||
bad_file_descriptor = EBADF,
|
bad_file_descriptor = EBADF,
|
||||||
|
#ifdef EBADMSG
|
||||||
bad_message = EBADMSG,
|
bad_message = EBADMSG,
|
||||||
|
#endif
|
||||||
broken_pipe = EPIPE,
|
broken_pipe = EPIPE,
|
||||||
|
#ifdef ECONNABORTED
|
||||||
connection_aborted = ECONNABORTED,
|
connection_aborted = ECONNABORTED,
|
||||||
|
#endif
|
||||||
|
#ifdef EALREADY
|
||||||
connection_already_in_progress = EALREADY,
|
connection_already_in_progress = EALREADY,
|
||||||
|
#endif
|
||||||
|
#ifdef ECONNREFUSED
|
||||||
connection_refused = ECONNREFUSED,
|
connection_refused = ECONNREFUSED,
|
||||||
|
#endif
|
||||||
|
#ifdef ECONNRESET
|
||||||
connection_reset = ECONNRESET,
|
connection_reset = ECONNRESET,
|
||||||
|
#endif
|
||||||
cross_device_link = EXDEV,
|
cross_device_link = EXDEV,
|
||||||
|
#ifdef EDESTADDRREQ
|
||||||
destination_address_required = EDESTADDRREQ,
|
destination_address_required = EDESTADDRREQ,
|
||||||
|
#endif
|
||||||
device_or_resource_busy = EBUSY,
|
device_or_resource_busy = EBUSY,
|
||||||
directory_not_empty = ENOTEMPTY,
|
directory_not_empty = ENOTEMPTY,
|
||||||
executable_format_error = ENOEXEC,
|
executable_format_error = ENOEXEC,
|
||||||
@@ -269,8 +289,12 @@ enum _ {
|
|||||||
file_too_large = EFBIG,
|
file_too_large = EFBIG,
|
||||||
filename_too_long = ENAMETOOLONG,
|
filename_too_long = ENAMETOOLONG,
|
||||||
function_not_supported = ENOSYS,
|
function_not_supported = ENOSYS,
|
||||||
|
#ifdef EHOSTUNREACH
|
||||||
host_unreachable = EHOSTUNREACH,
|
host_unreachable = EHOSTUNREACH,
|
||||||
|
#endif
|
||||||
|
#ifdef EIDRM
|
||||||
identifier_removed = EIDRM,
|
identifier_removed = EIDRM,
|
||||||
|
#endif
|
||||||
illegal_byte_sequence = EILSEQ,
|
illegal_byte_sequence = EILSEQ,
|
||||||
inappropriate_io_control_operation = ENOTTY,
|
inappropriate_io_control_operation = ENOTTY,
|
||||||
interrupted = EINTR,
|
interrupted = EINTR,
|
||||||
@@ -278,21 +302,37 @@ enum _ {
|
|||||||
invalid_seek = ESPIPE,
|
invalid_seek = ESPIPE,
|
||||||
io_error = EIO,
|
io_error = EIO,
|
||||||
is_a_directory = EISDIR,
|
is_a_directory = EISDIR,
|
||||||
|
#ifdef EMSGSIZE
|
||||||
message_size = EMSGSIZE,
|
message_size = EMSGSIZE,
|
||||||
|
#endif
|
||||||
|
#ifdef ENETDOWN
|
||||||
network_down = ENETDOWN,
|
network_down = ENETDOWN,
|
||||||
|
#endif
|
||||||
|
#ifdef ENETRESET
|
||||||
network_reset = ENETRESET,
|
network_reset = ENETRESET,
|
||||||
|
#endif
|
||||||
|
#ifdef ENETUNREACH
|
||||||
network_unreachable = ENETUNREACH,
|
network_unreachable = ENETUNREACH,
|
||||||
|
#endif
|
||||||
|
#ifdef ENOBUFS
|
||||||
no_buffer_space = ENOBUFS,
|
no_buffer_space = ENOBUFS,
|
||||||
|
#endif
|
||||||
no_child_process = ECHILD,
|
no_child_process = ECHILD,
|
||||||
|
#ifdef ENOLINK
|
||||||
no_link = ENOLINK,
|
no_link = ENOLINK,
|
||||||
|
#endif
|
||||||
no_lock_available = ENOLCK,
|
no_lock_available = ENOLCK,
|
||||||
|
#ifdef ENOMSG
|
||||||
#ifdef ENODATA
|
#ifdef ENODATA
|
||||||
no_message_available = ENODATA,
|
no_message_available = ENODATA,
|
||||||
#else
|
#else
|
||||||
no_message_available = ENOMSG,
|
no_message_available = ENOMSG,
|
||||||
#endif
|
#endif
|
||||||
no_message = ENOMSG,
|
no_message = ENOMSG,
|
||||||
|
#endif
|
||||||
|
#ifdef ENOPROTOOPT,
|
||||||
no_protocol_option = ENOPROTOOPT,
|
no_protocol_option = ENOPROTOOPT,
|
||||||
|
#endif
|
||||||
no_space_on_device = ENOSPC,
|
no_space_on_device = ENOSPC,
|
||||||
#ifdef ENOSR
|
#ifdef ENOSR
|
||||||
no_stream_resources = ENOSR,
|
no_stream_resources = ENOSR,
|
||||||
@@ -304,24 +344,42 @@ enum _ {
|
|||||||
no_such_file_or_directory = ENOENT,
|
no_such_file_or_directory = ENOENT,
|
||||||
no_such_process = ESRCH,
|
no_such_process = ESRCH,
|
||||||
not_a_directory = ENOTDIR,
|
not_a_directory = ENOTDIR,
|
||||||
|
#ifdef ENOTSOCK
|
||||||
not_a_socket = ENOTSOCK,
|
not_a_socket = ENOTSOCK,
|
||||||
|
#endif
|
||||||
#ifdef ENOSTR
|
#ifdef ENOSTR
|
||||||
not_a_stream = ENOSTR,
|
not_a_stream = ENOSTR,
|
||||||
#else
|
#else
|
||||||
not_a_stream = EINVAL,
|
not_a_stream = EINVAL,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENOTCONN
|
||||||
not_connected = ENOTCONN,
|
not_connected = ENOTCONN,
|
||||||
|
#endif
|
||||||
not_enough_memory = ENOMEM,
|
not_enough_memory = ENOMEM,
|
||||||
|
#ifdef ENOTSUP
|
||||||
not_supported = ENOTSUP,
|
not_supported = ENOTSUP,
|
||||||
|
#endif
|
||||||
|
#ifdef ECANCELED
|
||||||
operation_canceled = ECANCELED,
|
operation_canceled = ECANCELED,
|
||||||
|
#endif
|
||||||
|
#ifdef EINPROGRESS
|
||||||
operation_in_progress = EINPROGRESS,
|
operation_in_progress = EINPROGRESS,
|
||||||
|
#endif
|
||||||
operation_not_permitted = EPERM,
|
operation_not_permitted = EPERM,
|
||||||
|
#ifdef EOPNOTSUPP
|
||||||
operation_not_supported = EOPNOTSUPP,
|
operation_not_supported = EOPNOTSUPP,
|
||||||
|
#endif
|
||||||
|
#ifdef EWOULDBLOCK
|
||||||
operation_would_block = EWOULDBLOCK,
|
operation_would_block = EWOULDBLOCK,
|
||||||
|
#endif
|
||||||
owner_dead = EOWNERDEAD,
|
owner_dead = EOWNERDEAD,
|
||||||
permission_denied = EACCES,
|
permission_denied = EACCES,
|
||||||
|
#ifdef EPROTO
|
||||||
protocol_error = EPROTO,
|
protocol_error = EPROTO,
|
||||||
|
#endif
|
||||||
|
#ifdef EPROTONOSUPPORT
|
||||||
protocol_not_supported = EPROTONOSUPPORT,
|
protocol_not_supported = EPROTONOSUPPORT,
|
||||||
|
#endif
|
||||||
read_only_file_system = EROFS,
|
read_only_file_system = EROFS,
|
||||||
resource_deadlock_would_occur = EDEADLK,
|
resource_deadlock_would_occur = EDEADLK,
|
||||||
resource_unavailable_try_again = EAGAIN,
|
resource_unavailable_try_again = EAGAIN,
|
||||||
@@ -329,17 +387,27 @@ enum _ {
|
|||||||
state_not_recoverable = ENOTRECOVERABLE,
|
state_not_recoverable = ENOTRECOVERABLE,
|
||||||
#ifdef ETIME
|
#ifdef ETIME
|
||||||
stream_timeout = ETIME,
|
stream_timeout = ETIME,
|
||||||
#else
|
#elif defined(ETIMEDOUT)
|
||||||
stream_timeout = ETIMEDOUT,
|
stream_timeout = ETIMEDOUT,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ETXTBSY
|
||||||
text_file_busy = ETXTBSY,
|
text_file_busy = ETXTBSY,
|
||||||
|
#endif
|
||||||
|
#ifdef ETIMEDOUT
|
||||||
timed_out = ETIMEDOUT,
|
timed_out = ETIMEDOUT,
|
||||||
|
#endif
|
||||||
too_many_files_open_in_system = ENFILE,
|
too_many_files_open_in_system = ENFILE,
|
||||||
too_many_files_open = EMFILE,
|
too_many_files_open = EMFILE,
|
||||||
too_many_links = EMLINK,
|
too_many_links = EMLINK,
|
||||||
|
#ifdef ELOOP
|
||||||
too_many_symbolic_link_levels = ELOOP,
|
too_many_symbolic_link_levels = ELOOP,
|
||||||
|
#endif
|
||||||
|
#ifdef EOVERFLOW
|
||||||
value_too_large = EOVERFLOW,
|
value_too_large = EOVERFLOW,
|
||||||
wrong_protocol_type = EPROTOTYPE
|
#endif
|
||||||
|
#ifdef EPROTOTYPE
|
||||||
|
wrong_protocol_type = EPROTOTYPE,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
_ __v_;
|
_ __v_;
|
||||||
|
@@ -95,7 +95,15 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
|
|||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <__mutex_base>
|
#include <__mutex_base>
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#define pthread_key_delete(a) (-1)
|
||||||
|
#define pthread_join(a,b) (-1)
|
||||||
|
#define pthread_detach(a) (-1)
|
||||||
|
#define nanosleep(a,b) (-1)
|
||||||
|
#define pthread_key_create(a,b) (-1)
|
||||||
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
|
|||||||
target_link_libraries(cxx ${libraries})
|
target_link_libraries(cxx ${libraries})
|
||||||
|
|
||||||
# Setup flags.
|
# Setup flags.
|
||||||
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
|
#append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
|
||||||
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
|
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
|
||||||
|
|
||||||
set_target_properties(cxx
|
set_target_properties(cxx
|
||||||
|
@@ -116,10 +116,16 @@ steady_clock::now()
|
|||||||
steady_clock::time_point
|
steady_clock::time_point
|
||||||
steady_clock::now()
|
steady_clock::now()
|
||||||
{
|
{
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
timeval tv;
|
||||||
|
gettimeofday(&tv, 0);
|
||||||
|
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
|
||||||
|
#else
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
|
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
|
||||||
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
|
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
|
||||||
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
@@ -57,8 +57,10 @@ condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
|
|||||||
ts.tv_sec = static_cast<decltype(ts.tv_sec)>(s.count());
|
ts.tv_sec = static_cast<decltype(ts.tv_sec)>(s.count());
|
||||||
ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
|
ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
|
||||||
int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
|
int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
|
||||||
|
#ifndef __MINGW32__
|
||||||
if (ec != 0 && ec != ETIMEDOUT)
|
if (ec != 0 && ec != ETIMEDOUT)
|
||||||
__throw_system_error(ec, "condition_variable timed_wait failed");
|
__throw_system_error(ec, "condition_variable timed_wait failed");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -77,6 +77,9 @@ std::terminate()
|
|||||||
|
|
||||||
bool std::uncaught_exception() throw()
|
bool std::uncaught_exception() throw()
|
||||||
{
|
{
|
||||||
|
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
// on Darwin, there is a helper function so __cxa_get_globals is private
|
// on Darwin, there is a helper function so __cxa_get_globals is private
|
||||||
return __cxxabiapple::__cxa_uncaught_exception();
|
return __cxxabiapple::__cxa_uncaught_exception();
|
||||||
|
@@ -18,7 +18,20 @@
|
|||||||
#include "cstring"
|
#include "cstring"
|
||||||
#include "cwctype"
|
#include "cwctype"
|
||||||
#include "__sso_allocator"
|
#include "__sso_allocator"
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#define iswctype_l _iswctype_l
|
||||||
|
#define strcoll_l _strcoll_l
|
||||||
|
#define strftime_l(a,b,c,d,e) strftime(a,b,c,d)
|
||||||
|
#define strxfrm_l _strxfrm_l
|
||||||
|
#define tolower_l _tolower_l
|
||||||
|
#define toupper_l _toupper_l
|
||||||
|
#define towlower_l _towlower_l
|
||||||
|
#define towupper_l _towupper_l
|
||||||
|
#define wcscoll_l _wcscoll_l
|
||||||
|
#define wcsxfrm_l _wcsxfrm_l
|
||||||
|
#else
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
@@ -561,6 +574,22 @@ locale::id::__init()
|
|||||||
|
|
||||||
// template <> class collate_byname<char>
|
// template <> class collate_byname<char>
|
||||||
|
|
||||||
|
static inline
|
||||||
|
locale_t newlocale(int m, const char *l, locale_t b) {
|
||||||
|
#if 0
|
||||||
|
return _create_locale(LC_ALL, l);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
void freelocale(locale_t p) {
|
||||||
|
#if 0 // why!
|
||||||
|
_free_locale(p);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
collate_byname<char>::collate_byname(const char* n, size_t refs)
|
collate_byname<char>::collate_byname(const char* n, size_t refs)
|
||||||
: collate<char>(refs),
|
: collate<char>(refs),
|
||||||
__l(newlocale(LC_ALL_MASK, n, 0))
|
__l(newlocale(LC_ALL_MASK, n, 0))
|
||||||
@@ -1359,6 +1388,9 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
|
|||||||
for (extern_type* p = tmp; n; --n) // write it
|
for (extern_type* p = tmp; n; --n) // write it
|
||||||
*to_nxt++ = *p++;
|
*to_nxt++ = *p++;
|
||||||
return ok;
|
return ok;
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
to_nxt = to;
|
||||||
|
return noconv;
|
||||||
#else
|
#else
|
||||||
return error;
|
return error;
|
||||||
#endif
|
#endif
|
||||||
|
102
src/new.cpp
102
src/new.cpp
@@ -18,110 +18,16 @@
|
|||||||
// in the ABI library and named __cxa_new_handler.
|
// in the ABI library and named __cxa_new_handler.
|
||||||
#define __new_handler __cxxabiapple::__cxa_new_handler
|
#define __new_handler __cxxabiapple::__cxa_new_handler
|
||||||
#else // __APPLE__
|
#else // __APPLE__
|
||||||
static std::new_handler __new_handler;
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
::std::new_handler __new_handler;
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Implement all new and delete operators as weak definitions
|
// Implement all new and delete operators as weak definitions
|
||||||
// in this shared library, so that they can be overriden by programs
|
// in this shared library, so that they can be overriden by programs
|
||||||
// that define non-weak copies of the functions.
|
// that define non-weak copies of the functions.
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void *
|
|
||||||
operator new(std::size_t size) throw (std::bad_alloc)
|
|
||||||
{
|
|
||||||
if (size == 0)
|
|
||||||
size = 1;
|
|
||||||
void* p;
|
|
||||||
while ((p = ::malloc(size)) == 0)
|
|
||||||
{
|
|
||||||
// If malloc fails and there is a new_handler,
|
|
||||||
// call it to try free up memory.
|
|
||||||
std::new_handler nh = std::get_new_handler();
|
|
||||||
if (nh)
|
|
||||||
nh();
|
|
||||||
else
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
throw std::bad_alloc();
|
|
||||||
#else
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void*
|
|
||||||
operator new(size_t size, const std::nothrow_t&) throw()
|
|
||||||
{
|
|
||||||
void* p = 0;
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
|
||||||
p = ::operator new(size);
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void*
|
|
||||||
operator new[](size_t size) throw (std::bad_alloc)
|
|
||||||
{
|
|
||||||
return ::operator new(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void*
|
|
||||||
operator new[](size_t size, const std::nothrow_t& nothrow) throw()
|
|
||||||
{
|
|
||||||
void* p = 0;
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
|
||||||
p = ::operator new[](size);
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void
|
|
||||||
operator delete(void* ptr) throw ()
|
|
||||||
{
|
|
||||||
if (ptr)
|
|
||||||
::free(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void
|
|
||||||
operator delete(void* ptr, const std::nothrow_t&) throw ()
|
|
||||||
{
|
|
||||||
::operator delete(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void
|
|
||||||
operator delete[] (void* ptr) throw ()
|
|
||||||
{
|
|
||||||
::operator delete (ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((__weak__, __visibility__("default")))
|
|
||||||
void
|
|
||||||
operator delete[] (void* ptr, const std::nothrow_t&) throw ()
|
|
||||||
{
|
|
||||||
::operator delete[](ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
7
src/new_ZdaPv.cpp
Normal file
7
src/new_ZdaPv.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "new"
|
||||||
|
|
||||||
|
void
|
||||||
|
operator delete[] (void* ptr) throw ()
|
||||||
|
{
|
||||||
|
::operator delete (ptr);
|
||||||
|
}
|
7
src/new_ZdaPvRKSt9nothrow_t.cpp
Normal file
7
src/new_ZdaPvRKSt9nothrow_t.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "new"
|
||||||
|
|
||||||
|
void
|
||||||
|
operator delete[] (void* ptr, const std::nothrow_t&) throw ()
|
||||||
|
{
|
||||||
|
::operator delete[](ptr);
|
||||||
|
}
|
10
src/new_ZdlPv.cpp
Normal file
10
src/new_ZdlPv.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "new"
|
||||||
|
|
||||||
|
void
|
||||||
|
operator delete(void* ptr) throw ()
|
||||||
|
{
|
||||||
|
if (ptr)
|
||||||
|
::free(ptr);
|
||||||
|
}
|
7
src/new_ZdlPvRKSt9nothrow_t.cpp
Normal file
7
src/new_ZdlPvRKSt9nothrow_t.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "new"
|
||||||
|
|
||||||
|
void
|
||||||
|
operator delete(void* ptr, const std::nothrow_t&) throw ()
|
||||||
|
{
|
||||||
|
::operator delete(ptr);
|
||||||
|
}
|
7
src/new_Znay.cpp
Normal file
7
src/new_Znay.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include "new"
|
||||||
|
|
||||||
|
void*
|
||||||
|
operator new[](size_t size) throw (std::bad_alloc)
|
||||||
|
{
|
||||||
|
return ::operator new(size);
|
||||||
|
}
|
19
src/new_ZnayRKSt9nothrow_t.cpp
Normal file
19
src/new_ZnayRKSt9nothrow_t.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "new"
|
||||||
|
|
||||||
|
void*
|
||||||
|
operator new[](size_t size, const std::nothrow_t& nothrow) throw()
|
||||||
|
{
|
||||||
|
void* p = 0;
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
p = ::operator new[](size);
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
return p;
|
||||||
|
}
|
26
src/new_Znwy.cpp
Normal file
26
src/new_Znwy.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "new"
|
||||||
|
|
||||||
|
void *
|
||||||
|
operator new(std::size_t size) throw (std::bad_alloc)
|
||||||
|
{
|
||||||
|
if (size == 0)
|
||||||
|
size = 1;
|
||||||
|
void* p;
|
||||||
|
while ((p = ::malloc(size)) == 0)
|
||||||
|
{
|
||||||
|
// If malloc fails and there is a new_handler,
|
||||||
|
// call it to try free up memory.
|
||||||
|
std::new_handler nh = std::get_new_handler();
|
||||||
|
if (nh)
|
||||||
|
nh();
|
||||||
|
else
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
throw std::bad_alloc();
|
||||||
|
#else
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
19
src/new_ZnwyRKSt9nothrow_t.cpp
Normal file
19
src/new_ZnwyRKSt9nothrow_t.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "new"
|
||||||
|
|
||||||
|
void*
|
||||||
|
operator new(size_t size, const std::nothrow_t&) throw()
|
||||||
|
{
|
||||||
|
void* p = 0;
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
p = ::operator new(size);
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
|
return p;
|
||||||
|
}
|
@@ -7,11 +7,17 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#define MINGW_HAS_SECURE_API
|
||||||
|
|
||||||
#include "string"
|
#include "string"
|
||||||
#include "cstdlib"
|
#include "cstdlib"
|
||||||
#include "cwchar"
|
#include "cwchar"
|
||||||
#include "cerrno"
|
#include "cerrno"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define swprintf swprintf_s
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template class __basic_string_common<true>;
|
template class __basic_string_common<true>;
|
||||||
|
@@ -12,7 +12,10 @@
|
|||||||
#include "vector"
|
#include "vector"
|
||||||
#include "future"
|
#include "future"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#else
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
15
test/_win32_seterrormode.fail.cpp
Normal file
15
test/_win32_seterrormode.fail.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class Win32ctor {
|
||||||
|
public:
|
||||||
|
Win32ctor() {
|
||||||
|
SetErrorMode(SEM_FAILCRITICALERRORS |
|
||||||
|
SEM_NOGPFAULTERRORBOX |
|
||||||
|
SEM_NOOPENFILEERRORBOX);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static Win32ctor ctor;
|
||||||
|
}
|
@@ -1,341 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// test <cerrno>
|
|
||||||
|
|
||||||
#include <cerrno>
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_VERSION
|
|
||||||
#error _LIBCPP_VERSION not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef E2BIG
|
|
||||||
#error E2BIG not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EACCES
|
|
||||||
#error EACCES not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EACCES
|
|
||||||
#error EACCES not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EADDRINUSE
|
|
||||||
#error EADDRINUSE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EADDRNOTAVAIL
|
|
||||||
#error EADDRNOTAVAIL not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EAFNOSUPPORT
|
|
||||||
#error EAFNOSUPPORT not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EAGAIN
|
|
||||||
#error EAGAIN not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EALREADY
|
|
||||||
#error EALREADY not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBADF
|
|
||||||
#error EBADF not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBADMSG
|
|
||||||
#error EBADMSG not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBUSY
|
|
||||||
#error EBUSY not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECANCELED
|
|
||||||
#error ECANCELED not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECHILD
|
|
||||||
#error ECHILD not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNABORTED
|
|
||||||
#error ECONNABORTED not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNREFUSED
|
|
||||||
#error ECONNREFUSED not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNRESET
|
|
||||||
#error ECONNRESET not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDEADLK
|
|
||||||
#error EDEADLK not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDESTADDRREQ
|
|
||||||
#error EDESTADDRREQ not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDOM
|
|
||||||
#error EDOM not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EEXIST
|
|
||||||
#error EEXIST not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFAULT
|
|
||||||
#error EFAULT not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFBIG
|
|
||||||
#error EFBIG not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EHOSTUNREACH
|
|
||||||
#error EHOSTUNREACH not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EIDRM
|
|
||||||
#error EIDRM not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EILSEQ
|
|
||||||
#error EILSEQ not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINPROGRESS
|
|
||||||
#error EINPROGRESS not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINTR
|
|
||||||
#error EINTR not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINVAL
|
|
||||||
#error EINVAL not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EIO
|
|
||||||
#error EIO not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EISCONN
|
|
||||||
#error EISCONN not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EISDIR
|
|
||||||
#error EISDIR not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ELOOP
|
|
||||||
#error ELOOP not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMFILE
|
|
||||||
#error EMFILE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMLINK
|
|
||||||
#error EMLINK not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMSGSIZE
|
|
||||||
#error EMSGSIZE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENAMETOOLONG
|
|
||||||
#error ENAMETOOLONG not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETDOWN
|
|
||||||
#error ENETDOWN not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETRESET
|
|
||||||
#error ENETRESET not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETUNREACH
|
|
||||||
#error ENETUNREACH not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENFILE
|
|
||||||
#error ENFILE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOBUFS
|
|
||||||
#error ENOBUFS not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENODATA
|
|
||||||
#error ENODATA not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENODEV
|
|
||||||
#error ENODEV not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOENT
|
|
||||||
#error ENOENT not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOEXEC
|
|
||||||
#error ENOEXEC not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOLCK
|
|
||||||
#error ENOLCK not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOLINK
|
|
||||||
#error ENOLINK not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOMEM
|
|
||||||
#error ENOMEM not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOMSG
|
|
||||||
#error ENOMSG not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOPROTOOPT
|
|
||||||
#error ENOPROTOOPT not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSPC
|
|
||||||
#error ENOSPC not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSR
|
|
||||||
#error ENOSR not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSTR
|
|
||||||
#error ENOSTR not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSYS
|
|
||||||
#error ENOSYS not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTCONN
|
|
||||||
#error ENOTCONN not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTDIR
|
|
||||||
#error ENOTDIR not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTEMPTY
|
|
||||||
#error ENOTEMPTY not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTRECOVERABLE
|
|
||||||
#error ENOTRECOVERABLE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTSOCK
|
|
||||||
#error ENOTSOCK not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTSUP
|
|
||||||
#error ENOTSUP not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTTY
|
|
||||||
#error ENOTTY not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENXIO
|
|
||||||
#error ENXIO not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOPNOTSUPP
|
|
||||||
#error EOPNOTSUPP not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOVERFLOW
|
|
||||||
#error EOVERFLOW not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOWNERDEAD
|
|
||||||
#error EOWNERDEAD not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPERM
|
|
||||||
#error EPERM not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPIPE
|
|
||||||
#error EPIPE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTO
|
|
||||||
#error EPROTO not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTONOSUPPORT
|
|
||||||
#error EPROTONOSUPPORT not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTOTYPE
|
|
||||||
#error EPROTOTYPE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ERANGE
|
|
||||||
#error ERANGE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EROFS
|
|
||||||
#error EROFS not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ESPIPE
|
|
||||||
#error ESPIPE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ESRCH
|
|
||||||
#error ESRCH not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETIME
|
|
||||||
#error ETIME not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETIMEDOUT
|
|
||||||
#error ETIMEDOUT not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETXTBSY
|
|
||||||
#error ETXTBSY not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EWOULDBLOCK
|
|
||||||
#error EWOULDBLOCK not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EXDEV
|
|
||||||
#error EXDEV not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef errno
|
|
||||||
#error errno not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,96 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <system_error>
|
|
||||||
|
|
||||||
// enum errc {...}
|
|
||||||
|
|
||||||
#include <system_error>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
static_assert(std::errc::address_family_not_supported == EAFNOSUPPORT, "");
|
|
||||||
static_assert(std::errc::address_in_use == EADDRINUSE, "");
|
|
||||||
static_assert(std::errc::address_not_available == EADDRNOTAVAIL, "");
|
|
||||||
static_assert(std::errc::already_connected == EISCONN, "");
|
|
||||||
static_assert(std::errc::argument_list_too_long == E2BIG, "");
|
|
||||||
static_assert(std::errc::argument_out_of_domain == EDOM, "");
|
|
||||||
static_assert(std::errc::bad_address == EFAULT, "");
|
|
||||||
static_assert(std::errc::bad_file_descriptor == EBADF, "");
|
|
||||||
static_assert(std::errc::bad_message == EBADMSG, "");
|
|
||||||
static_assert(std::errc::broken_pipe == EPIPE, "");
|
|
||||||
static_assert(std::errc::connection_aborted == ECONNABORTED, "");
|
|
||||||
static_assert(std::errc::connection_already_in_progress == EALREADY, "");
|
|
||||||
static_assert(std::errc::connection_refused == ECONNREFUSED, "");
|
|
||||||
static_assert(std::errc::connection_reset == ECONNRESET, "");
|
|
||||||
static_assert(std::errc::cross_device_link == EXDEV, "");
|
|
||||||
static_assert(std::errc::destination_address_required == EDESTADDRREQ, "");
|
|
||||||
static_assert(std::errc::device_or_resource_busy == EBUSY, "");
|
|
||||||
static_assert(std::errc::directory_not_empty == ENOTEMPTY, "");
|
|
||||||
static_assert(std::errc::executable_format_error == ENOEXEC, "");
|
|
||||||
static_assert(std::errc::file_exists == EEXIST, "");
|
|
||||||
static_assert(std::errc::file_too_large == EFBIG, "");
|
|
||||||
static_assert(std::errc::filename_too_long == ENAMETOOLONG, "");
|
|
||||||
static_assert(std::errc::function_not_supported == ENOSYS, "");
|
|
||||||
static_assert(std::errc::host_unreachable == EHOSTUNREACH, "");
|
|
||||||
static_assert(std::errc::identifier_removed == EIDRM, "");
|
|
||||||
static_assert(std::errc::illegal_byte_sequence == EILSEQ, "");
|
|
||||||
static_assert(std::errc::inappropriate_io_control_operation == ENOTTY, "");
|
|
||||||
static_assert(std::errc::interrupted == EINTR, "");
|
|
||||||
static_assert(std::errc::invalid_argument == EINVAL, "");
|
|
||||||
static_assert(std::errc::invalid_seek == ESPIPE, "");
|
|
||||||
static_assert(std::errc::io_error == EIO, "");
|
|
||||||
static_assert(std::errc::is_a_directory == EISDIR, "");
|
|
||||||
static_assert(std::errc::message_size == EMSGSIZE, "");
|
|
||||||
static_assert(std::errc::network_down == ENETDOWN, "");
|
|
||||||
static_assert(std::errc::network_reset == ENETRESET, "");
|
|
||||||
static_assert(std::errc::network_unreachable == ENETUNREACH, "");
|
|
||||||
static_assert(std::errc::no_buffer_space == ENOBUFS, "");
|
|
||||||
static_assert(std::errc::no_child_process == ECHILD, "");
|
|
||||||
static_assert(std::errc::no_link == ENOLINK, "");
|
|
||||||
static_assert(std::errc::no_lock_available == ENOLCK, "");
|
|
||||||
static_assert(std::errc::no_message_available == ENODATA, "");
|
|
||||||
static_assert(std::errc::no_message == ENOMSG, "");
|
|
||||||
static_assert(std::errc::no_protocol_option == ENOPROTOOPT, "");
|
|
||||||
static_assert(std::errc::no_space_on_device == ENOSPC, "");
|
|
||||||
static_assert(std::errc::no_stream_resources == ENOSR, "");
|
|
||||||
static_assert(std::errc::no_such_device_or_address == ENXIO, "");
|
|
||||||
static_assert(std::errc::no_such_device == ENODEV, "");
|
|
||||||
static_assert(std::errc::no_such_file_or_directory == ENOENT, "");
|
|
||||||
static_assert(std::errc::no_such_process == ESRCH, "");
|
|
||||||
static_assert(std::errc::not_a_directory == ENOTDIR, "");
|
|
||||||
static_assert(std::errc::not_a_socket == ENOTSOCK, "");
|
|
||||||
static_assert(std::errc::not_a_stream == ENOSTR, "");
|
|
||||||
static_assert(std::errc::not_connected == ENOTCONN, "");
|
|
||||||
static_assert(std::errc::not_enough_memory == ENOMEM, "");
|
|
||||||
static_assert(std::errc::not_supported == ENOTSUP, "");
|
|
||||||
static_assert(std::errc::operation_canceled == ECANCELED, "");
|
|
||||||
static_assert(std::errc::operation_in_progress == EINPROGRESS, "");
|
|
||||||
static_assert(std::errc::operation_not_permitted == EPERM, "");
|
|
||||||
static_assert(std::errc::operation_not_supported == EOPNOTSUPP, "");
|
|
||||||
static_assert(std::errc::operation_would_block == EWOULDBLOCK, "");
|
|
||||||
static_assert(std::errc::owner_dead == EOWNERDEAD, "");
|
|
||||||
static_assert(std::errc::permission_denied == EACCES, "");
|
|
||||||
static_assert(std::errc::protocol_error == EPROTO, "");
|
|
||||||
static_assert(std::errc::protocol_not_supported == EPROTONOSUPPORT, "");
|
|
||||||
static_assert(std::errc::read_only_file_system == EROFS, "");
|
|
||||||
static_assert(std::errc::resource_deadlock_would_occur == EDEADLK, "");
|
|
||||||
static_assert(std::errc::resource_unavailable_try_again == EAGAIN, "");
|
|
||||||
static_assert(std::errc::result_out_of_range == ERANGE, "");
|
|
||||||
static_assert(std::errc::state_not_recoverable == ENOTRECOVERABLE, "");
|
|
||||||
static_assert(std::errc::stream_timeout == ETIME, "");
|
|
||||||
static_assert(std::errc::text_file_busy == ETXTBSY, "");
|
|
||||||
static_assert(std::errc::timed_out == ETIMEDOUT, "");
|
|
||||||
static_assert(std::errc::too_many_files_open_in_system == ENFILE, "");
|
|
||||||
static_assert(std::errc::too_many_files_open == EMFILE, "");
|
|
||||||
static_assert(std::errc::too_many_links == EMLINK, "");
|
|
||||||
static_assert(std::errc::too_many_symbolic_link_levels == ELOOP, "");
|
|
||||||
static_assert(std::errc::value_too_large == EOVERFLOW, "");
|
|
||||||
static_assert(std::errc::wrong_protocol_type == EPROTOTYPE, "");
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <system_error>
|
|
||||||
|
|
||||||
// class error_code
|
|
||||||
|
|
||||||
// error_code make_error_code(errc e);
|
|
||||||
|
|
||||||
#include <system_error>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::error_code ec = make_error_code(std::errc::operation_canceled);
|
|
||||||
assert(ec.value() == static_cast<int>(std::errc::operation_canceled));
|
|
||||||
assert(ec.category() == std::generic_category());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <system_error>
|
|
||||||
|
|
||||||
// class error_condition
|
|
||||||
|
|
||||||
// error_condition make_error_condition(errc e);
|
|
||||||
|
|
||||||
#include <system_error>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
const std::error_condition ec1 = std::make_error_condition(std::errc::message_size);
|
|
||||||
assert(ec1.value() == static_cast<int>(std::errc::message_size));
|
|
||||||
assert(ec1.category() == std::generic_category());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -30,7 +30,11 @@ int main()
|
|||||||
test<char, std::numeric_limits<char>::is_signed ? 7 : 8>();
|
test<char, std::numeric_limits<char>::is_signed ? 7 : 8>();
|
||||||
test<signed char, 7>();
|
test<signed char, 7>();
|
||||||
test<unsigned char, 8>();
|
test<unsigned char, 8>();
|
||||||
|
#if _WIN32
|
||||||
|
test<wchar_t, 16>();
|
||||||
|
#else
|
||||||
test<wchar_t, std::numeric_limits<wchar_t>::is_signed ? 31 : 32>();
|
test<wchar_t, std::numeric_limits<wchar_t>::is_signed ? 31 : 32>();
|
||||||
|
#endif
|
||||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
test<char16_t, 16>();
|
test<char16_t, 16>();
|
||||||
test<char32_t, 32>();
|
test<char32_t, 32>();
|
||||||
|
@@ -34,7 +34,11 @@ int main()
|
|||||||
test<char, 2>();
|
test<char, 2>();
|
||||||
test<signed char, 2>();
|
test<signed char, 2>();
|
||||||
test<unsigned char, 2>();
|
test<unsigned char, 2>();
|
||||||
|
#ifdef _WIN32
|
||||||
|
test<wchar_t, 4>();
|
||||||
|
#else
|
||||||
test<wchar_t, 9>();
|
test<wchar_t, 9>();
|
||||||
|
#endif
|
||||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
test<char16_t, 4>();
|
test<char16_t, 4>();
|
||||||
test<char32_t, 9>();
|
test<char32_t, 9>();
|
||||||
|
@@ -63,12 +63,12 @@ class LibcxxTestFormat(lit.formats.FileBasedTest):
|
|||||||
report += "\n\nExpected compilation to fail!"
|
report += "\n\nExpected compilation to fail!"
|
||||||
return lit.Test.FAIL, report
|
return lit.Test.FAIL, report
|
||||||
else:
|
else:
|
||||||
exec_file = tempfile.NamedTemporaryFile(suffix="exe")
|
exec_file = tempfile.NamedTemporaryFile(suffix=".exe")
|
||||||
exec_path = exec_file.name
|
exec_path = exec_file.name
|
||||||
exec_file.close()
|
exec_file.close()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
compile_cmd = [self.cxx_under_test, '-o', exec_path,
|
compile_cmd = [self.cxx_under_test, 'e:/llvm/libcxx/test/_win32_seterrormode.fail.cpp', '-o', exec_path,
|
||||||
source_path] + self.cpp_flags + self.ld_flags
|
source_path] + self.cpp_flags + self.ld_flags
|
||||||
cmd = compile_cmd
|
cmd = compile_cmd
|
||||||
out, err, exitCode = self.execute_command(cmd)
|
out, err, exitCode = self.execute_command(cmd)
|
||||||
@@ -155,6 +155,6 @@ if sys.platform == 'linux2':
|
|||||||
|
|
||||||
config.test_format = LibcxxTestFormat(cxx_under_test,
|
config.test_format = LibcxxTestFormat(cxx_under_test,
|
||||||
cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
|
cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
|
||||||
ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + libraries)
|
ld_flags = [''] + library_paths + ['-lc++'] + libraries)
|
||||||
|
|
||||||
config.target_triple = None
|
config.target_triple = None
|
||||||
|
@@ -1,48 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <clocale>
|
|
||||||
|
|
||||||
#include <clocale>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#ifndef LC_ALL
|
|
||||||
#error LC_ALL not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LC_COLLATE
|
|
||||||
#error LC_COLLATE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LC_CTYPE
|
|
||||||
#error LC_CTYPE not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LC_MONETARY
|
|
||||||
#error LC_MONETARY not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LC_NUMERIC
|
|
||||||
#error LC_NUMERIC not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LC_TIME
|
|
||||||
#error LC_TIME not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#error NULL not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::lconv lc;
|
|
||||||
static_assert((std::is_same<__typeof__(std::setlocale(0, "")), char*>::value), "");
|
|
||||||
static_assert((std::is_same<__typeof__(std::localeconv()), std::lconv*>::value), "");
|
|
||||||
}
|
|
@@ -1,20 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <clocale>
|
|
||||||
|
|
||||||
#include <clocale>
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_VERSION
|
|
||||||
#error _LIBCPP_VERSION not defined
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,118 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// Not a portable test
|
|
||||||
|
|
||||||
// __scan_keyword
|
|
||||||
// Scans [__b, __e) until a match is found in the basic_strings range
|
|
||||||
// [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke).
|
|
||||||
// __b will be incremented (visibly), consuming CharT until a match is found
|
|
||||||
// or proved to not exist. A keyword may be "", in which will match anything.
|
|
||||||
// If one keyword is a prefix of another, and the next CharT in the input
|
|
||||||
// might match another keyword, the algorithm will attempt to find the longest
|
|
||||||
// matching keyword. If the longer matching keyword ends up not matching, then
|
|
||||||
// no keyword match is found. If no keyword match is found, __ke is returned.
|
|
||||||
// Else an iterator pointing to the matching keyword is found. If more than
|
|
||||||
// one keyword matches, an iterator to the first matching keyword is returned.
|
|
||||||
// If on exit __b == __e, eofbit is set in __err. If __case_senstive is false,
|
|
||||||
// __ct is used to force to lower case before comparing characters.
|
|
||||||
// Examples:
|
|
||||||
// Keywords: "a", "abb"
|
|
||||||
// If the input is "a", the first keyword matches and eofbit is set.
|
|
||||||
// If the input is "abc", no match is found and "ab" are consumed.
|
|
||||||
//
|
|
||||||
// template <class _InputIterator, class _ForwardIterator, class _Ctype>
|
|
||||||
// _ForwardIterator
|
|
||||||
// __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
|
||||||
// _ForwardIterator __kb, _ForwardIterator __ke,
|
|
||||||
// const _Ctype& __ct, ios_base::iostate& __err,
|
|
||||||
// bool __case_sensitive = true);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(std::locale::classic());
|
|
||||||
std::ios_base::iostate err = std::ios_base::goodbit;
|
|
||||||
{
|
|
||||||
const char input[] = "a";
|
|
||||||
const char* in = input;
|
|
||||||
std::string keys[] = {"a", "abb"};
|
|
||||||
err = std::ios_base::goodbit;
|
|
||||||
std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
|
|
||||||
keys, keys+sizeof(keys)/sizeof(keys[0]),
|
|
||||||
ct, err);
|
|
||||||
assert(k - keys == 0);
|
|
||||||
assert(in == input+1);
|
|
||||||
assert(err == std::ios_base::eofbit);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const char input[] = "abc";
|
|
||||||
const char* in = input;
|
|
||||||
std::string keys[] = {"a", "abb"};
|
|
||||||
err = std::ios_base::goodbit;
|
|
||||||
std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
|
|
||||||
keys, keys+sizeof(keys)/sizeof(keys[0]),
|
|
||||||
ct, err);
|
|
||||||
assert(k - keys == 2);
|
|
||||||
assert(in == input+2);
|
|
||||||
assert(err == std::ios_base::failbit);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const char input[] = "abb";
|
|
||||||
const char* in = input;
|
|
||||||
std::string keys[] = {"a", "abb"};
|
|
||||||
err = std::ios_base::goodbit;
|
|
||||||
std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
|
|
||||||
keys, keys+sizeof(keys)/sizeof(keys[0]),
|
|
||||||
ct, err);
|
|
||||||
assert(k - keys == 1);
|
|
||||||
assert(in == input+3);
|
|
||||||
assert(err == std::ios_base::eofbit);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const char input[] = "Tue ";
|
|
||||||
const char* in = input;
|
|
||||||
std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
|
|
||||||
err = std::ios_base::goodbit;
|
|
||||||
std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
|
|
||||||
keys, keys+sizeof(keys)/sizeof(keys[0]),
|
|
||||||
ct, err);
|
|
||||||
assert(k - keys == 2);
|
|
||||||
assert(in == input+3);
|
|
||||||
assert(err == std::ios_base::goodbit);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const char input[] = "tue ";
|
|
||||||
const char* in = input;
|
|
||||||
std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
|
|
||||||
err = std::ios_base::goodbit;
|
|
||||||
std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
|
|
||||||
keys, keys+sizeof(keys)/sizeof(keys[0]),
|
|
||||||
ct, err);
|
|
||||||
assert(k - keys == 4);
|
|
||||||
assert(in == input+0);
|
|
||||||
assert(err == std::ios_base::failbit);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const char input[] = "tue ";
|
|
||||||
const char* in = input;
|
|
||||||
std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
|
|
||||||
err = std::ios_base::goodbit;
|
|
||||||
std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
|
|
||||||
keys, keys+sizeof(keys)/sizeof(keys[0]),
|
|
||||||
ct, err, false);
|
|
||||||
assert(k - keys == 2);
|
|
||||||
assert(in == input+3);
|
|
||||||
assert(err == std::ios_base::goodbit);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,80 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate_byname
|
|
||||||
|
|
||||||
// int compare(const charT* low1, const charT* high1,
|
|
||||||
// const charT* low2, const charT* high2) const;
|
|
||||||
|
|
||||||
// I'm currently unable to confirm that collation based on named locales
|
|
||||||
// has any difference from "C" collation. But I do believe I'm picking
|
|
||||||
// up the OS's collation files.
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l("en_US");
|
|
||||||
{
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
std::string s2("aaaaaaA");
|
|
||||||
std::string s3("BaaaaaA");
|
|
||||||
assert(f.compare(s2.data(), s2.data() + s2.size(),
|
|
||||||
s3.data(), s3.data() + s3.size()) == 1);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
std::wstring s2(L"aaaaaaA");
|
|
||||||
std::wstring s3(L"BaaaaaA");
|
|
||||||
assert(f.compare(s2.data(), s2.data() + s2.size(),
|
|
||||||
s3.data(), s3.data() + s3.size()) == 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::locale l("");
|
|
||||||
{
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
std::string s2("aaaaaaA");
|
|
||||||
std::string s3("BaaaaaA");
|
|
||||||
assert(f.compare(s2.data(), s2.data() + s2.size(),
|
|
||||||
s3.data(), s3.data() + s3.size()) == 1);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
std::wstring s2(L"aaaaaaA");
|
|
||||||
std::wstring s3(L"BaaaaaA");
|
|
||||||
assert(f.compare(s2.data(), s2.data() + s2.size(),
|
|
||||||
s3.data(), s3.data() + s3.size()) == 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::locale l("C");
|
|
||||||
{
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
std::string s2("aaaaaaA");
|
|
||||||
std::string s3("BaaaaaA");
|
|
||||||
assert(f.compare(s2.data(), s2.data() + s2.size(),
|
|
||||||
s3.data(), s3.data() + s3.size()) == 1);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
std::wstring s2(L"aaaaaaA");
|
|
||||||
std::wstring s3(L"BaaaaaA");
|
|
||||||
assert(f.compare(s2.data(), s2.data() + s2.size(),
|
|
||||||
s3.data(), s3.data() + s3.size()) == 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate_byname
|
|
||||||
|
|
||||||
// long hash(const charT* low, const charT* high) const;
|
|
||||||
|
|
||||||
// This test is not portable
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l("en_US");
|
|
||||||
{
|
|
||||||
std::string x1("1234");
|
|
||||||
std::string x2("12345");
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.hash(x1.data(), x1.data() + x1.size())
|
|
||||||
!= f.hash(x2.data(), x2.data() + x2.size()));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::wstring x1(L"1234");
|
|
||||||
std::wstring x2(L"12345");
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.hash(x1.data(), x1.data() + x1.size())
|
|
||||||
!= f.hash(x2.data(), x2.data() + x2.size()));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,63 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate_byname
|
|
||||||
|
|
||||||
// string_type transform(const charT* low, const charT* high) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l("en_US");
|
|
||||||
{
|
|
||||||
std::string x("1234");
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) != x);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::wstring x(L"1234");
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) != x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::locale l("");
|
|
||||||
{
|
|
||||||
std::string x("1234");
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) != x);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::wstring x(L"1234");
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) != x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::locale l("C");
|
|
||||||
{
|
|
||||||
std::string x("1234");
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) == x);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::wstring x(L"1234");
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) == x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,43 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT>
|
|
||||||
// class collate_byname
|
|
||||||
// : public collate<charT>
|
|
||||||
// {
|
|
||||||
// public:
|
|
||||||
// typedef basic_string<charT> string_type;
|
|
||||||
// explicit collate_byname(const char*, size_t refs = 0);
|
|
||||||
// explicit collate_byname(const string&, size_t refs = 0);
|
|
||||||
// protected:
|
|
||||||
// ~collate_byname();
|
|
||||||
// };
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l("en_US");
|
|
||||||
{
|
|
||||||
assert(std::has_facet<std::collate_byname<char> >(l));
|
|
||||||
assert(&std::use_facet<std::collate<char> >(l)
|
|
||||||
== &std::use_facet<std::collate_byname<char> >(l));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assert(std::has_facet<std::collate_byname<wchar_t> >(l));
|
|
||||||
assert(&std::use_facet<std::collate<wchar_t> >(l)
|
|
||||||
== &std::use_facet<std::collate_byname<wchar_t> >(l));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,67 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate;
|
|
||||||
|
|
||||||
// explicit collate(size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
template <class C>
|
|
||||||
class my_facet
|
|
||||||
: public std::collate<C>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(std::size_t refs = 0)
|
|
||||||
: std::collate<C>(refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class C> int my_facet<C>::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet<char>);
|
|
||||||
assert(my_facet<char>::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet<char>::count == 0);
|
|
||||||
{
|
|
||||||
my_facet<char> f(1);
|
|
||||||
assert(my_facet<char>::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet<char>::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet<char>::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet<char>::count == 0);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet<wchar_t>);
|
|
||||||
assert(my_facet<wchar_t>::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet<wchar_t>::count == 0);
|
|
||||||
{
|
|
||||||
my_facet<wchar_t> f(1);
|
|
||||||
assert(my_facet<wchar_t>::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet<wchar_t>::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet<wchar_t>::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet<wchar_t>::count == 0);
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate;
|
|
||||||
|
|
||||||
// int compare(const charT* low1, const charT* high1,
|
|
||||||
// const charT* low2, const charT* high2) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
const char ia[] = "1234";
|
|
||||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
|
||||||
const char ib[] = "123";
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.compare(ia, ia+sa, ib, ib+2) == 1);
|
|
||||||
assert(f.compare(ib, ib+2, ia, ia+sa) == -1);
|
|
||||||
assert(f.compare(ia, ia+sa, ib, ib+3) == 1);
|
|
||||||
assert(f.compare(ib, ib+3, ia, ia+sa) == -1);
|
|
||||||
assert(f.compare(ia, ia+sa, ib+1, ib+3) == -1);
|
|
||||||
assert(f.compare(ib+1, ib+3, ia, ia+sa) == 1);
|
|
||||||
assert(f.compare(ia, ia+3, ib, ib+3) == 0);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const wchar_t ia[] = L"1234";
|
|
||||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
|
||||||
const wchar_t ib[] = L"123";
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.compare(ia, ia+sa, ib, ib+2) == 1);
|
|
||||||
assert(f.compare(ib, ib+2, ia, ia+sa) == -1);
|
|
||||||
assert(f.compare(ia, ia+sa, ib, ib+3) == 1);
|
|
||||||
assert(f.compare(ib, ib+3, ia, ia+sa) == -1);
|
|
||||||
assert(f.compare(ia, ia+sa, ib+1, ib+3) == -1);
|
|
||||||
assert(f.compare(ib+1, ib+3, ia, ia+sa) == 1);
|
|
||||||
assert(f.compare(ia, ia+3, ib, ib+3) == 0);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate;
|
|
||||||
|
|
||||||
// long hash(const charT* low, const charT* high) const;
|
|
||||||
|
|
||||||
// This test is not portable
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
std::string x1("1234");
|
|
||||||
std::string x2("12345");
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.hash(x1.data(), x1.data() + x1.size())
|
|
||||||
!= f.hash(x2.data(), x2.data() + x2.size()));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::wstring x1(L"1234");
|
|
||||||
std::wstring x2(L"12345");
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.hash(x1.data(), x1.data() + x1.size())
|
|
||||||
!= f.hash(x2.data(), x2.data() + x2.size()));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class collate;
|
|
||||||
|
|
||||||
// string_type transform(const charT* low, const charT* high) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
std::string x("1234");
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) == x);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::wstring x(L"1234");
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
assert(f.transform(x.data(), x.data() + x.size()) == x);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT>
|
|
||||||
// class collate
|
|
||||||
// : public locale::facet {
|
|
||||||
// public:
|
|
||||||
// typedef charT char_type;
|
|
||||||
// typedef basic_string<charT>string_type;
|
|
||||||
//
|
|
||||||
// static locale::id id;
|
|
||||||
// };
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
assert(std::has_facet<std::collate<char> >(l));
|
|
||||||
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
|
|
||||||
{
|
|
||||||
(void)std::collate<char>::id;
|
|
||||||
}
|
|
||||||
static_assert((std::is_same<std::collate<char>::char_type, char>::value), "");
|
|
||||||
static_assert((std::is_same<std::collate<char>::string_type, std::string>::value), "");
|
|
||||||
static_assert((std::is_base_of<std::locale::facet, std::collate<char> >::value), "");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assert(std::has_facet<std::collate<wchar_t> >(l));
|
|
||||||
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
|
|
||||||
{
|
|
||||||
(void)std::collate<wchar_t>::id;
|
|
||||||
}
|
|
||||||
static_assert((std::is_same<std::collate<wchar_t>::char_type, wchar_t>::value), "");
|
|
||||||
static_assert((std::is_same<std::collate<wchar_t>::string_type, std::wstring>::value), "");
|
|
||||||
static_assert((std::is_base_of<std::locale::facet, std::collate<wchar_t> >::value), "");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,57 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// class ctype_base
|
|
||||||
// {
|
|
||||||
// public:
|
|
||||||
// typedef T mask;
|
|
||||||
//
|
|
||||||
// // numeric values are for exposition only.
|
|
||||||
// static const mask space = 1 << 0;
|
|
||||||
// static const mask print = 1 << 1;
|
|
||||||
// static const mask cntrl = 1 << 2;
|
|
||||||
// static const mask upper = 1 << 3;
|
|
||||||
// static const mask lower = 1 << 4;
|
|
||||||
// static const mask alpha = 1 << 5;
|
|
||||||
// static const mask digit = 1 << 6;
|
|
||||||
// static const mask punct = 1 << 7;
|
|
||||||
// static const mask xdigit = 1 << 8;
|
|
||||||
// static const mask alnum = alpha | digit;
|
|
||||||
// static const mask graph = alnum | punct;
|
|
||||||
// };
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
assert(std::ctype_base::space);
|
|
||||||
assert(std::ctype_base::print);
|
|
||||||
assert(std::ctype_base::cntrl);
|
|
||||||
assert(std::ctype_base::upper);
|
|
||||||
assert(std::ctype_base::lower);
|
|
||||||
assert(std::ctype_base::alpha);
|
|
||||||
assert(std::ctype_base::digit);
|
|
||||||
assert(std::ctype_base::punct);
|
|
||||||
assert(std::ctype_base::xdigit);
|
|
||||||
assert(
|
|
||||||
( std::ctype_base::space
|
|
||||||
& std::ctype_base::print
|
|
||||||
& std::ctype_base::cntrl
|
|
||||||
& std::ctype_base::upper
|
|
||||||
& std::ctype_base::lower
|
|
||||||
& std::ctype_base::alpha
|
|
||||||
& std::ctype_base::digit
|
|
||||||
& std::ctype_base::punct
|
|
||||||
& std::ctype_base::xdigit) == 0);
|
|
||||||
assert(std::ctype_base::alnum == (std::ctype_base::alpha | std::ctype_base::digit));
|
|
||||||
assert(std::ctype_base::graph == (std::ctype_base::alnum | std::ctype_base::punct));
|
|
||||||
}
|
|
@@ -1,50 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>
|
|
||||||
|
|
||||||
// ~ctype();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
unsigned delete_called = 0;
|
|
||||||
|
|
||||||
void operator delete[](void* p) throw()
|
|
||||||
{
|
|
||||||
operator delete(p);
|
|
||||||
++delete_called;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
delete_called = 0;
|
|
||||||
std::locale l(std::locale::classic(), new std::ctype<char>);
|
|
||||||
assert(delete_called == 0);
|
|
||||||
}
|
|
||||||
assert(delete_called == 0);
|
|
||||||
{
|
|
||||||
std::ctype<char>::mask table[256];
|
|
||||||
delete_called = 0;
|
|
||||||
std::locale l(std::locale::classic(), new std::ctype<char>(table));
|
|
||||||
assert(delete_called == 0);
|
|
||||||
}
|
|
||||||
assert(delete_called == 0);
|
|
||||||
{
|
|
||||||
delete_called = 0;
|
|
||||||
std::locale l(std::locale::classic(),
|
|
||||||
new std::ctype<char>(new std::ctype<char>::mask[256], true));
|
|
||||||
assert(delete_called == 0);
|
|
||||||
}
|
|
||||||
assert(delete_called == 1);
|
|
||||||
}
|
|
@@ -1,50 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <class charT> class ctype;
|
|
||||||
|
|
||||||
// explicit ctype(const mask* tbl = 0, bool del = false, size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public std::ctype<char>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(const mask* tbl = 0, bool del = false, std::size_t refs = 0)
|
|
||||||
: std::ctype<char>(tbl, del, refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(0, false, 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,59 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// bool is(mask m, char c) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
|
|
||||||
assert(f.is(F::space, ' '));
|
|
||||||
assert(!f.is(F::space, 'A'));
|
|
||||||
|
|
||||||
assert(f.is(F::print, ' '));
|
|
||||||
assert(!f.is(F::print, '\x07'));
|
|
||||||
|
|
||||||
assert(f.is(F::cntrl, '\x07'));
|
|
||||||
assert(!f.is(F::cntrl, ' '));
|
|
||||||
|
|
||||||
assert(f.is(F::upper, 'A'));
|
|
||||||
assert(!f.is(F::upper, 'a'));
|
|
||||||
|
|
||||||
assert(f.is(F::lower, 'a'));
|
|
||||||
assert(!f.is(F::lower, 'A'));
|
|
||||||
|
|
||||||
assert(f.is(F::alpha, 'a'));
|
|
||||||
assert(!f.is(F::alpha, '1'));
|
|
||||||
|
|
||||||
assert(f.is(F::digit, '1'));
|
|
||||||
assert(!f.is(F::digit, 'a'));
|
|
||||||
|
|
||||||
assert(f.is(F::punct, '.'));
|
|
||||||
assert(!f.is(F::punct, 'a'));
|
|
||||||
|
|
||||||
assert(f.is(F::xdigit, 'a'));
|
|
||||||
assert(!f.is(F::xdigit, 'g'));
|
|
||||||
|
|
||||||
assert(f.is(F::alnum, 'a'));
|
|
||||||
assert(!f.is(F::alnum, '.'));
|
|
||||||
|
|
||||||
assert(f.is(F::graph, '.'));
|
|
||||||
assert(!f.is(F::graph, '\x07'));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,118 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* is(const char* low, const char* high, mask* vec) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
const std::string in(" A\x07.a1");
|
|
||||||
std::vector<F::mask> m(in.size());
|
|
||||||
const char* h = f.is(in.data(), in.data() + in.size(), m.data());
|
|
||||||
assert(h == in.data() + in.size());
|
|
||||||
|
|
||||||
// ' '
|
|
||||||
assert( (m[0] & F::space));
|
|
||||||
assert( (m[0] & F::print));
|
|
||||||
assert(!(m[0] & F::cntrl));
|
|
||||||
assert(!(m[0] & F::upper));
|
|
||||||
assert(!(m[0] & F::lower));
|
|
||||||
assert(!(m[0] & F::alpha));
|
|
||||||
assert(!(m[0] & F::digit));
|
|
||||||
assert(!(m[0] & F::punct));
|
|
||||||
assert(!(m[0] & F::xdigit));
|
|
||||||
assert( (m[0] & F::blank));
|
|
||||||
assert(!(m[0] & F::alnum));
|
|
||||||
assert(!(m[0] & F::graph));
|
|
||||||
|
|
||||||
// 'A'
|
|
||||||
assert(!(m[1] & F::space));
|
|
||||||
assert( (m[1] & F::print));
|
|
||||||
assert(!(m[1] & F::cntrl));
|
|
||||||
assert( (m[1] & F::upper));
|
|
||||||
assert(!(m[1] & F::lower));
|
|
||||||
assert( (m[1] & F::alpha));
|
|
||||||
assert(!(m[1] & F::digit));
|
|
||||||
assert(!(m[1] & F::punct));
|
|
||||||
assert( (m[1] & F::xdigit));
|
|
||||||
assert(!(m[1] & F::blank));
|
|
||||||
assert( (m[1] & F::alnum));
|
|
||||||
assert( (m[1] & F::graph));
|
|
||||||
|
|
||||||
// '\x07'
|
|
||||||
assert(!(m[2] & F::space));
|
|
||||||
assert(!(m[2] & F::print));
|
|
||||||
assert( (m[2] & F::cntrl));
|
|
||||||
assert(!(m[2] & F::upper));
|
|
||||||
assert(!(m[2] & F::lower));
|
|
||||||
assert(!(m[2] & F::alpha));
|
|
||||||
assert(!(m[2] & F::digit));
|
|
||||||
assert(!(m[2] & F::punct));
|
|
||||||
assert(!(m[2] & F::xdigit));
|
|
||||||
assert(!(m[2] & F::blank));
|
|
||||||
assert(!(m[2] & F::alnum));
|
|
||||||
assert(!(m[2] & F::graph));
|
|
||||||
|
|
||||||
// '.'
|
|
||||||
assert(!(m[3] & F::space));
|
|
||||||
assert( (m[3] & F::print));
|
|
||||||
assert(!(m[3] & F::cntrl));
|
|
||||||
assert(!(m[3] & F::upper));
|
|
||||||
assert(!(m[3] & F::lower));
|
|
||||||
assert(!(m[3] & F::alpha));
|
|
||||||
assert(!(m[3] & F::digit));
|
|
||||||
assert( (m[3] & F::punct));
|
|
||||||
assert(!(m[3] & F::xdigit));
|
|
||||||
assert(!(m[3] & F::blank));
|
|
||||||
assert(!(m[3] & F::alnum));
|
|
||||||
assert( (m[3] & F::graph));
|
|
||||||
|
|
||||||
// 'a'
|
|
||||||
assert(!(m[4] & F::space));
|
|
||||||
assert( (m[4] & F::print));
|
|
||||||
assert(!(m[4] & F::cntrl));
|
|
||||||
assert(!(m[4] & F::upper));
|
|
||||||
assert( (m[4] & F::lower));
|
|
||||||
assert( (m[4] & F::alpha));
|
|
||||||
assert(!(m[4] & F::digit));
|
|
||||||
assert(!(m[4] & F::punct));
|
|
||||||
assert( (m[4] & F::xdigit));
|
|
||||||
assert(!(m[4] & F::blank));
|
|
||||||
assert( (m[4] & F::alnum));
|
|
||||||
assert( (m[4] & F::graph));
|
|
||||||
|
|
||||||
// '1'
|
|
||||||
assert(!(m[5] & F::space));
|
|
||||||
assert( (m[5] & F::print));
|
|
||||||
assert(!(m[5] & F::cntrl));
|
|
||||||
assert(!(m[5] & F::upper));
|
|
||||||
assert(!(m[5] & F::lower));
|
|
||||||
assert(!(m[5] & F::alpha));
|
|
||||||
assert( (m[5] & F::digit));
|
|
||||||
assert(!(m[5] & F::punct));
|
|
||||||
assert( (m[5] & F::xdigit));
|
|
||||||
assert(!(m[5] & F::blank));
|
|
||||||
assert( (m[5] & F::alnum));
|
|
||||||
assert( (m[5] & F::graph));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// char narrow(char c, char dfault) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
|
|
||||||
assert(f.narrow(' ', '*') == ' ');
|
|
||||||
assert(f.narrow('A', '*') == 'A');
|
|
||||||
assert(f.narrow('\x07', '*') == '\x07');
|
|
||||||
assert(f.narrow('.', '*') == '.');
|
|
||||||
assert(f.narrow('a', '*') == 'a');
|
|
||||||
assert(f.narrow('1', '*') == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* narrow(const char* low, const char*, char dfault, char* to) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::string in(" A\x07.a1");
|
|
||||||
std::vector<char> v(in.size());
|
|
||||||
|
|
||||||
assert(f.narrow(&in[0], in.data() + in.size(), '*', v.data()) == in.data() + in.size());
|
|
||||||
assert(v[0] == ' ');
|
|
||||||
assert(v[1] == 'A');
|
|
||||||
assert(v[2] == '\x07');
|
|
||||||
assert(v[3] == '.');
|
|
||||||
assert(v[4] == 'a');
|
|
||||||
assert(v[5] == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,44 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* scan_is(mask m, const char* low, const char* high) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
const std::string in(" A\x07.a1");
|
|
||||||
std::vector<F::mask> m(in.size());
|
|
||||||
assert(f.scan_is(F::space, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_is(F::print, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_is(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 2);
|
|
||||||
assert(f.scan_is(F::upper, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
assert(f.scan_is(F::lower, in.data(), in.data() + in.size()) - in.data() == 4);
|
|
||||||
assert(f.scan_is(F::alpha, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
assert(f.scan_is(F::digit, in.data(), in.data() + in.size()) - in.data() == 5);
|
|
||||||
assert(f.scan_is(F::punct, in.data(), in.data() + in.size()) - in.data() == 3);
|
|
||||||
assert(f.scan_is(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
assert(f.scan_is(F::blank, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_is(F::alnum, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
assert(f.scan_is(F::graph, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,44 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* scan_not(mask m, const char* low, const char* high) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
const std::string in(" A\x07.a1");
|
|
||||||
std::vector<F::mask> m(in.size());
|
|
||||||
assert(f.scan_not(F::space, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
assert(f.scan_not(F::print, in.data(), in.data() + in.size()) - in.data() == 2);
|
|
||||||
assert(f.scan_not(F::cntrl, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::upper, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::lower, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::alpha, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::digit, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::punct, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::xdigit, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::blank, in.data(), in.data() + in.size()) - in.data() == 1);
|
|
||||||
assert(f.scan_not(F::alnum, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
assert(f.scan_not(F::graph, in.data(), in.data() + in.size()) - in.data() == 0);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>
|
|
||||||
|
|
||||||
// const mask* table() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new std::ctype<char>);
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(f.table() == f.classic_table());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ctype<char>::mask table[256];
|
|
||||||
std::locale l(std::locale::classic(), new std::ctype<char>(table));
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(f.table() == table);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// char tolower(char) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
|
|
||||||
assert(f.tolower(' ') == ' ');
|
|
||||||
assert(f.tolower('A') == 'a');
|
|
||||||
assert(f.tolower('\x07') == '\x07');
|
|
||||||
assert(f.tolower('.') == '.');
|
|
||||||
assert(f.tolower('a') == 'a');
|
|
||||||
assert(f.tolower('1') == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* tolower(char* low, const char* high) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::string in(" A\x07.a1");
|
|
||||||
|
|
||||||
assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
|
|
||||||
assert(in[0] == ' ');
|
|
||||||
assert(in[1] == 'a');
|
|
||||||
assert(in[2] == '\x07');
|
|
||||||
assert(in[3] == '.');
|
|
||||||
assert(in[4] == 'a');
|
|
||||||
assert(in[5] == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// char toupper(char) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
|
|
||||||
assert(f.toupper(' ') == ' ');
|
|
||||||
assert(f.toupper('A') == 'A');
|
|
||||||
assert(f.toupper('\x07') == '\x07');
|
|
||||||
assert(f.toupper('.') == '.');
|
|
||||||
assert(f.toupper('a') == 'A');
|
|
||||||
assert(f.toupper('1') == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* toupper(char* low, const char* high) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::string in(" A\x07.a1");
|
|
||||||
|
|
||||||
assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
|
|
||||||
assert(in[0] == ' ');
|
|
||||||
assert(in[1] == 'A');
|
|
||||||
assert(in[2] == '\x07');
|
|
||||||
assert(in[3] == '.');
|
|
||||||
assert(in[4] == 'A');
|
|
||||||
assert(in[5] == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// char widen(char c) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
|
|
||||||
assert(f.widen(' ') == ' ');
|
|
||||||
assert(f.widen('A') == 'A');
|
|
||||||
assert(f.widen('\x07') == '\x07');
|
|
||||||
assert(f.widen('.') == '.');
|
|
||||||
assert(f.widen('a') == 'a');
|
|
||||||
assert(f.widen('1') == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>;
|
|
||||||
|
|
||||||
// const char* widen(const char* low, const char* high, char* to) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::string in(" A\x07.a1");
|
|
||||||
std::vector<char> v(in.size());
|
|
||||||
|
|
||||||
assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
|
|
||||||
assert(v[0] == ' ');
|
|
||||||
assert(v[1] == 'A');
|
|
||||||
assert(v[2] == '\x07');
|
|
||||||
assert(v[3] == '.');
|
|
||||||
assert(v[4] == 'a');
|
|
||||||
assert(v[5] == '1');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,23 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class ctype<char>
|
|
||||||
|
|
||||||
// static const mask* classic_table() throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
typedef std::ctype<char> F;
|
|
||||||
assert(F::classic_table() != 0);
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <>
|
|
||||||
// class ctype<char>
|
|
||||||
// : public locale::facet,
|
|
||||||
// public ctype_base
|
|
||||||
// {
|
|
||||||
// public:
|
|
||||||
// typedef char char_type;
|
|
||||||
// };
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
{
|
|
||||||
assert(std::has_facet<std::ctype<char> >(l));
|
|
||||||
const std::ctype<char>& f = std::use_facet<std::ctype<char> >(l);
|
|
||||||
{
|
|
||||||
(void)std::ctype<char>::id;
|
|
||||||
}
|
|
||||||
static_assert((std::is_same<std::ctype<char>::char_type, char>::value), "");
|
|
||||||
static_assert((std::is_base_of<std::ctype_base, std::ctype<char> >::value), "");
|
|
||||||
static_assert((std::is_base_of<std::locale::facet, std::ctype<char> >::value), "");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,70 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt_byname<char, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt_byname(const char* nm, size_t refs = 0);
|
|
||||||
// explicit codecvt_byname(const string& nm, size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt_byname<char, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(const char* nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
explicit my_facet(const std::string& nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet("en_US"));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f("en_US", 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(std::string("en_US"), 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,70 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt_byname<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt_byname(const char* nm, size_t refs = 0);
|
|
||||||
// explicit codecvt_byname(const string& nm, size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt_byname<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(const char* nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
explicit my_facet(const std::string& nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet("en_US"));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f("en_US", 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(std::string("en_US"), 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,70 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt_byname<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt_byname(const char* nm, size_t refs = 0);
|
|
||||||
// explicit codecvt_byname(const string& nm, size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt_byname<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(const char* nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
explicit my_facet(const std::string& nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet("en_US"));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f("en_US", 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(std::string("en_US"), 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,70 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt_byname<wchar_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt_byname(const char* nm, size_t refs = 0);
|
|
||||||
// explicit codecvt_byname(const string& nm, size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(const char* nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
explicit my_facet(const std::string& nm, std::size_t refs = 0)
|
|
||||||
: F(nm, refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet("en_US"));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f("en_US", 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet(std::string("en_US")));
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(std::string("en_US"), 1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// class codecvt_base
|
|
||||||
// {
|
|
||||||
// public:
|
|
||||||
// enum result {ok, partial, error, noconv};
|
|
||||||
// };
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
assert(std::codecvt_base::ok == 0);
|
|
||||||
assert(std::codecvt_base::partial == 1);
|
|
||||||
assert(std::codecvt_base::error == 2);
|
|
||||||
assert(std::codecvt_base::noconv == 3);
|
|
||||||
}
|
|
@@ -1,52 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt(size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(std::size_t refs = 0)
|
|
||||||
: F(refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt(size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(std::size_t refs = 0)
|
|
||||||
: F(refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
//#endif
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt(size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(std::size_t refs = 0)
|
|
||||||
: F(refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
//#endif
|
|
||||||
}
|
|
@@ -1,52 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<wchar_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// explicit codecvt(size_t refs = 0);
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
class my_facet
|
|
||||||
: public F
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int count;
|
|
||||||
|
|
||||||
explicit my_facet(std::size_t refs = 0)
|
|
||||||
: F(refs) {++count;}
|
|
||||||
|
|
||||||
~my_facet() {--count;}
|
|
||||||
};
|
|
||||||
|
|
||||||
int my_facet::count = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), new my_facet);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
{
|
|
||||||
my_facet f(1);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
{
|
|
||||||
std::locale l(std::locale::classic(), &f);
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 1);
|
|
||||||
}
|
|
||||||
assert(my_facet::count == 0);
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// bool always_noconv() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(!f.always_noconv());
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// int encoding() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(f.encoding() == 0);
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// result in(stateT& state,
|
|
||||||
// const externT* from, const externT* from_end, const externT*& from_next,
|
|
||||||
// internT* to, internT* to_end, internT*& to_next) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const char from[] = "some text";
|
|
||||||
F::intern_type to[9];
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
const char* from_next = 0;
|
|
||||||
F::intern_type* to_next = 0;
|
|
||||||
assert(f.in(mbs, from, from + 9, from_next,
|
|
||||||
to, to + 9, to_next) == F::ok);
|
|
||||||
assert(from_next - from == 9);
|
|
||||||
assert(to_next - to == 9);
|
|
||||||
for (unsigned i = 0; i < 9; ++i)
|
|
||||||
assert(to[i] == from[i]);
|
|
||||||
}
|
|
@@ -1,32 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
const char from[] = "some text";
|
|
||||||
assert(f.length(mbs, from, from+10, 0) == 0);
|
|
||||||
assert(f.length(mbs, from, from+10, 8) == 8);
|
|
||||||
assert(f.length(mbs, from, from+10, 9) == 9);
|
|
||||||
assert(f.length(mbs, from, from+10, 10) == 10);
|
|
||||||
assert(f.length(mbs, from, from+10, 100) == 10);
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// int max_length() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(f.max_length() == 4);
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// result out(stateT& state,
|
|
||||||
// const internT* from, const internT* from_end, const internT*& from_next,
|
|
||||||
// externT* to, externT* to_end, externT*& to_next) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
{
|
|
||||||
F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
|
|
||||||
char to[9] = {0};
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
const F::intern_type* from_next = 0;
|
|
||||||
char* to_next = 0;
|
|
||||||
F::result r = f.out(mbs, from, from + 9, from_next,
|
|
||||||
to, to + 9, to_next);
|
|
||||||
assert(r == F::ok);
|
|
||||||
assert(from_next - from == 9);
|
|
||||||
assert(to_next - to == 9);
|
|
||||||
for (unsigned i = 0; i < 9; ++i)
|
|
||||||
assert(to[i] == from[i]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// result unshift(stateT& state,
|
|
||||||
// externT* to, externT* to_end, externT*& to_next) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
std::vector<char> to(3);
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
char* to_next = 0;
|
|
||||||
assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
|
|
||||||
assert(to_next == to.data());
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// bool always_noconv() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(!f.always_noconv());
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// int encoding() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(f.encoding() == 0);
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// result in(stateT& state,
|
|
||||||
// const externT* from, const externT* from_end, const externT*& from_next,
|
|
||||||
// internT* to, internT* to_end, internT*& to_next) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const char from[] = "some text";
|
|
||||||
F::intern_type to[9];
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
const char* from_next = 0;
|
|
||||||
F::intern_type* to_next = 0;
|
|
||||||
assert(f.in(mbs, from, from + 9, from_next,
|
|
||||||
to, to + 9, to_next) == F::ok);
|
|
||||||
assert(from_next - from == 9);
|
|
||||||
assert(to_next - to == 9);
|
|
||||||
for (unsigned i = 0; i < 9; ++i)
|
|
||||||
assert(to[i] == from[i]);
|
|
||||||
}
|
|
@@ -1,32 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
const char from[] = "some text";
|
|
||||||
assert(f.length(mbs, from, from+10, 0) == 0);
|
|
||||||
assert(f.length(mbs, from, from+10, 8) == 8);
|
|
||||||
assert(f.length(mbs, from, from+10, 9) == 9);
|
|
||||||
assert(f.length(mbs, from, from+10, 10) == 10);
|
|
||||||
assert(f.length(mbs, from, from+10, 100) == 10);
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// int max_length() const throw();
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
assert(f.max_length() == 4);
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// result out(stateT& state,
|
|
||||||
// const internT* from, const internT* from_end, const internT*& from_next,
|
|
||||||
// externT* to, externT* to_end, externT*& to_next) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
{
|
|
||||||
F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
|
|
||||||
char to[9] = {0};
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
const F::intern_type* from_next = 0;
|
|
||||||
char* to_next = 0;
|
|
||||||
F::result r = f.out(mbs, from, from + 9, from_next,
|
|
||||||
to, to + 9, to_next);
|
|
||||||
assert(r == F::ok);
|
|
||||||
assert(from_next - from == 9);
|
|
||||||
assert(to_next - to == 9);
|
|
||||||
for (unsigned i = 0; i < 9; ++i)
|
|
||||||
assert(to[i] == from[i]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <locale>
|
|
||||||
|
|
||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
|
||||||
|
|
||||||
// result unshift(stateT& state,
|
|
||||||
// externT* to, externT* to_end, externT*& to_next) const;
|
|
||||||
|
|
||||||
#include <locale>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
std::locale l = std::locale::classic();
|
|
||||||
std::vector<char> to(3);
|
|
||||||
const F& f = std::use_facet<F>(l);
|
|
||||||
std::mbstate_t mbs;
|
|
||||||
char* to_next = 0;
|
|
||||||
assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
|
|
||||||
assert(to_next == to.data());
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user