Compare commits

..

69 Commits

Author SHA1 Message Date
NAKAMURA Takumi
b13c5fc1a9 Suppress condition/mutex/thread stuff. 2011-05-01 21:53:00 +09:00
NAKAMURA Takumi
4e66976786 Suppress test/localization. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
8074505c5d test: Suppress exception-required tests. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
efdce87766 Suppress -fPIC. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
fd9aadef51 test: Add _win32_seterrormode.fail.cpp to silence Exception diaalogs on Windows desktop. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
6d50da017f test/utilities/type.index/type.index.members/lt.pass.cpp: I don't understand what it is! 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
ae185c2977 test: wchar_t might be "unsigned short" for Win32 targets. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
79356f49bd fstream: fseeko, ftello 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
9117a0a174 test/diagnostics/*err*: Disable 4 tests lack of system_error. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
591952787f chrono.cpp: suppress clock_gettime() 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
8082261d2c codecvt<wchar_t, char, mbstate_t>::do_unshift(): return noconv 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
b101cb1408 locale.cpp: tweak strftime_l to strftime 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
cb5181c5a2 locale.cpp: disabled wip 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
c3089afe8d locale.cpp: Tweak for Win32, newlocale() and freelocale(). 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
be2e6396c3 locale.cpp: Tweak for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
0428d2a325 locale: suppress long double 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
5ee0769693 locale: Add bogus asprintf() for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
164d6b8bda locale: Win32 tweak. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
117920302f locale: Supress NLS things. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
16acf2ae93 system_error: FIXME: WS2 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
f9d6039245 string.cpp: SECURE_API and swprintf_s() 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
4cf42dadd4 __locale: _isctype 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
51ae55e510 __locale: Add LC_XXX_MASK for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
aeaeb51343 __locale: std::uint32_t may be available here. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
b05cdf81ba test/lit.cfg: Remove -nodefaultlibs for mingw32-clang. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
4a796725e0 test/lit.cfg: Fix suffix. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
5a9ed2486b __config: mingw32 no-excpetions 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
beb21a0990 __config: #define _LIBCPP_VISIBILITY_TAG 0 // on mingw32. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
12f526f712 __config: Add endian check based on target processor. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
bd94c33cc3 __config: Tweak yvals.h macro to avoid symbol clashes. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
9dc188d64d new.cpp: split new and delete into 8 files. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
9055a62ed4 new: move __new_hander to _STD. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
17c8c462ae exception.cpp: std::uncaught_exception() may return false with -fno-exceptions. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
ec97728ba0 test/utilities: Fix LLP64-aware. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
cb430f3a47 test: Mark 316 tests as XFAIL to rename to xfail.pass.cpp. 2011-05-01 21:52:09 +09:00
NAKAMURA Takumi
d3665e1d9d test/lit.cfg: Add .xfail.pass.cpp, to expect compiling successfully and to fail to run. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
6911fb59fd Mark 218 tests as fail to compile lack of C++0x features. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
a177c5da7b test/lit.cfg: Python-2.4 does not accept "delete" in tempfile.NamedTemporaryFile. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
352c9e1a46 __std_stream: Fix error checking in __stdoutbuf<_CharT>::sync(). 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
710f61ba2a include/__locale: Tweak __tab_.
FIXME: wip! wip!
2011-05-01 21:52:08 +09:00
Howard Hinnant
469d419a17 Correction to set of overloaded pair constructors for C++0x
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:10:55 +00:00
Douglas Gregor
7ac6af7027 Qualify calls to std::next(), to avoid conflicts with
libraries/applications that define their own 'next' template.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130511 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 16:20:26 +00:00
Howard Hinnant
e14ea5835e http://llvm.org/bugs/show_bug.cgi?id=9765
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129910 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 14:29:59 +00:00
Howard Hinnant
75f7695c62 Think-o in poisson_distribution at mean == 10
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 15:59:22 +00:00
Howard Hinnant
ef3b2e2e34 Fix bug in Sseq constraints found by Seth Cantrell
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129285 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:22:12 +00:00
Howard Hinnant
9dbeff919b http://llvm.org/bugs/show_bug.cgi?id=9672
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129266 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 02:18:41 +00:00
Howard Hinnant
8c1aa2c24d Changes to cerrno to protect against the case the ELAST is not defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 19:46:55 +00:00
Howard Hinnant
506b36487c time_get was missing the %F specifier. This change impacts the binary.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 17:54:14 +00:00
Howard Hinnant
a02851e8a2 Chris Jefferson found a missing const (Bugzilla 9632)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128885 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-05 14:55:28 +00:00
Howard Hinnant
3e93e96dff Corrected tests for http://llvm.org/bugs/show_bug.cgi?id=9351
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-04 01:42:30 +00:00
Howard Hinnant
b8a03c763a ... And these wonderful tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-03 20:06:31 +00:00
Howard Hinnant
d615e47bea Chris Jefferson submitted this patch to fix http://llvm.org/bugs/show_bug.cgi?id=9351
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128796 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-03 20:05:29 +00:00
Howard Hinnant
154002bb5d Provide a more readable error message for <atomic> until it is implemented.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128636 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31 16:39:39 +00:00
Howard Hinnant
41fb6e1432 Jonathan Sauer found a bug in the way ^ was handled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128350 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 20:02:27 +00:00
Howard Hinnant
86e78d694c Jonathan Sauer updated is_base_of traits status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 19:58:42 +00:00
Nick Kledzik
770a3c5116 <rdar://problem/9073695> std::uncaught_exception() becomes true before evaluating the throw-expression rather than after
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127499 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 22:33:07 +00:00
Howard Hinnant
d0a2fbfe60 http://llvm.org/bugs/show_bug.cgi?id=9444
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127412 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 17:27:57 +00:00
Howard Hinnant
f9b8998795 I have to revert this recent fix to tuple conversions until clang implements cwg 1170. Without this fix pair and tuple don't convert properly. With it, associative containers get access errors when they shouldn't. cwg 1170 fixes the latter.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127411 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 17:27:30 +00:00
Howard Hinnant
6e5e7e78ee Corrected const-correctness on nullptr type_traits, and beefed up the test for nullptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127338 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 17:17:06 +00:00
Howard Hinnant
5885da34ce Walter Brown brought to my attention that type_traits was failing to correctly classify nullptr_t
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127334 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 15:10:51 +00:00
Howard Hinnant
80586729e4 Chris Jefferson found a defect in the C++0x working draft by trying to run libc++ against boost. I've submitted an issue to the LWG, and this commit attempts to implement the proposed resolution of that defect report. I'd point to the issue but it hasn't been put into the LWG list yet. The title of the issue will be: Stage 2 accumulate incompatibilty
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 01:03:19 +00:00
Howard Hinnant
8dcad976e0 http://llvm.org/bugs/show_bug.cgi?id=9349 I introduced a bug with the last fix and Ryuta Suzuki has corrected it. And hopefully I committed Ryuta Suzuki's directions correctly this time.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 01:59:23 +00:00
Howard Hinnant
542b0f0cf5 http://llvm.org/bugs/show_bug.cgi?id=9349 I have not personally tested this patch. Please let me know if it causes problems.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126846 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 17:29:46 +00:00
Howard Hinnant
fddf722f4e Chris Jefferson found this bug to pair/tuple introduced by a recent change to the draft that I missed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126743 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 14:27:55 +00:00
Howard Hinnant
171869e27c Fix copy_n to increment only n-1 times for an input iterator. This works much better with std::istream_iterator<int>(std::cin). Credit: Matan Nassau.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-27 20:55:39 +00:00
Howard Hinnant
df85e57f4a Fixed two problems found by Chris Jefferson: Made operator>> for char consistent with gcc. Opened an LWG issue on this one. 2) Renamed some private typedefs which are causing boost grief.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-27 18:02:02 +00:00
Howard Hinnant
e7c8da6f2d http://llvm.org/bugs/show_bug.cgi?id=9326
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126504 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 19:52:41 +00:00
Howard Hinnant
b2080c70d4 Chris Jefferson spotted a problem with messages_base::catalog while getting libc++ to work on boost. The standard says this type must be an int. But this type is the key returned by the OS facility catopen. On OS X the type returned by catopen is void*, which doesn't fit into an int on 64 bit platforms. Chris suggested using ptrdiff_t instead of void*. It still isn't compliant with the standard, but chances are that this change will fix what is ailing boost. Chris also supplied the algorithm for distinguishing high-order pointers from error conditions. Thanks Chris.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 00:51:08 +00:00
Howard Hinnant
5a245dbf52 Jean-Daniel Dupas fixes install directions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126222 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 14:18:34 +00:00
1022 changed files with 768 additions and 85201 deletions

View File

@@ -13,6 +13,13 @@
#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_ABI_VERSION 1
@@ -47,6 +54,11 @@
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#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)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -98,7 +110,7 @@ typedef __char32_t char32_t;
#endif
#endif
#if !(__has_feature(cxx_exceptions))
#if !(__has_feature(cxx_exceptions)) || defined(__MINGW32__)
#define _LIBCPP_NO_EXCEPTIONS
#endif
@@ -184,10 +196,12 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -207,7 +221,6 @@ namespace std {
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_NULLPTR
#endif

View File

@@ -29,9 +29,9 @@ template <class _NodePtr>
struct __hash_node_base
{
typedef __hash_node_base __first_node;
typedef _NodePtr pointer;
// typedef _NodePtr pointer;
pointer __next_;
_NodePtr __next_;
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
};

View File

@@ -19,7 +19,21 @@
#include <cstdint>
#include <cctype>
#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>
#endif
#pragma GCC system_header
@@ -302,7 +316,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_VISIBLE ctype_base
{
public:
typedef __uint32_t mask;
typedef std::uint32_t mask;
#if __APPLE__
static const mask space = _CTYPE_S;
@@ -315,6 +329,17 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
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__
static const mask space = _ISspace;
static const mask print = _ISprint;
@@ -451,7 +476,7 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
return isascii(__c) ? __tab_[__c] & __m : false;
return isascii(__c) ? (__tab_ ? __tab_[__c] & __m : _isctype(__c, __m)) : false;
}
_LIBCPP_ALWAYS_INLINE

View File

@@ -14,7 +14,35 @@
#include <__config>
#include <chrono>
#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>
#endif
#pragma GCC system_header

View File

@@ -288,12 +288,12 @@ __stdoutbuf<_CharT>::sync()
__r = __cv_->unshift(__st_, __extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
if (__r == codecvt_base::error)
return -1;
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
return -1;
} while (__r == codecvt_base::partial);
if (__r == codecvt_base::error)
return -1;
if (fflush(__file_))
return -1;
return 0;

View File

@@ -769,6 +769,7 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -779,10 +780,10 @@ public:
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef typename __node::base::pointer __node_base_pointer;
typedef typename __node::base::const_pointer __node_base_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
typedef typename __node_base::const_pointer __node_base_const_pointer;
private:
typedef typename __node::base::base __end_node_t;
typedef typename __node_base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
@@ -910,13 +911,12 @@ public:
iterator __insert_multi(_V&& __v);
template <class _V>
iterator __insert_multi(const_iterator __p, _V&& __v);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v);
iterator __insert_unique(const_iterator __p, const value_type& __v);
iterator __insert_multi(const value_type& __v);
iterator __insert_multi(const_iterator __p, const value_type& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
iterator __node_insert_unique(const_iterator __p,
@@ -997,19 +997,19 @@ public:
__node_holder remove(const_iterator __p);
private:
typename __node::base::pointer&
__find_leaf_low(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
__find_leaf_high(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
typename __node_base::pointer&
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
__find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
__find_leaf(const_iterator __hint,
typename __node::base::pointer& __parent, const value_type& __v);
typename __node_base::pointer& __parent, const value_type& __v);
template <class _Key>
typename __node::base::pointer&
__find_equal(typename __node::base::pointer& __parent, const _Key& __v);
typename __node_base::pointer&
__find_equal(typename __node_base::pointer& __parent, const _Key& __v);
template <class _Key>
typename __node::base::pointer&
__find_equal(const_iterator __hint, typename __node::base::pointer& __parent,
typename __node_base::pointer&
__find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
const _Key& __v);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -1411,8 +1411,8 @@ __tree<_Tp, _Compare, _Allocator>::clear()
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1450,8 +1450,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointe
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1492,9 +1492,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::point
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
typename __node::base::pointer& __parent,
typename __node_base::pointer& __parent,
const value_type& __v)
{
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
@@ -1528,8 +1528,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
const _Key& __v)
{
__node_pointer __nd = __root();
@@ -1577,9 +1577,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer&
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
typename __node::base::pointer& __parent,
typename __node_base::pointer& __parent,
const _Key& __v)
{
if (__hint == end() || value_comp()(__v, *__hint)) // check before
@@ -1609,7 +1609,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
const_iterator __next = _STD::next(__hint);
if (__next == end() || value_comp()(__v, *__next))
{
// *__hint < __v < *next(__hint)
// *__hint < __v < *_STD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
@@ -1728,18 +1728,11 @@ template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
return pair<iterator, bool>(iterator(__r), __inserted);
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
return __r;
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1747,16 +1740,11 @@ template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
return __r;
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1796,6 +1784,8 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
return _STD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
@@ -1852,8 +1842,6 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
return iterator(__h.release());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)

View File

@@ -214,7 +214,11 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>

View File

@@ -1559,8 +1559,17 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
for (; __n > 0; --__n, ++__first, ++__result)
if (__n > 0)
{
*__result = *__first;
++__result;
for (--__n; __n > 0; --__n)
{
++__first;
*__result = *__first;
++__result;
}
}
return __result;
}

View File

@@ -530,6 +530,10 @@ void atomic_signal_fence(memory_order m);
_LIBCPP_BEGIN_NAMESPACE_STD
#if !__has_feature(cxx_atomic)
#error <atomic> is not implemented
#else
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
@@ -1502,6 +1506,8 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_LONG_LOCK_FREE 0
#define ATOMIC_LLONG_LOCK_FREE 0
#endif // !__has_feature(cxx_atomic)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ATOMIC

View File

@@ -30,25 +30,43 @@ Macros:
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
const int __elast1 = ELAST+1;
const int __elast2 = ELAST+2;
#undef ELAST
#else
const int __elast1 = 104;
const int __elast2 = 105;
#endif
#ifdef ENOTRECOVERABLE
#define EOWNERDEAD __elast1
#ifdef ELAST
#undef ELAST
#define ELAST EOWNERDEAD
#endif
#elif defined(EOWNERDEAD)
#define ENOTRECOVERABLE __elast1
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#else // defined(EOWNERDEAD)
#define EOWNERDEAD __elast1
#define ENOTRECOVERABLE __elast2
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#endif // defined(EOWNERDEAD)

View File

@@ -1787,7 +1787,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = __move_and_check(next(__b), __b + __pos, __b, __vt);
__b = __move_and_check(_STD::next(__b), __b + __pos, __b, __vt);
*__b = *__vt;
}
}
@@ -1847,7 +1847,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(next(__b), __b + __pos, __b);
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = _STD::move(__v);
}
}
@@ -1905,7 +1905,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(next(__b), __b + __pos, __b);
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = value_type(_STD::forward<_Args>(__args)...);
}
}
@@ -2621,7 +2621,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
}
else
{ // erase from back
iterator __i = _STD::move(next(__p), __base::end(), __p);
iterator __i = _STD::move(_STD::next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _STD::addressof(*__i));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)

View File

@@ -173,6 +173,11 @@ typedef basic_fstream<wchar_t> wfstream;
#pragma GCC system_header
#ifdef _WIN32
#define fseeko fseek
#define ftello ftell
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>

View File

@@ -801,6 +801,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
#if 1
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
__is.setstate(ios_base::eofbit | ios_base::failbit);
else
__c = _Traits::to_char_type(__i);
#else
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
@@ -812,6 +819,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}

View File

@@ -186,7 +186,10 @@ template <class charT> class messages_byname;
#endif
#include <cstdlib>
#include <ctime>
#ifndef _WIN32
#include <nl_types.h>
#endif
#pragma GCC system_header
@@ -303,7 +306,14 @@ __nolocale_asprintf(char** __ret,
{
va_list __ap;
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);
return __result;
}
@@ -522,6 +532,12 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
{
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
{
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
__dc = 0;
return 0;
}
if (__ct == __thousands_sep && __grouping.size() != 0)
{
if (__g_end-__g < __num_get_buf_sz)
@@ -532,22 +548,28 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
return 0;
}
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
if (__f >= 26)
if (__f >= 24)
return -1;
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
switch (__base)
{
case 8:
case 10:
if (__f >= __base)
return 0;
return -1;
break;
default:
if (__f >= 22)
case 16:
if (__f < 22)
break;
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
{
__dc = 0;
*__a_end++ = __src[__f];
return 0;
break;
}
return -1;
}
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
++__dc;
return 0;
}
@@ -733,22 +755,32 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
int __save_errno = errno;
errno = 0;
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;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__ll > numeric_limits<_Tp>::max())
else if (__current_errno == ERANGE ||
__ll < numeric_limits<_Tp>::min() ||
numeric_limits<_Tp>::max() < __ll)
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::max();
}
else if (__ll < numeric_limits<_Tp>::min())
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::min();
if (__ll > 0)
return numeric_limits<_Tp>::max();
else
return numeric_limits<_Tp>::min();
}
return static_cast<_Tp>(__ll);
}
@@ -763,14 +795,30 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
if (*__a == '-')
{
__err = ios_base::failbit;
return 0;
}
int __save_errno = errno;
errno = 0;
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;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__ll > numeric_limits<_Tp>::max())
else if (__current_errno == ERANGE ||
numeric_limits<_Tp>::max() < __ll)
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::max();
@@ -788,7 +836,13 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
if (__a != __a_end)
{
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)
{
__err = ios_base::failbit;
@@ -1648,11 +1702,17 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
template <class _CharT, class _OutputIterator>
_OutputIterator
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
char __fmt[8] = {'%', 0};
#ifdef _WIN32
const char* __len = "";
double __v = __lv;
#else
const char* __len = "L";
long double __v = __lv;
#endif
bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
const unsigned __nbuf = 30;
char __nar[__nbuf];
@@ -2318,6 +2378,12 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'F':
{
const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'H':
__get_hour(__tm->tm_hour, __b, __e, __err, __ct);
break;
@@ -3474,7 +3540,7 @@ extern template class money_put<wchar_t>;
class _LIBCPP_VISIBLE messages_base
{
public:
typedef nl_catd catalog;
typedef ptrdiff_t catalog;
_LIBCPP_ALWAYS_INLINE messages_base() {}
};
@@ -3531,7 +3597,14 @@ template <class _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
return catopen(__nm.c_str(), NL_CAT_LOCALE);
#ifdef __MINGW32__
return -1;
#else
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
if (__cat != -1)
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
return __cat;
#endif
}
template <class _CharT>
@@ -3539,22 +3612,35 @@ typename messages<_CharT>::string_type
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
const string_type& __dflt) const
{
#ifdef __MINGW32__
string_type __w;
return __w;
#else
string __ndflt;
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
__dflt.c_str(),
__dflt.c_str() + __dflt.size());
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
string_type __w;
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
__n, __n + strlen(__n));
return __w;
#endif
}
template <class _CharT>
void
messages<_CharT>::do_close(catalog __c) const
{
catclose(__c);
#ifndef __MINGW32__
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
catclose(__cat);
#endif
}
extern template class messages<char>;

View File

@@ -493,11 +493,11 @@ class _LIBCPP_VISIBLE __map_iterator
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
typedef const typename _TreeIterator::value_type::first_type key_type;
typedef typename _TreeIterator::value_type::second_type mapped_type;
typedef const typename _TreeIterator::value_type::first_type __key_type;
typedef typename _TreeIterator::value_type::second_type __mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<key_type, mapped_type> value_type;
typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
@@ -558,18 +558,18 @@ class _LIBCPP_VISIBLE __map_const_iterator
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
typedef const typename _TreeIterator::value_type::first_type key_type;
typedef typename _TreeIterator::value_type::second_type mapped_type;
typedef const typename _TreeIterator::value_type::first_type __key_type;
typedef typename _TreeIterator::value_type::second_type __mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<key_type, mapped_type> value_type;
typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
rebind<const value_type>
#else
rebind<value_type>::other
rebind<const value_type>::other
#endif
pointer;

View File

@@ -90,6 +90,18 @@ _LIBCPP_VISIBLE new_handler get_new_handler() throw();
} // 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, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void operator delete(void*) throw();

View File

@@ -1276,7 +1276,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
{
return __os << __x.template to_string<_CharT, _Traits>
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),

View File

@@ -1650,6 +1650,16 @@ class piecewise_linear_distribution
_LIBCPP_BEGIN_NAMESPACE_STD
// __is_seed_sequence
template <class _Sseq, class _Engine>
struct __is_seed_sequence
{
static const bool value =
!is_convertible<_Sseq, typename _Engine::result_type>::value &&
!is_same<typename remove_cv<_Sseq>::type, _Engine>::value;
};
// linear_congruential_engine
template <unsigned long long __a, unsigned long long __c,
@@ -1848,7 +1858,7 @@ public:
{seed(__s);}
template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0)
{seed(__q);}
_LIBCPP_INLINE_VISIBILITY
void seed(result_type __s = default_seed)
@@ -1858,7 +1868,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, linear_congruential_engine>::value,
void
>::type
seed(_Sseq& __q)
@@ -2104,14 +2114,14 @@ public:
{seed(__sd);}
template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0)
{seed(__q);}
void seed(result_type __sd = default_seed);
template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, mersenne_twister_engine>::value,
void
>::type
seed(_Sseq& __q)
@@ -2473,7 +2483,7 @@ public:
{seed(__sd);}
template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0)
{seed(__q);}
_LIBCPP_INLINE_VISIBILITY
void seed(result_type __sd = default_seed)
@@ -2482,7 +2492,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value,
void
>::type
seed(_Sseq& __q)
@@ -2741,7 +2751,7 @@ public:
template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
explicit discard_block_engine(_Sseq& __q,
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
typename enable_if<__is_seed_sequence<_Sseq, discard_block_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q), __n_(0) {}
_LIBCPP_INLINE_VISIBILITY
@@ -2752,7 +2762,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, discard_block_engine>::value,
void
>::type
seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
@@ -2940,7 +2950,7 @@ public:
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
template<class _Sseq> explicit independent_bits_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {}
_LIBCPP_INLINE_VISIBILITY
@@ -2951,7 +2961,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, independent_bits_engine>::value,
void
>::type
seed(_Sseq& __q) {__e_.seed(__q);}
@@ -3163,7 +3173,7 @@ public:
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q,
_LIBCPP_INLINE_VISIBILITY
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {__init();}
_LIBCPP_INLINE_VISIBILITY
@@ -3174,7 +3184,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_convertible<_Sseq, result_type>::value,
__is_seed_sequence<_Sseq, shuffle_order_engine>::value,
void
>::type
seed(_Sseq& __q) {__e_.seed(__q); __init();}
@@ -4467,7 +4477,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
{
result_type __x;
uniform_real_distribution<double> __urd;
if (__pr.__mean_ <= 10)
if (__pr.__mean_ < 10)
{
__x = 0;
for (double __p = __urd(__urng); __p > __pr.__l_; ++__x)

View File

@@ -1264,6 +1264,7 @@ struct __state
vector<pair<size_t, const _CharT*> > __loop_data_;
const __node<_CharT>* __node_;
regex_constants::match_flag_type __flags_;
bool __at_first_;
_LIBCPP_INLINE_VISIBILITY
__state()
@@ -1890,6 +1891,40 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const
}
}
// __l_anchor
template <class _CharT>
class __l_anchor
: public __owns_one_state<_CharT>
{
typedef __owns_one_state<_CharT> base;
public:
typedef _STD::__state<_CharT> __state;
_LIBCPP_INLINE_VISIBILITY
__l_anchor(__node<_CharT>* __s)
: base(__s) {}
virtual void __exec(__state&) const;
};
template <class _CharT>
void
__l_anchor<_CharT>::__exec(__state& __s) const
{
if (__s.__at_first_ && __s.__current_ == __s.__first_)
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
else
{
__s.__do_ = __state::__reject;
__s.__node_ = nullptr;
}
}
// __r_anchor
template <class _CharT>
@@ -2394,7 +2429,6 @@ private:
int __open_count_;
shared_ptr<__empty_state<_CharT> > __start_;
__owns_one_state<_CharT>* __end_;
bool __left_anchor_;
typedef _STD::__state<_CharT> __state;
typedef _STD::__node<_CharT> __node;
@@ -2416,17 +2450,17 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex()
: __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0), __left_anchor_(false)
__end_(0)
{}
_LIBCPP_INLINE_VISIBILITY
explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0), __left_anchor_(false)
__end_(0)
{__parse(__p, __p + __traits_.length(__p));}
_LIBCPP_INLINE_VISIBILITY
basic_regex(const value_type* __p, size_t __len, flag_type __f)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0), __left_anchor_(false)
__end_(0)
{__parse(__p, __p + __len);}
// basic_regex(const basic_regex&) = default;
// basic_regex(basic_regex&&) = default;
@@ -2435,20 +2469,20 @@ public:
explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0), __left_anchor_(false)
__end_(0)
{__parse(__p.begin(), __p.end());}
template <class _ForwardIterator>
_LIBCPP_INLINE_VISIBILITY
basic_regex(_ForwardIterator __first, _ForwardIterator __last,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0), __left_anchor_(false)
__end_(0)
{__parse(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
basic_regex(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0), __left_anchor_(false)
__end_(0)
{__parse(__il.begin(), __il.end());}
// ~basic_regex() = default;
@@ -2506,7 +2540,6 @@ private:
__loop_count_ = 0;
__open_count_ = 0;
__end_ = nullptr;
__left_anchor_ = false;
}
public:
@@ -2694,7 +2727,7 @@ private:
basic_string<_CharT>* __str = nullptr);
_LIBCPP_INLINE_VISIBILITY
void __push_l_anchor() {__left_anchor_ = true;}
void __push_l_anchor();
void __push_r_anchor();
void __push_match_any();
void __push_match_any_but_newline();
@@ -2732,22 +2765,22 @@ private:
bool
__match_at_start(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const;
regex_constants::match_flag_type __flags, bool) const;
template <class _Allocator>
bool
__match_at_start_ecma(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const;
regex_constants::match_flag_type __flags, bool) const;
template <class _Allocator>
bool
__match_at_start_posix_nosubs(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const;
regex_constants::match_flag_type __flags, bool) const;
template <class _Allocator>
bool
__match_at_start_posix_subs(const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const;
regex_constants::match_flag_type __flags, bool) const;
template <class _B, class _A, class _C, class _T>
friend
@@ -2809,7 +2842,6 @@ basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
swap(__open_count_, __r.__open_count_);
swap(__start_, __r.__start_);
swap(__end_, __r.__end_);
swap(__left_anchor_, __r.__left_anchor_);
}
template <class _CharT, class _Traits>
@@ -2850,7 +2882,9 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
match_results<const _CharT*> __m;
__m.__init(1 + __exp_.mark_count(), __s.__current_, __s.__last_);
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
__m, __s.__flags_);
__m,
__s.__flags_ | regex_constants::match_continuous,
true);
if (__matched != __invert_)
{
__s.__do_ = __state::__accept_but_not_consume;
@@ -4087,7 +4121,6 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
__exp.__push_l_anchor();
__push_lookahead(_STD::move(__exp), false);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
@@ -4101,7 +4134,6 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
__exp.__push_l_anchor();
__push_lookahead(_STD::move(__exp), true);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
@@ -4576,6 +4608,14 @@ basic_regex<_CharT, _Traits>::__push_end_marked_subexpression(unsigned __sub)
}
}
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_l_anchor()
{
__end_->first() = new __l_anchor<_CharT>(__end_->first());
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_r_anchor()
@@ -5441,7 +5481,7 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start_ecma(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const
regex_constants::match_flag_type __flags, bool __at_first) const
{
vector<__state> __states;
ptrdiff_t __j = 0;
@@ -5458,6 +5498,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
bool __matched = false;
do
{
@@ -5506,7 +5547,7 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const
regex_constants::match_flag_type __flags, bool __at_first) const
{
deque<__state> __states;
ptrdiff_t __highest_j = 0;
@@ -5522,6 +5563,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
bool __matched = false;
do
{
@@ -5583,7 +5625,7 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const
regex_constants::match_flag_type __flags, bool __at_first) const
{
vector<__state> __states;
__state __best_state;
@@ -5602,6 +5644,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
const _CharT* __current = __first;
bool __matched = false;
do
@@ -5667,13 +5710,13 @@ bool
basic_regex<_CharT, _Traits>::__match_at_start(
const _CharT* __first, const _CharT* __last,
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const
regex_constants::match_flag_type __flags, bool __at_first) const
{
if ((__flags_ & 0x1F0) == ECMAScript)
return __match_at_start_ecma(__first, __last, __m, __flags);
return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
if (mark_count() == 0)
return __match_at_start_posix_nosubs(__first, __last, __m, __flags);
return __match_at_start_posix_subs(__first, __last, __m, __flags);
return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
return __match_at_start_posix_subs(__first, __last, __m, __flags, __at_first);
}
template <class _CharT, class _Traits>
@@ -5684,11 +5727,9 @@ basic_regex<_CharT, _Traits>::__search(
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags) const
{
if (__left_anchor_)
__flags |= regex_constants::match_continuous;
__m.__init(1 + mark_count(), __first, __last,
__flags & regex_constants::__no_update_pos);
if (__match_at_start(__first, __last, __m, __flags))
if (__match_at_start(__first, __last, __m, __flags, true))
{
__m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
@@ -5702,7 +5743,7 @@ basic_regex<_CharT, _Traits>::__search(
for (++__first; __first != __last; ++__first)
{
__m.__matches_.assign(__m.size(), __m.__unmatched_);
if (__match_at_start(__first, __last, __m, __flags))
if (__match_at_start(__first, __last, __m, __flags, false))
{
__m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;

View File

@@ -115,22 +115,22 @@ public:
enum class errc
{
address_family_not_supported, // EAFNOSUPPORT
address_in_use, // EADDRINUSE
address_not_available, // EADDRNOTAVAIL
already_connected, // EISCONN
// address_family_not_supported, // EAFNOSUPPORT
// address_in_use, // EADDRINUSE
// address_not_available, // EADDRNOTAVAIL
// already_connected, // EISCONN
argument_list_too_long, // E2BIG
argument_out_of_domain, // EDOM
bad_address, // EFAULT
bad_file_descriptor, // EBADF
bad_message, // EBADMSG
// bad_message, // EBADMSG
broken_pipe, // EPIPE
connection_aborted, // ECONNABORTED
connection_already_in_progress, // EALREADY
connection_refused, // ECONNREFUSED
connection_reset, // ECONNRESET
// connection_aborted, // ECONNABORTED
// connection_already_in_progress, // EALREADY
// connection_refused, // ECONNREFUSED
// connection_reset, // ECONNRESET
cross_device_link, // EXDEV
destination_address_required, // EDESTADDRREQ
// destination_address_required, // EDESTADDRREQ
device_or_resource_busy, // EBUSY
directory_not_empty, // ENOTEMPTY
executable_format_error, // ENOEXEC
@@ -138,8 +138,8 @@ enum class errc
file_too_large, // EFBIG
filename_too_long, // ENAMETOOLONG
function_not_supported, // ENOSYS
host_unreachable, // EHOSTUNREACH
identifier_removed, // EIDRM
// host_unreachable, // EHOSTUNREACH
// identifier_removed, // EIDRM
illegal_byte_sequence, // EILSEQ
inappropriate_io_control_operation, // ENOTTY
interrupted, // EINTR
@@ -147,16 +147,16 @@ enum class errc
invalid_seek, // ESPIPE
io_error, // EIO
is_a_directory, // EISDIR
message_size, // EMSGSIZE
network_down, // ENETDOWN
network_reset, // ENETRESET
network_unreachable, // ENETUNREACH
no_buffer_space, // ENOBUFS
// message_size, // EMSGSIZE
// network_down, // ENETDOWN
// network_reset, // ENETRESET
// network_unreachable, // ENETUNREACH
// no_buffer_space, // ENOBUFS
no_child_process, // ECHILD
no_link, // ENOLINK
// no_link, // ENOLINK
no_lock_available, // ENOLCK
no_message_available, // ENODATA
no_message, // ENOMSG
// no_message, // ENOMSG
no_protocol_option, // ENOPROTOOPT
no_space_on_device, // ENOSPC
no_stream_resources, // ENOSR
@@ -246,22 +246,42 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
struct errc
{
enum _ {
#ifdef EAFNOSUPPORT
address_family_not_supported = EAFNOSUPPORT,
#endif
#ifdef EADDRINUSE
address_in_use = EADDRINUSE,
#endif
#ifdef EADDRNOTAVAIL
address_not_available = EADDRNOTAVAIL,
#endif
#ifdef EISCONN
already_connected = EISCONN,
#endif
argument_list_too_long = E2BIG,
argument_out_of_domain = EDOM,
bad_address = EFAULT,
bad_file_descriptor = EBADF,
#ifdef EBADMSG
bad_message = EBADMSG,
#endif
broken_pipe = EPIPE,
#ifdef ECONNABORTED
connection_aborted = ECONNABORTED,
#endif
#ifdef EALREADY
connection_already_in_progress = EALREADY,
#endif
#ifdef ECONNREFUSED
connection_refused = ECONNREFUSED,
#endif
#ifdef ECONNRESET
connection_reset = ECONNRESET,
#endif
cross_device_link = EXDEV,
#ifdef EDESTADDRREQ
destination_address_required = EDESTADDRREQ,
#endif
device_or_resource_busy = EBUSY,
directory_not_empty = ENOTEMPTY,
executable_format_error = ENOEXEC,
@@ -269,8 +289,12 @@ enum _ {
file_too_large = EFBIG,
filename_too_long = ENAMETOOLONG,
function_not_supported = ENOSYS,
#ifdef EHOSTUNREACH
host_unreachable = EHOSTUNREACH,
#endif
#ifdef EIDRM
identifier_removed = EIDRM,
#endif
illegal_byte_sequence = EILSEQ,
inappropriate_io_control_operation = ENOTTY,
interrupted = EINTR,
@@ -278,21 +302,37 @@ enum _ {
invalid_seek = ESPIPE,
io_error = EIO,
is_a_directory = EISDIR,
#ifdef EMSGSIZE
message_size = EMSGSIZE,
#endif
#ifdef ENETDOWN
network_down = ENETDOWN,
#endif
#ifdef ENETRESET
network_reset = ENETRESET,
#endif
#ifdef ENETUNREACH
network_unreachable = ENETUNREACH,
#endif
#ifdef ENOBUFS
no_buffer_space = ENOBUFS,
#endif
no_child_process = ECHILD,
#ifdef ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
#ifdef ENOMSG
#ifdef ENODATA
no_message_available = ENODATA,
#else
no_message_available = ENOMSG,
#endif
no_message = ENOMSG,
#endif
#ifdef ENOPROTOOPT,
no_protocol_option = ENOPROTOOPT,
#endif
no_space_on_device = ENOSPC,
#ifdef ENOSR
no_stream_resources = ENOSR,
@@ -304,24 +344,42 @@ enum _ {
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
#ifdef ENOTSOCK
not_a_socket = ENOTSOCK,
#endif
#ifdef ENOSTR
not_a_stream = ENOSTR,
#else
not_a_stream = EINVAL,
#endif
#ifdef ENOTCONN
not_connected = ENOTCONN,
#endif
not_enough_memory = ENOMEM,
#ifdef ENOTSUP
not_supported = ENOTSUP,
#endif
#ifdef ECANCELED
operation_canceled = ECANCELED,
#endif
#ifdef EINPROGRESS
operation_in_progress = EINPROGRESS,
#endif
operation_not_permitted = EPERM,
#ifdef EOPNOTSUPP
operation_not_supported = EOPNOTSUPP,
#endif
#ifdef EWOULDBLOCK
operation_would_block = EWOULDBLOCK,
#endif
owner_dead = EOWNERDEAD,
permission_denied = EACCES,
#ifdef EPROTO
protocol_error = EPROTO,
#endif
#ifdef EPROTONOSUPPORT
protocol_not_supported = EPROTONOSUPPORT,
#endif
read_only_file_system = EROFS,
resource_deadlock_would_occur = EDEADLK,
resource_unavailable_try_again = EAGAIN,
@@ -329,17 +387,27 @@ enum _ {
state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
stream_timeout = ETIME,
#else
#elif defined(ETIMEDOUT)
stream_timeout = ETIMEDOUT,
#endif
#ifdef ETXTBSY
text_file_busy = ETXTBSY,
#endif
#ifdef ETIMEDOUT
timed_out = ETIMEDOUT,
#endif
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK,
#ifdef ELOOP
too_many_symbolic_link_levels = ELOOP,
#endif
#ifdef EOVERFLOW
value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE
#endif
#ifdef EPROTOTYPE
wrong_protocol_type = EPROTOTYPE,
#endif
};
_ __v_;

View File

@@ -95,7 +95,15 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#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>
#endif
#pragma GCC system_header

View File

@@ -211,6 +211,14 @@ template <> struct __is_void<void> : public true_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_void
: public __is_void<typename remove_cv<_Tp>::type> {};
// __is_nullptr_t
template <class _Tp> struct ____is_nullptr_t : public false_type {};
template <> struct ____is_nullptr_t<nullptr_t> : public true_type {};
template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
: public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
// is_integral
template <class _Tp> struct __is_integral : public false_type {};
@@ -392,7 +400,8 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
// is_fundamental
template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
: public integral_constant<bool, is_void<_Tp>::value ||
: public integral_constant<bool, is_void<_Tp>::value ||
__is_nullptr_t<_Tp>::value ||
is_arithmetic<_Tp>::value> {};
// is_scalar
@@ -401,8 +410,11 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
: public integral_constant<bool, is_arithmetic<_Tp>::value ||
is_member_pointer<_Tp>::value ||
is_pointer<_Tp>::value ||
__is_nullptr_t<_Tp>::value ||
is_enum<_Tp>::value > {};
template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};
// is_object
template <class _Tp> struct _LIBCPP_VISIBLE is_object

View File

@@ -211,6 +211,13 @@ struct _LIBCPP_VISIBLE pair
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
: first(__x), second(__y) {}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(__p.first), second(__p.second) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _U1, class _U2,
@@ -222,6 +229,14 @@ struct _LIBCPP_VISIBLE pair
second(_STD::forward<_U2>(__u2))
{}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(_STD::forward<_U1>(__p.first)),
second(_STD::forward<_U2>(__p.second)) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Tuple,
@@ -261,10 +276,6 @@ struct _LIBCPP_VISIBLE pair
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
private:

View File

@@ -32,7 +32,7 @@ append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
target_link_libraries(cxx ${libraries})
# 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)
set_target_properties(cxx
@@ -53,4 +53,5 @@ install(DIRECTORY ../include/
DESTINATION include/c++/v1
FILES_MATCHING
PATTERN "*"
PATTERN ".svn" EXCLUDE
)

View File

@@ -116,10 +116,16 @@ steady_clock::now()
steady_clock::time_point
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;
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
#endif
}
#endif // __APPLE__

View File

@@ -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_nsec = static_cast<decltype(ts.tv_nsec)>((d - s).count());
int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
#ifndef __MINGW32__
if (ec != 0 && ec != ETIMEDOUT)
__throw_system_error(ec, "condition_variable timed_wait failed");
#endif
}
void

View File

@@ -77,6 +77,9 @@ std::terminate()
bool std::uncaught_exception() throw()
{
#ifdef _LIBCPP_NO_EXCEPTIONS
return false;
#endif
#if __APPLE__
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxxabiapple::__cxa_uncaught_exception();

View File

@@ -18,7 +18,20 @@
#include "cstring"
#include "cwctype"
#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>
#endif
#include <stdlib.h>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -561,6 +574,22 @@ locale::id::__init()
// 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<char>(refs),
__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
*to_nxt++ = *p++;
return ok;
#elif defined(_WIN32)
to_nxt = to;
return noconv;
#else
return error;
#endif

View File

@@ -18,110 +18,16 @@
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else // __APPLE__
static std::new_handler __new_handler;
_LIBCPP_BEGIN_NAMESPACE_STD
::std::new_handler __new_handler;
_LIBCPP_END_NAMESPACE_STD
#endif
#if 0
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overriden by programs
// 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
}
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
{

7
src/new_ZdaPv.cpp Normal file
View File

@@ -0,0 +1,7 @@
#include "new"
void
operator delete[] (void* ptr) throw ()
{
::operator delete (ptr);
}

View 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
View File

@@ -0,0 +1,10 @@
#include <stdlib.h>
#include "new"
void
operator delete(void* ptr) throw ()
{
if (ptr)
::free(ptr);
}

View 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
View File

@@ -0,0 +1,7 @@
#include "new"
void*
operator new[](size_t size) throw (std::bad_alloc)
{
return ::operator new(size);
}

View 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
View 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;
}

View 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;
}

View File

@@ -7,11 +7,17 @@
//
//===----------------------------------------------------------------------===//
#define MINGW_HAS_SECURE_API
#include "string"
#include "cstdlib"
#include "cwchar"
#include "cerrno"
#ifdef _WIN32
#define swprintf swprintf_s
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template class __basic_string_common<true>;

View File

@@ -12,7 +12,10 @@
#include "vector"
#include "future"
#include <sys/types.h>
#ifdef __MINGW32__
#else
#include <sys/sysctl.h>
#endif
_LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -0,0 +1,15 @@
#include <windows.h>
namespace {
class Win32ctor {
public:
Win32ctor() {
SetErrorMode(SEM_FAILCRITICALERRORS |
SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
}
};
static Win32ctor ctor;
}

View File

@@ -7,15 +7,19 @@
//
//===----------------------------------------------------------------------===//
// <mutex>
// <map>
// class mutex;
// class map
// mutex();
// map();
#include <mutex>
#include <map>
struct X
{
std::multimap<int, X> m;
};
int main()
{
std::mutex m;
}

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