2010-05-11 21:42:16 +02:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===----------------------------- new ------------------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_NEW
|
|
|
|
#define _LIBCPP_NEW
|
|
|
|
|
|
|
|
/*
|
|
|
|
new synopsis
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
|
|
|
|
class bad_alloc
|
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bad_alloc() throw();
|
|
|
|
bad_alloc(const bad_alloc&) throw();
|
|
|
|
bad_alloc& operator=(const bad_alloc&) throw();
|
|
|
|
virtual ~bad_alloc() throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nothrow_t {};
|
|
|
|
extern const nothrow_t nothrow;
|
|
|
|
typedef void (*new_handler)();
|
|
|
|
new_handler set_new_handler(new_handler new_p) throw();
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable
|
|
|
|
void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable
|
|
|
|
void operator delete(void* ptr) throw(); // replaceable
|
|
|
|
void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable
|
|
|
|
|
|
|
|
void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable
|
|
|
|
void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable
|
|
|
|
void operator delete[](void* ptr) throw(); // replaceable
|
|
|
|
void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable
|
|
|
|
|
|
|
|
void* operator new (std::size_t size, void* ptr) throw();
|
|
|
|
void* operator new[](std::size_t size, void* ptr) throw();
|
|
|
|
void operator delete (void* ptr, void*) throw();
|
|
|
|
void operator delete[](void* ptr, void*) throw();
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <exception>
|
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
|
|
|
namespace std // purposefully not using versioning namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_alloc
|
|
|
|
: public exception
|
|
|
|
{
|
|
|
|
public:
|
2010-08-22 15:53:14 +02:00
|
|
|
bad_alloc() throw();
|
2010-05-11 21:42:16 +02:00
|
|
|
virtual ~bad_alloc() throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_array_new_length
|
|
|
|
: public bad_alloc
|
|
|
|
{
|
|
|
|
public:
|
2010-05-14 22:19:37 +02:00
|
|
|
bad_array_new_length() throw();
|
2010-05-11 21:42:16 +02:00
|
|
|
virtual ~bad_array_new_length() throw();
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
|
2010-05-14 22:19:37 +02:00
|
|
|
void __throw_bad_alloc(); // not in C++ spec
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
struct nothrow_t {};
|
|
|
|
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
|
|
|
|
typedef void (*new_handler)();
|
|
|
|
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
|
|
|
|
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
|
|
|
|
_LIBCPP_VISIBLE void operator delete(void*) throw();
|
|
|
|
_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw();
|
|
|
|
|
|
|
|
_LIBCPP_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc);
|
|
|
|
_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw();
|
|
|
|
_LIBCPP_VISIBLE void operator delete[](void*) throw();
|
|
|
|
_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw();
|
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) throw() {return __p;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {}
|
|
|
|
|
|
|
|
#endif // _LIBCPP_NEW
|