From 92ec9b2fbcb23c53148fc5a5c694ca9d17a36142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 13 Apr 2005 16:50:25 +0000 Subject: [PATCH] Added our old "new" header again, as I can't build anything without it under Linux (PPC and x86). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12371 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/new | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 headers/posix/new diff --git a/headers/posix/new b/headers/posix/new new file mode 100644 index 0000000000..3f6c32a5ae --- /dev/null +++ b/headers/posix/new @@ -0,0 +1,71 @@ +// XXX taken from /boot/develop/tools/gnupro/lib/gcc-lib/i586-beos/2.9-beos-991026/include +// XXX From GCC, exact license unknown. Must be LGPL or better :) +// XXX Doesn't belong into posix, should be replaced as soon as possible + +/* CYGNUS LOCAL Embedded C++ whole file */ +// The -*- C++ -*- dynamic memory management header. +// Copyright (C) 1994, 96-97, 1998 Free Software Foundation + +#ifndef __NEW__ +#define __NEW__ + +#pragma interface "new" +#include + +#ifndef __EMBEDDED_CXX__ +// Exception Handling is forbidden in Embedded C++. +#include +#define __THROW(what) throw (what) +#define __nothing +#else +#define __THROW(what) +#endif + +extern "C++" { + +namespace std { + +#ifndef __EMBEDDED_CXX__ + class bad_alloc : public exception { + public: + virtual const char* what() const throw() { return "bad_alloc"; } + }; +#endif + + struct nothrow_t {}; + extern const nothrow_t nothrow; + + typedef void (*new_handler)(); + new_handler set_new_handler (new_handler); + +} // namespace std + +// replaceable signatures +void *operator new (size_t) __THROW (std::bad_alloc); +void *operator new[] (size_t) __THROW (std::bad_alloc); +void operator delete (void *) __THROW(__nothing); +void operator delete[] (void *) __THROW(__nothing); +void *operator new (size_t, const std::nothrow_t&) __THROW(__nothing); +void *operator new[] (size_t, const std::nothrow_t&) __THROW(__nothing); +void operator delete (void *, const std::nothrow_t&) __THROW(__nothing); +void operator delete[] (void *, const std::nothrow_t&) __THROW(__nothing); + +// default placement versions of operator new +#ifndef _BUILDING_NEW_CPP_ +// make sure the call gets emitted out of line in libroot for +// compatibility with old binaries - this is done by including +// the same two calls, only without the inline directive +// +// keep it inline everywhere else +inline void *operator new(size_t, void *place) __THROW(__nothing) { + return place; +} +inline void *operator new[](size_t, void *place) __THROW(__nothing) { + return place; +} +#endif + +} // extern "C++" + +#endif +/* END CYGNUS LOCAL */