[Midnightbsd-cvs] src [9679] update libcxxrt and libc++
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Dec 13 15:12:39 EST 2017
Revision: 9679
http://svnweb.midnightbsd.org/src/?rev=9679
Author: laffer1
Date: 2017-12-13 15:12:38 -0500 (Wed, 13 Dec 2017)
Log Message:
-----------
update libcxxrt and libc++
Modified Paths:
--------------
trunk/contrib/libc++/include/__config
trunk/contrib/libc++/include/__functional_03
trunk/contrib/libc++/include/__functional_base
trunk/contrib/libc++/include/__functional_base_03
trunk/contrib/libc++/include/functional
trunk/contrib/libc++/include/locale
trunk/contrib/libc++/include/memory
trunk/contrib/libc++/include/new
trunk/contrib/libc++/include/utility
trunk/contrib/libc++/src/new.cpp
trunk/contrib/libcxxrt/exception.cc
trunk/contrib/libcxxrt/guard.cc
trunk/contrib/libcxxrt/libelftc_dem_gnu3.c
trunk/contrib/libcxxrt/memory.cc
trunk/contrib/libcxxrt/typeinfo.cc
trunk/contrib/libcxxrt/unwind-arm.h
trunk/lib/libcxxrt/Makefile
trunk/lib/libcxxrt/Version.map
Property Changed:
----------------
trunk/lib/libcxxrt/Version.map
Modified: trunk/contrib/libc++/include/__config
===================================================================
--- trunk/contrib/libc++/include/__config 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/__config 2017-12-13 20:12:38 UTC (rev 9679)
@@ -61,21 +61,6 @@
# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
-
-#ifdef __MidnightBSD__
-# include <sys/endian.h>
-# if _BYTE_ORDER == _LITTLE_ENDIAN
-# define _LIBCPP_LITTLE_ENDIAN 1
-# define _LIBCPP_BIG_ENDIAN 0
-# else // _BYTE_ORDER == _LITTLE_ENDIAN
-# 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 // __MidnightBSD__
-
#ifdef __NetBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
@@ -343,10 +328,8 @@
#endif
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
-#if defined(__MidnightBSD__)
+#if defined(__FreeBSD__)
#define _LIBCPP_HAS_QUICK_EXIT
-#elif defined(__FreeBSD__)
-#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#elif defined(__ANDROID__)
#define _LIBCPP_HAS_QUICK_EXIT
Modified: trunk/contrib/libc++/include/__functional_03
===================================================================
--- trunk/contrib/libc++/include/__functional_03 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/__functional_03 2017-12-13 20:12:38 UTC (rev 9679)
@@ -369,7 +369,8 @@
_Rp
__func<_Fp, _Alloc, _Rp()>::operator()()
{
- return __invoke(__f_.first());
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first());
}
#ifndef _LIBCPP_NO_RTTI
@@ -452,7 +453,8 @@
_Rp
__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0)
{
- return __invoke(__f_.first(), __a0);
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first(), __a0);
}
#ifndef _LIBCPP_NO_RTTI
@@ -535,7 +537,8 @@
_Rp
__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
{
- return __invoke(__f_.first(), __a0, __a1);
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first(), __a0, __a1);
}
#ifndef _LIBCPP_NO_RTTI
@@ -618,7 +621,8 @@
_Rp
__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
{
- return __invoke(__f_.first(), __a0, __a1, __a2);
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first(), __a0, __a1, __a2);
}
#ifndef _LIBCPP_NO_RTTI
Modified: trunk/contrib/libc++/include/__functional_base
===================================================================
--- trunk/contrib/libc++/include/__functional_base 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/__functional_base 2017-12-13 20:12:38 UTC (rev 9679)
@@ -419,6 +419,26 @@
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
+template <class _Ret>
+struct __invoke_void_return_wrapper
+{
+ template <class ..._Args>
+ static _Ret __call(_Args&&... __args)
+ {
+ return __invoke(_VSTD::forward<_Args>(__args)...);
+ }
+};
+
+template <>
+struct __invoke_void_return_wrapper<void>
+{
+ template <class ..._Args>
+ static void __call(_Args&&... __args)
+ {
+ __invoke(_VSTD::forward<_Args>(__args)...);
+ }
+};
+
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
: public __weak_result_type<_Tp>
Modified: trunk/contrib/libc++/include/__functional_base_03
===================================================================
--- trunk/contrib/libc++/include/__functional_base_03 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/__functional_base_03 2017-12-13 20:12:38 UTC (rev 9679)
@@ -995,6 +995,63 @@
_VSTD::declval<_A2>())) type;
};
+template <class _Ret>
+struct __invoke_void_return_wrapper
+{
+ template <class _Fn>
+ static _Ret __call(_Fn __f)
+ {
+ return __invoke(__f);
+ }
+
+ template <class _Fn, class _A0>
+ static _Ret __call(_Fn __f, _A0& __a0)
+ {
+ return __invoke(__f, __a0);
+ }
+
+ template <class _Fn, class _A0, class _A1>
+ static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1)
+ {
+ return __invoke(__f, __a0, __a1);
+ }
+
+ template <class _Fn, class _A0, class _A1, class _A2>
+ static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2)
+ {
+ return __invoke(__f, __a0, __a1, __a2);
+ }
+};
+
+
+template <>
+struct __invoke_void_return_wrapper<void>
+{
+ template <class _Fn>
+ static void __call(_Fn __f)
+ {
+ __invoke(__f);
+ }
+
+ template <class _Fn, class _A0>
+ static void __call(_Fn __f, _A0& __a0)
+ {
+ __invoke(__f, __a0);
+ }
+
+ template <class _Fn, class _A0, class _A1>
+ static void __call(_Fn __f, _A0& __a0, _A1& __a1)
+ {
+ __invoke(__f, __a0, __a1);
+ }
+
+ template <class _Fn, class _A0, class _A1, class _A2>
+ static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2)
+ {
+ __invoke(__f, __a0, __a1, __a2);
+ }
+};
+
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
: public __weak_result_type<_Tp>
Modified: trunk/contrib/libc++/include/functional
===================================================================
--- trunk/contrib/libc++/include/functional 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/functional 2017-12-13 20:12:38 UTC (rev 9679)
@@ -1367,7 +1367,8 @@
_Rp
__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
{
- return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
+ typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+ return _Invoker::__call(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
}
#ifndef _LIBCPP_NO_RTTI
@@ -1429,7 +1430,7 @@
template <class _Fp>
struct __callable<_Fp, true>
{
- static const bool value =
+ static const bool value = is_same<void, _Rp>::value ||
is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type,
_Rp>::value;
};
Modified: trunk/contrib/libc++/include/locale
===================================================================
--- trunk/contrib/libc++/include/locale 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/locale 2017-12-13 20:12:38 UTC (rev 9679)
@@ -1555,7 +1555,8 @@
this->__format_int(__fmt+1, __len, true, __iob.flags());
const unsigned __nbuf = (numeric_limits<long>::digits / 3)
+ ((numeric_limits<long>::digits % 3) != 0)
- + 1;
+ + ((__iob.flags() & ios_base::showbase) != 0)
+ + 2;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
@@ -1585,7 +1586,8 @@
this->__format_int(__fmt+1, __len, true, __iob.flags());
const unsigned __nbuf = (numeric_limits<long long>::digits / 3)
+ ((numeric_limits<long long>::digits % 3) != 0)
- + 1;
+ + ((__iob.flags() & ios_base::showbase) != 0)
+ + 2;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
@@ -1615,6 +1617,7 @@
this->__format_int(__fmt+1, __len, false, __iob.flags());
const unsigned __nbuf = (numeric_limits<unsigned long>::digits / 3)
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
+ + ((__iob.flags() & ios_base::showbase) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -1645,6 +1648,7 @@
this->__format_int(__fmt+1, __len, false, __iob.flags());
const unsigned __nbuf = (numeric_limits<unsigned long long>::digits / 3)
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
+ + ((__iob.flags() & ios_base::showbase) != 0)
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
Modified: trunk/contrib/libc++/include/memory
===================================================================
--- trunk/contrib/libc++/include/memory 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/memory 2017-12-13 20:12:38 UTC (rev 9679)
@@ -1950,11 +1950,11 @@
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+ _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : __first_(_VSTD::forward<_T1_param>(__t1)) {}
+ : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : __second_(_VSTD::forward<_T2_param>(__t2)) {}
+ : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
@@ -2043,9 +2043,9 @@
typedef const _T1& _T1_const_reference;
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+ _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : _T1(_VSTD::forward<_T1_param>(__t1)) {}
+ : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
: __second_(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
@@ -2133,11 +2133,11 @@
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
typedef const _T2& _T2_const_reference;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+ _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
: __first_(_VSTD::forward<_T1_param>(__t1)) {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : _T2(_VSTD::forward<_T2_param>(__t2)) {}
+ : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
is_nothrow_move_constructible<_T2>::value)
Modified: trunk/contrib/libc++/include/new
===================================================================
--- trunk/contrib/libc++/include/new 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/new 2017-12-13 20:12:38 UTC (rev 9679)
@@ -50,12 +50,18 @@
void* operator new(std::size_t size); // replaceable
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
void operator delete(void* ptr) noexcept; // replaceable
+void operator delete(void* ptr, std::size_t size) noexcept; // replaceable, C++14
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
+void operator delete(void* ptr, std::size_t size,
+ const std::nothrow_t&) noexcept; // replaceable, C++14
void* operator new[](std::size_t size); // replaceable
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
void operator delete[](void* ptr) noexcept; // replaceable
+void operator delete[](void* ptr, std::size_t size) noexcept; // replaceable, C++14
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
+void operator delete[](void* ptr, std::size_t size,
+ const std::nothrow_t&) noexcept; // replaceable, C++14
void* operator new (std::size_t size, void* ptr) noexcept;
void* operator new[](std::size_t size, void* ptr) noexcept;
@@ -131,7 +137,9 @@
;
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;
+_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
#if !__has_feature(cxx_noexcept)
@@ -140,7 +148,9 @@
;
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
+_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
Modified: trunk/contrib/libc++/include/utility
===================================================================
--- trunk/contrib/libc++/include/utility 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/include/utility 2017-12-13 20:12:38 UTC (rev 9679)
@@ -244,8 +244,20 @@
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
#endif
+#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+struct __non_trivially_copyable_base {
+ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+ __non_trivially_copyable_base() _NOEXCEPT {}
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+ __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {}
+};
+#endif
+
template <class _T1, class _T2>
struct _LIBCPP_TYPE_VIS_ONLY pair
+#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+: private __non_trivially_copyable_base
+#endif
{
typedef _T1 first_type;
typedef _T2 second_type;
@@ -253,9 +265,6 @@
_T1 first;
_T2 second;
- // pair(const pair&) = default;
- // pair(pair&&) = default;
-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -272,18 +281,11 @@
)
: first(__p.first), second(__p.second) {}
-#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
- _LIBCPP_INLINE_VISIBILITY
- pair(const pair& __p) = default;
-#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
- _LIBCPP_INLINE_VISIBILITY
- pair(const pair& __p)
- _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
- is_nothrow_copy_constructible<second_type>::value)
- : first(__p.first),
- second(__p.second)
- {
- }
+#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS)
+ pair(pair const&) = default;
+ pair(pair&&) = default;
+#else
+ // Use the implicitly declared copy constructor in C++03
#endif
_LIBCPP_INLINE_VISIBILITY
@@ -315,20 +317,7 @@
: first(_VSTD::forward<_U1>(__p.first)),
second(_VSTD::forward<_U2>(__p.second)) {}
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
- pair(pair&& __p) = default;
-#else
- _LIBCPP_INLINE_VISIBILITY
- pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible<first_type>::value &&
- is_nothrow_move_constructible<second_type>::value)
- : first(_VSTD::forward<first_type>(__p.first)),
- second(_VSTD::forward<second_type>(__p.second))
- {
- }
-#endif
-
- _LIBCPP_INLINE_VISIBILITY
pair&
operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&
is_nothrow_move_assignable<second_type>::value)
Modified: trunk/contrib/libc++/src/new.cpp
===================================================================
--- trunk/contrib/libc++/src/new.cpp 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libc++/src/new.cpp 2017-12-13 20:12:38 UTC (rev 9679)
@@ -126,6 +126,13 @@
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
void
+operator delete(void* ptr, size_t) _NOEXCEPT
+{
+ ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
+void
operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
{
::operator delete(ptr);
@@ -133,18 +140,39 @@
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
void
+operator delete(void* ptr, size_t, const std::nothrow_t&) _NOEXCEPT
+{
+ ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
+void
operator delete[] (void* ptr) _NOEXCEPT
{
- ::operator delete (ptr);
+ ::operator delete(ptr);
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
void
+operator delete[] (void* ptr, size_t) _NOEXCEPT
+{
+ ::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
+void
operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
{
::operator delete[](ptr);
}
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
+void
+operator delete[] (void* ptr, size_t, const std::nothrow_t&) _NOEXCEPT
+{
+ ::operator delete[](ptr);
+}
+
#endif // !__GLIBCXX__
namespace std
Modified: trunk/contrib/libcxxrt/exception.cc
===================================================================
--- trunk/contrib/libcxxrt/exception.cc 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libcxxrt/exception.cc 2017-12-13 20:12:38 UTC (rev 9679)
@@ -304,13 +304,17 @@
static void exception_cleanup(_Unwind_Reason_Code reason,
struct _Unwind_Exception *ex)
{
- __cxa_free_exception(static_cast<void*>(ex));
+ // Exception layout:
+ // [__cxa_exception [_Unwind_Exception]] [exception object]
+ //
+ // __cxa_free_exception expects a pointer to the exception object
+ __cxa_free_exception(static_cast<void*>(ex + 1));
}
static void dependent_exception_cleanup(_Unwind_Reason_Code reason,
struct _Unwind_Exception *ex)
{
- __cxa_free_dependent_exception(static_cast<void*>(ex));
+ __cxa_free_dependent_exception(static_cast<void*>(ex + 1));
}
/**
@@ -340,7 +344,8 @@
if (info->foreign_exception_state != __cxa_thread_info::none)
{
_Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(info->globals.caughtExceptions);
- e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
+ if (e->exception_cleanup)
+ e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
}
else
{
@@ -567,7 +572,20 @@
}
}
+#ifdef __LP64__
/**
+ * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte
+ * alignment but it was broken by the addition of the referenceCount.
+ * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep
+ * compatibility with consumers of the broken __cxa_exception, explicitly add
+ * padding on allocation (and account for it on free).
+ */
+static const int exception_alignment_padding = 8;
+#else
+static const int exception_alignment_padding = 0;
+#endif
+
+/**
* Allocates an exception structure. Returns a pointer to the space that can
* be used to store an object of thrown_size bytes. This function will use an
* emergency buffer if malloc() fails, and may block if there are no such
@@ -575,16 +593,19 @@
*/
extern "C" void *__cxa_allocate_exception(size_t thrown_size)
{
- size_t size = thrown_size + sizeof(__cxa_exception);
+ size_t size = exception_alignment_padding + sizeof(__cxa_exception) +
+ thrown_size;
char *buffer = alloc_or_die(size);
- return buffer+sizeof(__cxa_exception);
+ return buffer + exception_alignment_padding + sizeof(__cxa_exception);
}
extern "C" void *__cxa_allocate_dependent_exception(void)
{
- size_t size = sizeof(__cxa_dependent_exception);
+ size_t size = exception_alignment_padding +
+ sizeof(__cxa_dependent_exception);
char *buffer = alloc_or_die(size);
- return buffer+sizeof(__cxa_dependent_exception);
+ return buffer + exception_alignment_padding +
+ sizeof(__cxa_dependent_exception);
}
/**
@@ -612,7 +633,8 @@
}
}
- free_exception(reinterpret_cast<char*>(ex));
+ free_exception(reinterpret_cast<char*>(ex) -
+ exception_alignment_padding);
}
static void releaseException(__cxa_exception *exception)
@@ -639,7 +661,8 @@
{
releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex)));
}
- free_exception(reinterpret_cast<char*>(ex));
+ free_exception(reinterpret_cast<char*>(ex) -
+ exception_alignment_padding);
}
/**
@@ -1282,12 +1305,13 @@
if (ti->foreign_exception_state != __cxa_thread_info::none)
{
- globals->caughtExceptions = 0;
if (ti->foreign_exception_state != __cxa_thread_info::rethrown)
{
_Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(ti->globals.caughtExceptions);
- e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
+ if (e->exception_cleanup)
+ e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
}
+ globals->caughtExceptions = 0;
ti->foreign_exception_state = __cxa_thread_info::none;
return;
}
@@ -1474,6 +1498,15 @@
return info->globals.uncaughtExceptions != 0;
}
/**
+ * Returns the number of exceptions currently being thrown that have not
+ * been caught. This can occur inside a nested catch statement.
+ */
+ int uncaught_exceptions() throw()
+ {
+ __cxa_thread_info *info = thread_info();
+ return info->globals.uncaughtExceptions;
+ }
+ /**
* Returns the current unexpected handler.
*/
unexpected_handler get_unexpected() throw()
Modified: trunk/contrib/libcxxrt/guard.cc
===================================================================
--- trunk/contrib/libcxxrt/guard.cc 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libcxxrt/guard.cc 2017-12-13 20:12:38 UTC (rev 9679)
@@ -101,7 +101,7 @@
uint32_t init_half;
uint32_t lock_half;
} guard_t;
-_Static_assert(sizeof(guard_t) == sizeof(uint64_t), "");
+static_assert(sizeof(guard_t) == sizeof(uint64_t), "");
static const uint32_t LOCKED = 1;
static const uint32_t INITIALISED = static_cast<guard_lock_t>(1) << 24;
# endif
Modified: trunk/contrib/libcxxrt/libelftc_dem_gnu3.c
===================================================================
--- trunk/contrib/libcxxrt/libelftc_dem_gnu3.c 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libcxxrt/libelftc_dem_gnu3.c 2017-12-13 20:12:38 UTC (rev 9679)
@@ -846,7 +846,7 @@
free(buf);
++e_idx;
break;
- };
+ }
--idx;
}
@@ -1007,7 +1007,7 @@
return (cpp_demangle_push_str(ddata, "true", 4));
default:
return (0);
- };
+ }
case 'd':
++ddata->cur;
@@ -1057,7 +1057,7 @@
default:
return (0);
- };
+ }
}
static int
@@ -1332,7 +1332,7 @@
/* operator sizeof */
ddata->cur += 2;
return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6));
- };
+ }
switch (*ddata->cur) {
case 'L':
@@ -1339,7 +1339,7 @@
return (cpp_demangle_read_expr_primary(ddata));
case 'T':
return (cpp_demangle_read_tmpl_param(ddata));
- };
+ }
return (0);
}
@@ -1555,11 +1555,13 @@
if (!cpp_demangle_push_str(ddata,
"non-transaction clone for ", 26))
return (0);
+ break;
case 't':
default:
if (!cpp_demangle_push_str(ddata,
"transaction clone for ", 22))
return (0);
+ break;
}
++ddata->cur;
return (cpp_demangle_read_encoding(ddata));
@@ -1712,7 +1714,7 @@
if (*ddata->cur == '\0')
return (0);
break;
- };
+ }
return (cpp_demangle_read_name(ddata));
}
@@ -1784,7 +1786,7 @@
return (cpp_demangle_read_nested_name(ddata));
case 'Z':
return (cpp_demangle_read_local_name(ddata));
- };
+ }
if (!vector_str_init(&v))
return (0);
@@ -1885,7 +1887,7 @@
case 'K':
ddata->mem_cst = true;
break;
- };
+ }
++ddata->cur;
}
@@ -1913,7 +1915,7 @@
default:
if (!cpp_demangle_read_uqname(ddata))
goto clean;
- };
+ }
if ((subst_str = vector_str_substr(output, p_idx,
output->size - 1, &subst_str_len)) == NULL)
@@ -2188,35 +2190,35 @@
case SIMPLE_HASH('S', 'd'):
/* std::basic_iostream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::iostream", 19))
+ if (!cpp_demangle_push_str(ddata, "std::basic_iostream", 19))
return (0);
- ddata->last_sname = "iostream";
+ ddata->last_sname = "basic_iostream";
ddata->cur += 2;
if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata,
- "std::iostream", 19));
+ "std::basic_iostream", 19));
return (1);
case SIMPLE_HASH('S', 'i'):
/* std::basic_istream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::istream", 18))
+ if (!cpp_demangle_push_str(ddata, "std::basic_istream", 18))
return (0);
- ddata->last_sname = "istream";
+ ddata->last_sname = "basic_istream";
ddata->cur += 2;
if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata,
- "std::istream", 18));
+ "std::basic_istream", 18));
return (1);
case SIMPLE_HASH('S', 'o'):
/* std::basic_ostream<char, std::char_traits<char> > */
- if (!cpp_demangle_push_str(ddata, "std::ostream", 18))
+ if (!cpp_demangle_push_str(ddata, "std::basic_ostream", 18))
return (0);
- ddata->last_sname = "istream";
+ ddata->last_sname = "basic_ostream";
ddata->cur += 2;
if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata,
- "std::ostream", 18));
+ "std::basic_ostream", 18));
return (1);
case SIMPLE_HASH('S', 's'):
@@ -2238,7 +2240,7 @@
case SIMPLE_HASH('S', 't'):
/* std:: */
return (cpp_demangle_read_subst_std(ddata));
- };
+ }
if (*(++ddata->cur) == '\0')
return (0);
@@ -2386,7 +2388,7 @@
return (cpp_demangle_read_expr_primary(ddata));
case 'X':
return (cpp_demangle_read_expression(ddata));
- };
+ }
return (cpp_demangle_read_type(ddata, 0));
}
@@ -2842,7 +2844,7 @@
case 'w':
/* wchar_t */
- if (!cpp_demangle_push_str(ddata, "wchar_t", 6))
+ if (!cpp_demangle_push_str(ddata, "wchar_t", 7))
goto clean;
++ddata->cur;
goto rtn;
@@ -2863,11 +2865,11 @@
case 'z':
/* ellipsis */
- if (!cpp_demangle_push_str(ddata, "ellipsis", 8))
+ if (!cpp_demangle_push_str(ddata, "...", 3))
goto clean;
++ddata->cur;
goto rtn;
- };
+ }
if (!cpp_demangle_read_name(ddata))
goto clean;
@@ -3331,7 +3333,7 @@
return (0);
ddata->cur += 2;
return (1);
- };
+ }
/* vendor extened operator */
if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) {
@@ -3377,7 +3379,7 @@
return (0);
ddata->cur +=2;
return (1);
- };
+ }
/* source name */
if (ELFTC_ISDIGIT(*ddata->cur) != 0)
@@ -3740,7 +3742,7 @@
return (15);
default:
return (-1);
- };
+ }
}
static void
Modified: trunk/contrib/libcxxrt/memory.cc
===================================================================
--- trunk/contrib/libcxxrt/memory.cc 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libcxxrt/memory.cc 2017-12-13 20:12:38 UTC (rev 9679)
@@ -71,8 +71,17 @@
}
+#if __cplusplus < 201103L
+#define NOEXCEPT throw()
+#define BADALLOC throw(std::bad_alloc)
+#else
+#define NOEXCEPT noexcept
+#define BADALLOC
+#endif
+
+
__attribute__((weak))
-void* operator new(size_t size)
+void* operator new(size_t size) BADALLOC
{
if (0 == size)
{
@@ -97,7 +106,7 @@
}
__attribute__((weak))
-void* operator new(size_t size, const std::nothrow_t &) throw()
+void* operator new(size_t size, const std::nothrow_t &) NOEXCEPT
{
try {
return :: operator new(size);
@@ -110,10 +119,7 @@
__attribute__((weak))
-void operator delete(void * ptr)
-#if __cplusplus < 201000L
-throw()
-#endif
+void operator delete(void * ptr) NOEXCEPT
{
free(ptr);
}
@@ -120,10 +126,7 @@
__attribute__((weak))
-void * operator new[](size_t size)
-#if __cplusplus < 201000L
-throw(std::bad_alloc)
-#endif
+void * operator new[](size_t size) BADALLOC
{
return ::operator new(size);
}
@@ -130,7 +133,7 @@
__attribute__((weak))
-void * operator new[](size_t size, const std::nothrow_t &) throw()
+void * operator new[](size_t size, const std::nothrow_t &) NOEXCEPT
{
try {
return ::operator new[](size);
@@ -143,10 +146,7 @@
__attribute__((weak))
-void operator delete[](void * ptr)
-#if __cplusplus < 201000L
-throw()
-#endif
+void operator delete[](void * ptr) NOEXCEPT
{
::operator delete(ptr);
}
Modified: trunk/contrib/libcxxrt/typeinfo.cc
===================================================================
--- trunk/contrib/libcxxrt/typeinfo.cc 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libcxxrt/typeinfo.cc 2017-12-13 20:12:38 UTC (rev 9679)
@@ -86,16 +86,8 @@
if (NULL != demangled)
{
size_t len = strlen(demangled);
- if (buf == NULL)
+ if (!buf || (*n < len+1))
{
- if (n)
- {
- *n = len;
- }
- return demangled;
- }
- if (*n < len+1)
- {
buf = static_cast<char*>(realloc(buf, len+1));
}
if (0 != buf)
Modified: trunk/contrib/libcxxrt/unwind-arm.h
===================================================================
--- trunk/contrib/libcxxrt/unwind-arm.h 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/contrib/libcxxrt/unwind-arm.h 2017-12-13 20:12:38 UTC (rev 9679)
@@ -28,7 +28,7 @@
{
_URC_OK = 0, /* operation completed successfully */
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
- _URC_END_OF_STACK = 5,
+ _URC_END_OF_STACK = 5,
_URC_HANDLER_FOUND = 6,
_URC_INSTALL_CONTEXT = 7,
_URC_CONTINUE_UNWIND = 8,
@@ -43,10 +43,12 @@
static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0;
static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1;
static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2;
+static const _Unwind_State _US_ACTION_MASK = 3;
#else // GCC fails at knowing what a constant expression is
# define _US_VIRTUAL_UNWIND_FRAME 0
# define _US_UNWIND_FRAME_STARTING 1
-# define _US_UNWIND_FRAME_RESUME 2
+# define _US_UNWIND_FRAME_RESUME 2
+# define _US_ACTION_MASK 3
#endif
typedef struct _Unwind_Context _Unwind_Context;
Modified: trunk/lib/libcxxrt/Makefile
===================================================================
--- trunk/lib/libcxxrt/Makefile 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/lib/libcxxrt/Makefile 2017-12-13 20:12:38 UTC (rev 9679)
@@ -9,18 +9,21 @@
LIB= cxxrt
-SRCS+= libelftc_dem_gnu3.c \
- terminate.cc \
- dynamic_cast.cc \
- memory.cc \
- auxhelper.cc \
- exception.cc \
- stdexcept.cc \
- typeinfo.cc \
+SRCS+= libelftc_dem_gnu3.c\
+ terminate.cc\
+ dynamic_cast.cc\
+ memory.cc\
+ auxhelper.cc\
+ exception.cc\
+ stdexcept.cc\
+ typeinfo.cc\
guard.cc
WARNS= 0
-CFLAGS+= -I${SRCDIR}
+CFLAGS+= -I${SRCDIR} -nostdinc++
+.if empty(CXXFLAGS:M-std=*)
+CXXFLAGS+= -std=c++11
+.endif
VERSION_MAP= ${.CURDIR}/Version.map
.include <bsd.lib.mk>
Modified: trunk/lib/libcxxrt/Version.map
===================================================================
--- trunk/lib/libcxxrt/Version.map 2017-12-02 15:32:13 UTC (rev 9678)
+++ trunk/lib/libcxxrt/Version.map 2017-12-13 20:12:38 UTC (rev 9679)
@@ -210,19 +210,19 @@
"typeinfo name for void*";
"typeinfo name for unsigned int*";
"typeinfo name for float*";
- # C++11 typeinfo not understood by our linker
+ # C++11 typeinfo name not understood by our linker
# std::nullptr_t
- _ZTSDn;_ZTIPDn;_ZTIPKDn;
+ _ZTSDn;_ZTSPDn;_ZTSPKDn;
# char16_t
- _ZTSDi;_ZTIPDi;_ZTIPKDi;
+ _ZTSDi;_ZTSPDi;_ZTSPKDi;
# char32_t
- _ZTSDs;_ZTIPDs;_ZTIPKDs;
+ _ZTSDs;_ZTSPDs;_ZTSPKDs;
# IEEE 754r decimal floating point
- _ZTSDd;_ZTIPDd;_ZTIPKDd;
- _ZTSDe;_ZTIPDe;_ZTIPKDe;
- _ZTSDf;_ZTIPDf;_ZTIPKDf;
+ _ZTSDd;_ZTSPDd;_ZTSPKDd;
+ _ZTSDe;_ZTSPDe;_ZTSPKDe;
+ _ZTSDf;_ZTSPDf;_ZTSPKDf;
# IEEE 754r half-precision floating point
- _ZTSDh;_ZTIPDh;_ZTIPKDh;
+ _ZTSDh;_ZTSPDh;_ZTSPKDh;
"typeinfo name for __cxxabiv1::__array_type_info";
"typeinfo name for __cxxabiv1::__class_type_info";
@@ -255,10 +255,31 @@
__cxa_get_exception_ptr;
} CXXABI_1.3;
+CXXABI_1.3.5 {
+ extern "C++" {
+ "typeinfo for __int128 const*";
+ "typeinfo for __int128";
+ "typeinfo for __int128*";
+ "typeinfo for unsigned __int128 const*";
+ "typeinfo for unsigned __int128";
+ "typeinfo for unsigned __int128*";
+ };
+} CXXABI_1.3.1;
+
CXXABI_1.3.6 {
__cxa_deleted_virtual;
-} CXXABI_1.3.1;
+} CXXABI_1.3.5;
+CXXABI_1.3.9 {
+ extern "C++" {
+ "typeinfo name for __int128 const*";
+ "typeinfo name for __int128";
+ "typeinfo name for __int128*";
+ "typeinfo name for unsigned __int128 const*";
+ "typeinfo name for unsigned __int128";
+ "typeinfo name for unsigned __int128*";
+ };
+} CXXABI_1.3.6;
CXXRT_1.0 {
@@ -357,3 +378,9 @@
};
} GLIBCXX_3.4;
+GLIBCXX_3.4.22 {
+ extern "C++" {
+ "std::uncaught_exceptions()";
+ };
+} GLIBCXX_3.4.9;
+
Property changes on: trunk/lib/libcxxrt/Version.map
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list