svn commit: r312642 - in projects/clang400-import/contrib/libc++: include src
Dimitry Andric
dim at FreeBSD.org
Sun Jan 22 18:06:23 UTC 2017
Author: dim
Date: Sun Jan 22 18:06:21 2017
New Revision: 312642
URL: https://svnweb.freebsd.org/changeset/base/312642
Log:
Merge libc++ release_40 branch r292732.
Modified:
projects/clang400-import/contrib/libc++/include/__config
projects/clang400-import/contrib/libc++/include/array
projects/clang400-import/contrib/libc++/include/new
projects/clang400-import/contrib/libc++/include/string
projects/clang400-import/contrib/libc++/include/typeinfo
projects/clang400-import/contrib/libc++/src/new.cpp
Directory Properties:
projects/clang400-import/contrib/libc++/ (props changed)
Modified: projects/clang400-import/contrib/libc++/include/__config
==============================================================================
--- projects/clang400-import/contrib/libc++/include/__config Sun Jan 22 18:04:57 2017 (r312641)
+++ projects/clang400-import/contrib/libc++/include/__config Sun Jan 22 18:06:21 2017 (r312642)
@@ -835,6 +835,18 @@ template <unsigned> struct __static_asse
#define _DECLARE_C99_LDBL_MATH 1
#endif
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# endif
+# endif
+#endif // defined(__APPLE__)
+
#if defined(__APPLE__) || defined(__FreeBSD__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
Modified: projects/clang400-import/contrib/libc++/include/array
==============================================================================
--- projects/clang400-import/contrib/libc++/include/array Sun Jan 22 18:04:57 2017 (r312641)
+++ projects/clang400-import/contrib/libc++/include/array Sun Jan 22 18:06:21 2017 (r312642)
@@ -185,14 +185,17 @@ struct _LIBCPP_TEMPLATE_VIS array
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
- _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
- reference at(size_type __n);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+ reference operator[](size_type __n) {return __elems_[__n];}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+ const_reference operator[](size_type __n) const {return __elems_[__n];}
+
+ _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n);
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
- _LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
- _LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -202,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array
};
template <class _Tp, size_t _Size>
+_LIBCPP_CONSTEXPR_AFTER_CXX14
typename array<_Tp, _Size>::reference
array<_Tp, _Size>::at(size_type __n)
{
Modified: projects/clang400-import/contrib/libc++/include/new
==============================================================================
--- projects/clang400-import/contrib/libc++/include/new Sun Jan 22 18:04:57 2017 (r312641)
+++ projects/clang400-import/contrib/libc++/include/new Sun Jan 22 18:06:21 2017 (r312642)
@@ -101,8 +101,9 @@ void operator delete[](void* ptr, void*
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#endif
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
- (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+ (!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+ (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#endif
@@ -144,7 +145,7 @@ public:
#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
-#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
#ifndef _LIBCPP_CXX03_LANG
enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
#else
Modified: projects/clang400-import/contrib/libc++/include/string
==============================================================================
--- projects/clang400-import/contrib/libc++/include/string Sun Jan 22 18:04:57 2017 (r312641)
+++ projects/clang400-import/contrib/libc++/include/string Sun Jan 22 18:06:21 2017 (r312642)
@@ -818,6 +818,7 @@ public:
operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
basic_string& operator=(const basic_string& __str);
+ template <class = void>
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(__self_view __sv) {return assign(__sv);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Modified: projects/clang400-import/contrib/libc++/include/typeinfo
==============================================================================
--- projects/clang400-import/contrib/libc++/include/typeinfo Sun Jan 22 18:04:57 2017 (r312641)
+++ projects/clang400-import/contrib/libc++/include/typeinfo Sun Jan 22 18:06:21 2017 (r312642)
@@ -95,12 +95,13 @@ protected:
uintptr_t __type_name;
_LIBCPP_INLINE_VISIBILITY
- type_info(const char* __n) : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
+ explicit type_info(const char* __n)
+ : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
#else
const char *__type_name;
_LIBCPP_INLINE_VISIBILITY
- type_info(const char* __n) : __type_name(__n) {}
+ explicit type_info(const char* __n) : __type_name(__n) {}
#endif
public:
Modified: projects/clang400-import/contrib/libc++/src/new.cpp
==============================================================================
--- projects/clang400-import/contrib/libc++/src/new.cpp Sun Jan 22 18:04:57 2017 (r312641)
+++ projects/clang400-import/contrib/libc++/src/new.cpp Sun Jan 22 18:06:21 2017 (r312642)
@@ -64,38 +64,6 @@ operator new(std::size_t size) _THROW_BA
}
_LIBCPP_WEAK
-void *
-operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
-{
- if (size == 0)
- size = 1;
- if (static_cast<size_t>(alignment) < sizeof(void*))
- alignment = std::align_val_t(sizeof(void*));
- void* p;
-#if defined(_LIBCPP_MSVCRT)
- while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
-#else
- while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
-#endif
- {
- // If posix_memalign 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
- p = nullptr; // posix_memalign doesn't initialize 'p' on failure
- break;
-#endif
- }
- }
- return p;
-}
-
-_LIBCPP_WEAK
void*
operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
{
@@ -116,14 +84,21 @@ operator new(size_t size, const std::not
_LIBCPP_WEAK
void*
-operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
+operator new[](size_t size) _THROW_BAD_ALLOC
+{
+ return ::operator new(size);
+}
+
+_LIBCPP_WEAK
+void*
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- p = ::operator new(size, alignment);
+ p = ::operator new[](size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -134,29 +109,92 @@ operator new(size_t size, std::align_val
}
_LIBCPP_WEAK
-void*
-operator new[](size_t size) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr) _NOEXCEPT
{
- return ::operator new(size);
+ if (ptr)
+ ::free(ptr);
}
_LIBCPP_WEAK
-void*
-operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
{
- return ::operator new(size, alignment);
+ ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete(void* ptr, size_t) _NOEXCEPT
+{
+ ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr) _NOEXCEPT
+{
+ ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+ ::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, size_t) _NOEXCEPT
+{
+ ::operator delete[](ptr);
+}
+
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
+_LIBCPP_WEAK
+void *
+operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+ if (size == 0)
+ size = 1;
+ if (static_cast<size_t>(alignment) < sizeof(void*))
+ alignment = std::align_val_t(sizeof(void*));
+ void* p;
+#if defined(_LIBCPP_MSVCRT)
+ while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
+#else
+ while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
+#endif
+ {
+ // If posix_memalign 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
+ p = nullptr; // posix_memalign doesn't initialize 'p' on failure
+ break;
+#endif
+ }
+ }
+ return p;
}
_LIBCPP_WEAK
void*
-operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
+operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- p = ::operator new[](size);
+ p = ::operator new(size, alignment);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -168,6 +206,13 @@ operator new[](size_t size, const std::n
_LIBCPP_WEAK
void*
+operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+ return ::operator new(size, alignment);
+}
+
+_LIBCPP_WEAK
+void*
operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
{
void* p = 0;
@@ -187,14 +232,6 @@ operator new[](size_t size, std::align_v
_LIBCPP_WEAK
void
-operator delete(void* ptr) _NOEXCEPT
-{
- if (ptr)
- ::free(ptr);
-}
-
-_LIBCPP_WEAK
-void
operator delete(void* ptr, std::align_val_t) _NOEXCEPT
{
if (ptr)
@@ -207,13 +244,6 @@ operator delete(void* ptr, std::align_va
_LIBCPP_WEAK
void
-operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
-{
- ::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
{
::operator delete(ptr, alignment);
@@ -221,13 +251,6 @@ operator delete(void* ptr, std::align_va
_LIBCPP_WEAK
void
-operator delete(void* ptr, size_t) _NOEXCEPT
-{
- ::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
operator delete(void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
{
::operator delete(ptr, alignment);
@@ -235,13 +258,6 @@ operator delete(void* ptr, size_t, std::
_LIBCPP_WEAK
void
-operator delete[] (void* ptr) _NOEXCEPT
-{
- ::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
operator delete[] (void* ptr, std::align_val_t alignment) _NOEXCEPT
{
::operator delete(ptr, alignment);
@@ -249,13 +265,6 @@ operator delete[] (void* ptr, std::align
_LIBCPP_WEAK
void
-operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
-{
- ::operator delete[](ptr);
-}
-
-_LIBCPP_WEAK
-void
operator delete[] (void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
{
::operator delete[](ptr, alignment);
@@ -263,18 +272,13 @@ operator delete[] (void* ptr, std::align
_LIBCPP_WEAK
void
-operator delete[] (void* ptr, size_t) _NOEXCEPT
-{
- ::operator delete[](ptr);
-}
-
-_LIBCPP_WEAK
-void
operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
{
::operator delete[](ptr, alignment);
}
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
#endif // !__GLIBCXX__
namespace std
More information about the svn-src-projects
mailing list