You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
3.1 KiB
120 lines
3.1 KiB
/*
|
|
* C++ Library file new
|
|
* Copyright 1993-2001 ARM Limited. All rights reserved.
|
|
*/
|
|
|
|
/*
|
|
* RCS $Revision: 185828 $
|
|
* Checkin $Date: 2014-06-18 17:10:58 +0100 (Wed, 18 Jun 2014) $
|
|
* Revising $Author: ricbar01 $
|
|
*/
|
|
|
|
/* Edison Design Group, 1992-2013. */
|
|
/*
|
|
new -- Include file for C++ default operator new (see ARM 12.5).
|
|
*/
|
|
|
|
#ifndef __NEW_STDH
|
|
#define __NEW_STDH
|
|
#ifndef __STDDEF_H
|
|
#include <stddef.h>
|
|
#endif /* ifndef __STDDEF_H */
|
|
#ifndef __NEW
|
|
#define __NEW
|
|
#define __ARMCLIB_VERSION 5050106
|
|
|
|
#ifndef __EXCEPTION_INCLUDED
|
|
#include <exception>
|
|
#endif /* __EXCEPTION_INCLUDED */
|
|
|
|
#if defined(__EDG_RUNTIME_USES_NAMESPACES) || __clang__
|
|
namespace std {
|
|
#endif /* if defined(__EDG_RUNTIME_USES_NAMESPACES) || __clang__ */
|
|
|
|
#if __sizeof_ptr == 8
|
|
typedef unsigned long size_t; /* see <stddef.h> */
|
|
#else
|
|
typedef unsigned int size_t; /* see <stddef.h> */
|
|
#endif
|
|
|
|
/* This lets users disable the EDG supplied exception classes. */
|
|
#ifndef __NO_EDG_EXCEPTION_CLASSES
|
|
|
|
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();
|
|
};
|
|
|
|
class bad_array_new_length : public bad_alloc {
|
|
public:
|
|
bad_array_new_length() throw();
|
|
virtual ~bad_array_new_length() throw();
|
|
};
|
|
|
|
#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */
|
|
|
|
typedef void (*new_handler)();
|
|
new_handler set_new_handler(new_handler) throw();
|
|
struct nothrow_t { };
|
|
// Declaration of object nothrow to permit the use of the placement new
|
|
// syntax: new (nothrow) T;
|
|
extern const nothrow_t nothrow;
|
|
|
|
#if defined(__EDG_RUNTIME_USES_NAMESPACES) || __clang__
|
|
} /* namespace std */
|
|
#endif /* __EDG_RUNTIME_USES_NAMESPACES || __clang__ */
|
|
|
|
#ifdef __EDG_IMPLICIT_USING_STD
|
|
/* Implicitly include a using directive for the STD namespace when this
|
|
preprocessing flag is TRUE. */
|
|
using namespace ::std;
|
|
#endif /* ifdef __EDG_IMPLICIT_USING_STD */
|
|
|
|
/* Normal operator new. */
|
|
void *operator new(std::size_t) throw(std::bad_alloc);
|
|
|
|
/* Normal operator delete. */
|
|
void operator delete(void*) throw ();
|
|
|
|
/* Nothrow version of operator new. */
|
|
void *operator new(std::size_t, const std::nothrow_t&) throw();
|
|
|
|
/* Nothrow version of operator delete. */
|
|
void operator delete(void*, const std::nothrow_t&) throw();
|
|
|
|
/* Placement new. */
|
|
inline void *operator new(std::size_t, void* __ptr) throw() { return __ptr; }
|
|
|
|
/* Placement delete. */
|
|
inline void operator delete(void*, void*) throw() { /* nothing */ }
|
|
|
|
|
|
/* Array new. */
|
|
void *operator new[](std::size_t) throw(std::bad_alloc);
|
|
|
|
/* Array delete. */
|
|
void operator delete[](void*) throw ();
|
|
|
|
/* Placement array new. */
|
|
inline void *operator new[](std::size_t, void* __ptr) throw() { return __ptr; }
|
|
|
|
/* Placement array delete. */
|
|
inline void operator delete[](void*, void*) throw() { /* nothing */ }
|
|
|
|
/* Nothrow version of array new. */
|
|
void *operator new[](std::size_t,
|
|
const std::nothrow_t&) throw();
|
|
|
|
/* Nothrow version of array delete. */
|
|
void operator delete[](void*,
|
|
const std::nothrow_t&) throw();
|
|
|
|
#endif /*__NEW */
|
|
/* End of new */
|
|
|
|
#endif /*__NEW_STDH */
|