aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chisnall <theraven@FreeBSD.org>2012-11-29 13:28:56 +0000
committerDavid Chisnall <theraven@FreeBSD.org>2012-11-29 13:28:56 +0000
commitfbd326037ffe8b31f74ce56deb05b6432b26665c (patch)
tree76ba5474b3b80dd4c16c468574c694190c0c3eb6
parent3b5257a34b8cc9da481af474449a5d7cfac88d0d (diff)
downloadsrc-fbd326037ffe8b31f74ce56deb05b6432b26665c.tar.gz
src-fbd326037ffe8b31f74ce56deb05b6432b26665c.zip
Import new libc++. This contains some fixes for code compiled in c++98 / c++03vendor/libc++/r168853
mode.
Notes
Notes: svn path=/vendor/libc++/dist/; revision=243671 svn path=/vendor/libc++/r168853/; revision=243672; tag=vendor/libc++/r168853
-rw-r--r--include/__config3
-rw-r--r--include/cstdlib16
-rw-r--r--include/cwchar4
-rw-r--r--include/exception2
-rw-r--r--include/iterator25
-rw-r--r--include/locale10
6 files changed, 50 insertions, 10 deletions
diff --git a/include/__config b/include/__config
index 2bbe1d972422..203be7616cc1 100644
--- a/include/__config
+++ b/include/__config
@@ -51,6 +51,9 @@
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
+# ifndef __LONG_LONG_SUPPORTED
+# define _LIBCPP_HAS_NO_LONG_LONG
+# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
#ifdef _WIN32
diff --git a/include/cstdlib b/include/cstdlib
index 7f6c6c82f7de..95e384283a7c 100644
--- a/include/cstdlib
+++ b/include/cstdlib
@@ -97,18 +97,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::size_t;
using ::div_t;
using ::ldiv_t;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::lldiv_t;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::atof;
using ::atoi;
using ::atol;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::atoll;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::strtod;
using ::strtof;
using ::strtold;
using ::strtol;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::strtoll;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::strtoul;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::strtoull;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::rand;
using ::srand;
using ::calloc;
@@ -125,10 +133,14 @@ using ::bsearch;
using ::qsort;
using ::abs;
using ::labs;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::llabs;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::div;
using ::ldiv;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::lldiv;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::mblen;
using ::mbtowc;
using ::wctomb;
@@ -145,10 +157,14 @@ using ::aligned_alloc;
// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
#if !defined(_MSC_VER) && !defined(__sun__)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _MSC_VER
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/cwchar b/include/cwchar
index 8e788fc764e1..eed6de18f1a3 100644
--- a/include/cwchar
+++ b/include/cwchar
@@ -151,9 +151,13 @@ using ::wcstof;
using ::wcstold;
#endif // _MSC_VER
using ::wcstol;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoll;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoul;
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoull;
+#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::wcscpy;
using ::wcsncpy;
using ::wcscat;
diff --git a/include/exception b/include/exception
index 5b75fb04bbba..51a48c8286d6 100644
--- a/include/exception
+++ b/include/exception
@@ -143,7 +143,7 @@ public:
{return !(__x == __y);}
friend exception_ptr current_exception() _NOEXCEPT;
- _LIBCPP_NORETURN friend void rethrow_exception(exception_ptr);
+ friend void rethrow_exception(exception_ptr);
};
template<class _Ep>
diff --git a/include/iterator b/include/iterator
index bcbf3ae4af8c..bc0ce4759ce7 100644
--- a/include/iterator
+++ b/include/iterator
@@ -317,6 +317,10 @@ template <class T, size_t N> T* end(T (&array)[N]);
#include <type_traits>
#include <cstddef>
#include <iosfwd>
+#if __APPLE__
+#include <Availability.h>
+#endif
+
#ifdef _LIBCPP_DEBUG
#include <cassert>
#endif
@@ -795,7 +799,7 @@ public:
typedef basic_streambuf<_CharT,_Traits> streambuf_type;
typedef basic_istream<_CharT,_Traits> istream_type;
private:
- streambuf_type* __sbuf_;
+ mutable streambuf_type* __sbuf_;
class __proxy
{
@@ -809,13 +813,14 @@ private:
};
_LIBCPP_INLINE_VISIBILITY
- void __test_for_eof()
+ bool __test_for_eof() const
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
__sbuf_ = 0;
+ return __sbuf_ == 0;
}
public:
- _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
@@ -828,19 +833,16 @@ public:
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
- if (traits_type::eq_int_type(__sbuf_->snextc(), traits_type::eof()))
- __sbuf_ = 0;
+ __sbuf_->sbumpc();
return *this;
}
_LIBCPP_INLINE_VISIBILITY __proxy operator++(int)
{
- char_type __c = __sbuf_->sgetc();
- ++(*this);
- return __proxy(__c, __sbuf_);
+ return __proxy(__sbuf_->sbumpc(), __sbuf_);
}
_LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const
- {return (__sbuf_ == 0) == (__b.__sbuf_ == 0);}
+ {return __test_for_eof() == __b.__test_for_eof();}
};
template <class _CharT, class _Traits>
@@ -882,6 +884,10 @@ public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
+#if !defined(__APPLE__) || \
+ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
+ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
+
template <class _Ch, class _Tr>
friend
_LIBCPP_HIDDEN
@@ -889,6 +895,7 @@ public:
__pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
ios_base& __iob, _Ch __fl);
+#endif
};
template <class _Iter>
diff --git a/include/locale b/include/locale
index 976c4cf50a17..f04a36b43990 100644
--- a/include/locale
+++ b/include/locale
@@ -192,6 +192,10 @@ template <class charT> class messages_byname;
#include <nl_types.h>
#endif // !_WIN32
+#if __APPLE__
+#include <Availability.h>
+#endif
+
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -1587,6 +1591,10 @@ __pad_and_output(_OutputIterator __s,
return __s;
}
+#if !defined(__APPLE__) || \
+ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
+ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
+
template <class _CharT, class _Traits>
_LIBCPP_HIDDEN
ostreambuf_iterator<_CharT, _Traits>
@@ -1633,6 +1641,8 @@ __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
return __s;
}
+#endif
+
template <class _CharT, class _OutputIterator>
_OutputIterator
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,