Adding bad_array_length to libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@190478 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49d596d412
commit
7f9f52e6c6
23
include/new
23
include/new
@ -27,6 +27,18 @@ public:
|
|||||||
virtual const char* what() const noexcept;
|
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 {};
|
struct nothrow_t {};
|
||||||
extern const nothrow_t nothrow;
|
extern const nothrow_t nothrow;
|
||||||
typedef void (*new_handler)();
|
typedef void (*new_handler)();
|
||||||
@ -81,6 +93,17 @@ public:
|
|||||||
virtual const char* what() const _NOEXCEPT;
|
virtual const char* what() const _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
|
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
|
||||||
|
|
||||||
struct _LIBCPP_TYPE_VIS nothrow_t {};
|
struct _LIBCPP_TYPE_VIS nothrow_t {};
|
||||||
|
18
src/new.cpp
18
src/new.cpp
@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#define _LIBCPP_BUILDING_NEW
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "new"
|
#include "new"
|
||||||
@ -186,13 +188,27 @@ bad_array_new_length::~bad_array_new_length() _NOEXCEPT
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
bad_array_length::what() const _NOEXCEPT
|
||||||
|
{
|
||||||
|
return "bad_array_length";
|
||||||
|
}
|
||||||
|
|
||||||
|
bad_array_length::bad_array_length() _NOEXCEPT
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bad_array_length::~bad_array_length() _NOEXCEPT
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
bad_array_new_length::what() const _NOEXCEPT
|
bad_array_new_length::what() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return "bad_array_new_length";
|
return "bad_array_new_length";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // _LIBCPPABI_VERSION
|
||||||
|
|
||||||
void
|
void
|
||||||
__throw_bad_alloc()
|
__throw_bad_alloc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user