diff options
| author | joerg <joerg@NetBSD.org> | 2014-01-08 17:15:24 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2014-01-08 17:15:24 +0000 |
| commit | 5d774da975bd9405df03f71c2ec97bdabb6901a9 (patch) | |
| tree | 479b82cd64181a43058eb8c9574c495149a1e902 /external/bsd/libc++ | |
| parent | 416dc4dc4fcf0b0175627766cea342506ddaaae6 (diff) | |
Import libc+++ r198773. Fixes a bug in stdexcept I introduced when
removing C style casts.
Diffstat (limited to 'external/bsd/libc++')
10 files changed, 64 insertions, 104 deletions
diff --git a/external/bsd/libc++/dist/libcxx/include/__config b/external/bsd/libc++/dist/libcxx/include/__config index 8aa57acfd72..f33e25be5a7 100644 --- a/external/bsd/libc++/dist/libcxx/include/__config +++ b/external/bsd/libc++/dist/libcxx/include/__config @@ -478,7 +478,7 @@ namespace std { } } -#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__ +#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS typedef unsigned short char16_t; diff --git a/external/bsd/libc++/dist/libcxx/include/__functional_base b/external/bsd/libc++/dist/libcxx/include/__functional_base index 1c337d8b4bf..6766793d7c8 100644 --- a/external/bsd/libc++/dist/libcxx/include/__functional_base +++ b/external/bsd/libc++/dist/libcxx/include/__functional_base @@ -451,10 +451,10 @@ public: } }; -template <class _Tp> struct ____is_reference_wrapper : public false_type {}; -template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {}; +template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; +template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; template <class _Tp> struct __is_reference_wrapper - : public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {}; + : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY diff --git a/external/bsd/libc++/dist/libcxx/include/__functional_base_03 b/external/bsd/libc++/dist/libcxx/include/__functional_base_03 index 296dd8db307..f297ee057a9 100644 --- a/external/bsd/libc++/dist/libcxx/include/__functional_base_03 +++ b/external/bsd/libc++/dist/libcxx/include/__functional_base_03 @@ -1047,10 +1047,10 @@ public: } }; -template <class _Tp> struct ____is_reference_wrapper : public false_type {}; -template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {}; +template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; +template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; template <class _Tp> struct __is_reference_wrapper - : public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {}; + : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY diff --git a/external/bsd/libc++/dist/libcxx/include/cmath b/external/bsd/libc++/dist/libcxx/include/cmath index 4f279783a90..def49c0bfcb 100644 --- a/external/bsd/libc++/dist/libcxx/include/cmath +++ b/external/bsd/libc++/dist/libcxx/include/cmath @@ -419,25 +419,12 @@ __libcpp_isnan(_A1 __x) _NOEXCEPT #undef isnan +template <class _A1> inline _LIBCPP_INLINE_VISIBILITY -bool -isnan(float __x) _NOEXCEPT -{ - return __libcpp_isnan(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -isnan(double __x) _NOEXCEPT -{ - return __libcpp_isnan(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -isnan(long double __x) _NOEXCEPT +typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type +isnan(_A1 __x) _NOEXCEPT { - return __libcpp_isnan(__x); + return __libcpp_isnan((typename std::__promote<_A1>::type)__x); } #endif // isnan @@ -665,26 +652,6 @@ using ::isunordered; using ::float_t; using ::double_t; -// isnan - -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<__promote<_A1>::value, bool>::type -#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES -isnan(_A1 __x) -#else -isnan(_A1&& __x) - _NOEXCEPT_ - ( - _NOEXCEPT_(__promote<_A1>::__does_not_throw) - ) -#endif -{ - typedef typename __promote<_A1>::type type; - static_assert(!(is_same<typename remove_reference<_A1>::type, type>::value), ""); - return __libcpp_isnan(static_cast<type>(_VSTD::forward<_A1>(__x))); -} - // abs #if !defined(_AIX) @@ -985,25 +952,18 @@ inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __ template <class _A1, class _A2> inline _LIBCPP_INLINE_VISIBILITY -typename __promote<_A1, _A2>::type -#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES -pow(_A1 __x, _A2 __y) -#else -pow(_A1&& __x, _A2&& __y) - _NOEXCEPT_ - ( - _NOEXCEPT_(__promote<_A1>::__does_not_throw) && - _NOEXCEPT_(__promote<_A2>::__does_not_throw) - ) -#endif +typename enable_if +< + is_arithmetic<_A1>::value && + is_arithmetic<_A2>::value, + typename __promote<_A1, _A2>::type +>::type +pow(_A1 __x, _A2 __y) _NOEXCEPT { - typedef typename __promote<_A1>::type _D1; - typedef typename __promote<_A2>::type _D2; - typedef typename __promote<_D1, _D2>::type type; - static_assert((!(is_same<typename remove_reference<_A1>::type, type>::value && - is_same<typename remove_reference<_A2>::type, type>::value)), ""); - return pow(static_cast<type>(static_cast<_D1>(_VSTD::forward<_A1>(__x))), - static_cast<type>(static_cast<_D2>(_VSTD::forward<_A2>(__y)))); + typedef typename __promote<_A1, _A2>::type __result_type; + static_assert((!(is_same<_A1, __result_type>::value && + is_same<_A2, __result_type>::value)), ""); + return pow((__result_type)__x, (__result_type)__y); } // sin diff --git a/external/bsd/libc++/dist/libcxx/include/iterator b/external/bsd/libc++/dist/libcxx/include/iterator index 70a664d9909..c6dd03340a7 100644 --- a/external/bsd/libc++/dist/libcxx/include/iterator +++ b/external/bsd/libc++/dist/libcxx/include/iterator @@ -364,10 +364,10 @@ public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; -template <class _Iter, bool> struct ____iterator_traits {}; +template <class _Iter, bool> struct __iterator_traits_impl {}; template <class _Iter> -struct ____iterator_traits<_Iter, true> +struct __iterator_traits_impl<_Iter, true> { typedef typename _Iter::difference_type difference_type; typedef typename _Iter::value_type value_type; @@ -380,7 +380,7 @@ template <class _Iter, bool> struct __iterator_traits {}; template <class _Iter> struct __iterator_traits<_Iter, true> - : ____iterator_traits + : __iterator_traits_impl < _Iter, is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value || diff --git a/external/bsd/libc++/dist/libcxx/include/tuple b/external/bsd/libc++/dist/libcxx/include/tuple index a1a7bcf0b5e..24e086db588 100644 --- a/external/bsd/libc++/dist/libcxx/include/tuple +++ b/external/bsd/libc++/dist/libcxx/include/tuple @@ -816,13 +816,13 @@ namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>() template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper; template <class _Tp> -struct ___make_tuple_return +struct __make_tuple_return_impl { typedef _Tp type; }; template <class _Tp> -struct ___make_tuple_return<reference_wrapper<_Tp> > +struct __make_tuple_return_impl<reference_wrapper<_Tp> > { typedef _Tp& type; }; @@ -830,7 +830,7 @@ struct ___make_tuple_return<reference_wrapper<_Tp> > template <class _Tp> struct __make_tuple_return { - typedef typename ___make_tuple_return<typename decay<_Tp>::type>::type type; + typedef typename __make_tuple_return_impl<typename decay<_Tp>::type>::type type; }; template <class... _Tp> diff --git a/external/bsd/libc++/dist/libcxx/include/type_traits b/external/bsd/libc++/dist/libcxx/include/type_traits index 04e5fd14882..ece19fa5397 100644 --- a/external/bsd/libc++/dist/libcxx/include/type_traits +++ b/external/bsd/libc++/dist/libcxx/include/type_traits @@ -293,15 +293,15 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void // __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 __is_nullptr_t_impl : public false_type {}; +template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t - : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {}; + : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; #if _LIBCPP_STD_VER > 11 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer - : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {}; + : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; #endif // is_integral @@ -644,13 +644,13 @@ template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; // is_signed template <class _Tp, bool = is_integral<_Tp>::value> -struct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; +struct __is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; template <class _Tp> -struct ___is_signed<_Tp, false> : public true_type {}; // floating point +struct __is_signed_impl<_Tp, false> : public true_type {}; // floating point template <class _Tp, bool = is_arithmetic<_Tp>::value> -struct __is_signed : public ___is_signed<_Tp> {}; +struct __is_signed : public __is_signed_impl<_Tp> {}; template <class _Tp> struct __is_signed<_Tp, false> : public false_type {}; @@ -659,13 +659,13 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __is_signed // is_unsigned template <class _Tp, bool = is_integral<_Tp>::value> -struct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; +struct __is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; template <class _Tp> -struct ___is_unsigned<_Tp, false> : public false_type {}; // floating point +struct __is_unsigned_impl<_Tp, false> : public false_type {}; // floating point template <class _Tp, bool = is_arithmetic<_Tp>::value> -struct __is_unsigned : public ___is_unsigned<_Tp> {}; +struct __is_unsigned : public __is_unsigned_impl<_Tp> {}; template <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {}; diff --git a/external/bsd/libc++/dist/libcxx/include/utility b/external/bsd/libc++/dist/libcxx/include/utility index 2c1f62ccbe9..0a1a7f1d923 100644 --- a/external/bsd/libc++/dist/libcxx/include/utility +++ b/external/bsd/libc++/dist/libcxx/include/utility @@ -465,13 +465,13 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper; template <class _Tp> -struct ___make_pair_return +struct __make_pair_return_impl { typedef _Tp type; }; template <class _Tp> -struct ___make_pair_return<reference_wrapper<_Tp>> +struct __make_pair_return_impl<reference_wrapper<_Tp>> { typedef _Tp& type; }; @@ -479,7 +479,7 @@ struct ___make_pair_return<reference_wrapper<_Tp>> template <class _Tp> struct __make_pair_return { - typedef typename ___make_pair_return<typename decay<_Tp>::type>::type type; + typedef typename __make_pair_return_impl<typename decay<_Tp>::type>::type type; }; template <class _T1, class _T2> diff --git a/external/bsd/libc++/dist/libcxx/src/stdexcept.cpp b/external/bsd/libc++/dist/libcxx/src/stdexcept.cpp index acc938c86f4..01b66e4c8e0 100644 --- a/external/bsd/libc++/dist/libcxx/src/stdexcept.cpp +++ b/external/bsd/libc++/dist/libcxx/src/stdexcept.cpp @@ -102,28 +102,28 @@ namespace std // purposefully not using versioning namespace logic_error::logic_error(const string& msg) { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); ::new(s) __libcpp_nmstr(msg.c_str()); } logic_error::logic_error(const char* msg) { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); ::new(s) __libcpp_nmstr(msg); } logic_error::logic_error(const logic_error& le) _NOEXCEPT { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); - const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); + const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_); ::new(s) __libcpp_nmstr(*s2); } logic_error& logic_error::operator=(const logic_error& le) _NOEXCEPT { - __libcpp_nmstr *s1 = static_cast<__libcpp_nmstr *>(__imp_); - const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_); + __libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_); + const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_); *s1 = *s2; return *this; } @@ -132,14 +132,14 @@ logic_error::operator=(const logic_error& le) _NOEXCEPT logic_error::~logic_error() _NOEXCEPT { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); s->~__libcpp_nmstr(); } const char* logic_error::what() const _NOEXCEPT { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_); return s->c_str(); } @@ -147,28 +147,28 @@ logic_error::what() const _NOEXCEPT runtime_error::runtime_error(const string& msg) { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); ::new(s) __libcpp_nmstr(msg.c_str()); } runtime_error::runtime_error(const char* msg) { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); ::new(s) __libcpp_nmstr(msg); } runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); - const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); + const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_); ::new(s) __libcpp_nmstr(*s2); } runtime_error& runtime_error::operator=(const runtime_error& le) _NOEXCEPT { - __libcpp_nmstr *s1 = static_cast<__libcpp_nmstr *>(__imp_); - const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_); + __libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_); + const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_); *s1 = *s2; return *this; } @@ -177,14 +177,14 @@ runtime_error::operator=(const runtime_error& le) _NOEXCEPT runtime_error::~runtime_error() _NOEXCEPT { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + __libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_); s->~__libcpp_nmstr(); } const char* runtime_error::what() const _NOEXCEPT { - __libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_); + const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_); return s->c_str(); } diff --git a/external/bsd/libc++/dist/libcxx/test/numerics/c.math/cmath.pass.cpp b/external/bsd/libc++/dist/libcxx/test/numerics/c.math/cmath.pass.cpp index 13d872cdcc7..5db9fd14bbe 100644 --- a/external/bsd/libc++/dist/libcxx/test/numerics/c.math/cmath.pass.cpp +++ b/external/bsd/libc++/dist/libcxx/test/numerics/c.math/cmath.pass.cpp @@ -339,14 +339,14 @@ void test_pow() static_assert((std::is_same<decltype(std::powf(0,0)), float>::value), ""); static_assert((std::is_same<decltype(std::powl(0,0)), long double>::value), ""); static_assert((std::is_same<decltype(std::pow((int)0, (int)0)), double>::value), ""); - static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), ""); - static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), ""); - static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), ""); +// static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), ""); +// static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), ""); +// static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), ""); assert(std::pow(1,1) == 1); - assert(std::pow(Value<int,1>(), Value<float,1>()) == 1); - assert(std::pow(1.0f, Value<double,1>()) == 1); - assert(std::pow(1.0, Value<int,1>()) == 1); - assert(std::pow(Value<long double,1>(), 1LL) == 1); +// assert(std::pow(Value<int,1>(), Value<float,1>()) == 1); +// assert(std::pow(1.0f, Value<double,1>()) == 1); +// assert(std::pow(1.0, Value<int,1>()) == 1); +// assert(std::pow(Value<long double,1>(), 1LL) == 1); } void test_sin() |
