00001 // The -*- C++ -*- dynamic memory management header. 00002 00003 // Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001, 2002 00004 // Free Software Foundation 00005 00006 // This file is part of GCC. 00007 // 00008 // GCC is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2, or (at your option) 00011 // any later version. 00012 // 00013 // GCC is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with GCC; see the file COPYING. If not, write to 00020 // the Free Software Foundation, 51 Franklin Street, Fifth Floor, 00021 // Boston, MA 02110-1301, USA. 00022 00023 // As a special exception, you may use this file as part of a free software 00024 // library without restriction. Specifically, if other files instantiate 00025 // templates or use macros or inline functions from this file, or you compile 00026 // this file and link it with other files to produce an executable, this 00027 // file does not by itself cause the resulting executable to be covered by 00028 // the GNU General Public License. This exception does not however 00029 // invalidate any other reasons why the executable file might be covered by 00030 // the GNU General Public License. 00031 00038 #ifndef _NEW 00039 #define _NEW 00040 00041 #include <cstddef> 00042 #include <exception> 00043 00044 #pragma GCC visibility push(default) 00045 00046 extern "C++" { 00047 00048 namespace std 00049 { 00055 class bad_alloc : public exception 00056 { 00057 public: 00058 bad_alloc() throw() { } 00059 // This declaration is not useless: 00060 // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 00061 virtual ~bad_alloc() throw(); 00062 }; 00063 00064 struct nothrow_t { }; 00065 extern const nothrow_t nothrow; 00068 typedef void (*new_handler)(); 00070 new_handler set_new_handler(new_handler) throw(); 00071 } // namespace std 00072 00074 00084 void* operator new(std::size_t) throw (std::bad_alloc); 00085 void* operator new[](std::size_t) throw (std::bad_alloc); 00086 void operator delete(void*) throw(); 00087 void operator delete[](void*) throw(); 00088 void* operator new(std::size_t, const std::nothrow_t&) throw(); 00089 void* operator new[](std::size_t, const std::nothrow_t&) throw(); 00090 void operator delete(void*, const std::nothrow_t&) throw(); 00091 void operator delete[](void*, const std::nothrow_t&) throw(); 00092 00093 // Default placement versions of operator new. 00094 inline void* operator new(std::size_t, void* __p) throw() { return __p; } 00095 inline void* operator new[](std::size_t, void* __p) throw() { return __p; } 00096 00097 // Default placement versions of operator delete. 00098 inline void operator delete (void*, void*) throw() { } 00099 inline void operator delete[](void*, void*) throw() { } 00101 } // extern "C++" 00102 00103 #pragma GCC visibility pop 00104 00105 #endif