summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/new
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-01-30 07:44:22 +0000
committerdim <dim@FreeBSD.org>2014-01-30 07:44:22 +0000
commit0b319638e352dd16f2e5a243bd3826d37eef1680 (patch)
treeadd3759d4df7ee10d814c3b2561c3c28fcd9cef2 /contrib/libc++/include/new
parent9cecf9778c1472e916ad20086c11e4bf332ba6ad (diff)
parentc3e10da3dc0f616b78ccf85206fdcf4c92f8ac85 (diff)
downloadFreeBSD-src-0b319638e352dd16f2e5a243bd3826d37eef1680.zip
FreeBSD-src-0b319638e352dd16f2e5a243bd3826d37eef1680.tar.gz
Import libc++ 3.4 release. This contains a lot of bugfixes, and some
preliminary support for C++1y. MFC after: 3 weeks
Diffstat (limited to 'contrib/libc++/include/new')
-rw-r--r--contrib/libc++/include/new61
1 files changed, 47 insertions, 14 deletions
diff --git a/contrib/libc++/include/new b/contrib/libc++/include/new
index 1e85798..ea4a4a0 100644
--- a/contrib/libc++/include/new
+++ b/contrib/libc++/include/new
@@ -27,6 +27,18 @@ public:
virtual const char* what() const noexcept;
};
+class bad_array_length : public bad_alloc // C++14
+{
+public:
+ bad_array_length() noexcept;
+};
+
+class bad_array_new_length : public bad_alloc
+{
+public:
+ bad_array_new_length() noexcept;
+};
+
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
@@ -81,7 +93,22 @@ public:
virtual const char* what() const _NOEXCEPT;
};
-void __throw_bad_alloc(); // not in C++ spec
+#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
+
+class _LIBCPP_EXCEPTION_ABI bad_array_length
+ : public bad_alloc
+{
+public:
+ bad_array_length() _NOEXCEPT;
+ virtual ~bad_array_length() _NOEXCEPT;
+ virtual const char* what() const _NOEXCEPT;
+};
+
+#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
+
+#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
+
+_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_TYPE_VIS nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
@@ -91,27 +118,33 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
} // std
-_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz)
+#if defined(_WIN32) && !defined(cxx_EXPORTS)
+# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
+#else
+# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
+#endif
+
+_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
-_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
-_LIBCPP_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
-_LIBCPP_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
+_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, const std::nothrow_t&) _NOEXCEPT;
-_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz)
+_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
-_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
-_LIBCPP_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
-_LIBCPP_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
-
-_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
-_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
-_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
-_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
+_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, 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;}
+inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
+inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
#endif // _LIBCPP_NEW
OpenPOWER on IntegriCloud