Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libc++/dist/libcxx Import libc+++ r198773. Fixe...



details:   https://anonhg.NetBSD.org/src/rev/148f5e597137
branches:  trunk
changeset: 792580:148f5e597137
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Jan 08 17:15:24 2014 +0000

description:
Import libc+++ r198773. Fixes a bug in stdexcept I introduced when
removing C style casts.

diffstat:

 external/bsd/libc++/dist/libcxx/include/__config                    |   2 +-
 external/bsd/libc++/dist/libcxx/include/__functional_base           |   6 +-
 external/bsd/libc++/dist/libcxx/include/__functional_base_03        |   6 +-
 external/bsd/libc++/dist/libcxx/include/cmath                       |  70 ++-------
 external/bsd/libc++/dist/libcxx/include/iterator                    |   6 +-
 external/bsd/libc++/dist/libcxx/include/tuple                       |   6 +-
 external/bsd/libc++/dist/libcxx/include/type_traits                 |  20 +-
 external/bsd/libc++/dist/libcxx/include/utility                     |   6 +-
 external/bsd/libc++/dist/libcxx/src/stdexcept.cpp                   |  32 ++--
 external/bsd/libc++/dist/libcxx/test/numerics/c.math/cmath.pass.cpp |  14 +-
 10 files changed, 64 insertions(+), 104 deletions(-)

diffs (truncated from 413 to 300 lines):

diff -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/__config
--- a/external/bsd/libc++/dist/libcxx/include/__config  Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/__config  Wed Jan 08 17:15:24 2014 +0000
@@ -478,7 +478,7 @@
   }
 }
 
-#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__
+#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
 
 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
 typedef unsigned short char16_t;
diff -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/__functional_base
--- a/external/bsd/libc++/dist/libcxx/include/__functional_base Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/__functional_base Wed Jan 08 17:15:24 2014 +0000
@@ -451,10 +451,10 @@
           }
 };
 
-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 -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/__functional_base_03
--- a/external/bsd/libc++/dist/libcxx/include/__functional_base_03      Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/__functional_base_03      Wed Jan 08 17:15:24 2014 +0000
@@ -1047,10 +1047,10 @@
           }
 };
 
-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 -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/cmath
--- a/external/bsd/libc++/dist/libcxx/include/cmath     Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/cmath     Wed Jan 08 17:15:24 2014 +0000
@@ -419,25 +419,12 @@
 
 #undef isnan
 
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-isnan(float __x) _NOEXCEPT
-{
-    return __libcpp_isnan(__x);
-}
-
+template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
-bool
-isnan(double __x) _NOEXCEPT
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isnan(_A1 __x) _NOEXCEPT
 {
-    return __libcpp_isnan(__x);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-isnan(long double __x) _NOEXCEPT
-{
-    return __libcpp_isnan(__x);
+    return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
 }
 
 #endif  // isnan
@@ -665,26 +652,6 @@
 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 @@
 
 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 -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/iterator
--- a/external/bsd/libc++/dist/libcxx/include/iterator  Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/iterator  Wed Jan 08 17:15:24 2014 +0000
@@ -364,10 +364,10 @@
     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>
 struct __iterator_traits<_Iter, true>
-    :  ____iterator_traits
+    :  __iterator_traits_impl
       <
         _Iter,
         is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
diff -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/tuple
--- a/external/bsd/libc++/dist/libcxx/include/tuple     Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/tuple     Wed Jan 08 17:15:24 2014 +0000
@@ -816,13 +816,13 @@
 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 @@
 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 -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/type_traits
--- a/external/bsd/libc++/dist/libcxx/include/type_traits       Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/type_traits       Wed Jan 08 17:15:24 2014 +0000
@@ -293,15 +293,15 @@
 
 // __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 @@
 // 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 @@
 // 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 -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/include/utility
--- a/external/bsd/libc++/dist/libcxx/include/utility   Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/include/utility   Wed Jan 08 17:15:24 2014 +0000
@@ -465,13 +465,13 @@
 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 @@
 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 -r 7f2248bf3d3d -r 148f5e597137 external/bsd/libc++/dist/libcxx/src/stdexcept.cpp
--- a/external/bsd/libc++/dist/libcxx/src/stdexcept.cpp Wed Jan 08 16:49:48 2014 +0000
+++ b/external/bsd/libc++/dist/libcxx/src/stdexcept.cpp Wed Jan 08 17:15:24 2014 +0000
@@ -102,28 +102,28 @@
 
 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);
 }
 



Home | Main Index | Thread Index | Old Index