Niko Catania | 69b1a8a | 2009-04-10 10:54:03 -0700 | [diff] [blame] | 1 | /* -*- c++ -*- */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 2 | #ifndef __NEW__ |
| 3 | #define __NEW__ |
| 4 | |
Niko Catania | 69b1a8a | 2009-04-10 10:54:03 -0700 | [diff] [blame] | 5 | #include <cstddef> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 6 | |
David 'Digit' Turner | 0621a27 | 2010-06-25 16:53:37 -0700 | [diff] [blame] | 7 | extern "C++" { |
| 8 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 9 | namespace std { |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 10 | struct nothrow_t {}; |
| 11 | extern const nothrow_t nothrow; |
| 12 | } |
| 13 | |
| 14 | void* operator new(std::size_t); |
| 15 | void* operator new[](std::size_t); |
Chih-Hung Hsieh | ae558d6 | 2014-08-25 12:08:19 -0700 | [diff] [blame] | 16 | void operator delete(void*) throw(); |
| 17 | void operator delete[](void*) throw(); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 18 | void* operator new(std::size_t, const std::nothrow_t&); |
| 19 | void* operator new[](std::size_t, const std::nothrow_t&); |
Chih-Hung Hsieh | ae558d6 | 2014-08-25 12:08:19 -0700 | [diff] [blame] | 20 | void operator delete(void*, const std::nothrow_t&) throw(); |
| 21 | void operator delete[](void*, const std::nothrow_t&) throw(); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 22 | |
| 23 | inline void* operator new(std::size_t, void* p) { return p; } |
| 24 | inline void* operator new[](std::size_t, void* p) { return p; } |
| 25 | |
| 26 | // these next two are not really required, since exceptions are off |
Chih-Hung Hsieh | ae558d6 | 2014-08-25 12:08:19 -0700 | [diff] [blame] | 27 | inline void operator delete(void*, void*) throw() { } |
| 28 | inline void operator delete[](void*, void*) throw() { } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | |
David 'Digit' Turner | 0621a27 | 2010-06-25 16:53:37 -0700 | [diff] [blame] | 30 | } // extern C++ |
| 31 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 32 | #endif // __NEW__ |