Elliott Hughes | aa8db1b | 2021-02-16 15:05:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 18 | |
Elliott Hughes | f44b232 | 2016-05-26 17:35:00 -0700 | [diff] [blame] | 19 | #include <stddef.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 20 | |
David 'Digit' Turner | 0621a27 | 2010-06-25 16:53:37 -0700 | [diff] [blame] | 21 | extern "C++" { |
| 22 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 23 | namespace std { |
Elliott Hughes | f44b232 | 2016-05-26 17:35:00 -0700 | [diff] [blame] | 24 | using ::size_t; |
| 25 | struct nothrow_t {}; |
| 26 | extern const nothrow_t nothrow; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | void* operator new(std::size_t); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 30 | void* operator new(std::size_t, const std::nothrow_t&); |
Elliott Hughes | f44b232 | 2016-05-26 17:35:00 -0700 | [diff] [blame] | 31 | void operator delete(void*) throw(); |
| 32 | // TODO: void operator delete(void*, std::size_t) throw(); |
| 33 | void operator delete(void*, const std::nothrow_t&) throw(); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | |
Elliott Hughes | f44b232 | 2016-05-26 17:35:00 -0700 | [diff] [blame] | 35 | void* operator new[](std::size_t); |
| 36 | void* operator new[](std::size_t, const std::nothrow_t&); |
| 37 | void operator delete[](void*) throw(); |
| 38 | // TODO: void operator delete[](void*, std::size_t) throw(); |
| 39 | void operator delete[](void*, const std::nothrow_t&) throw(); |
| 40 | |
| 41 | // These four are not replaceable, so should be inlined. |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 42 | inline void* operator new(std::size_t, void* p) { return p; } |
| 43 | inline void* operator new[](std::size_t, void* p) { return p; } |
Elliott Hughes | f44b232 | 2016-05-26 17:35:00 -0700 | [diff] [blame] | 44 | inline void operator delete(void*, void*) throw() { } |
| 45 | inline void operator delete[](void*, void*) throw() { } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 46 | |
David 'Digit' Turner | 0621a27 | 2010-06-25 16:53:37 -0700 | [diff] [blame] | 47 | } // extern C++ |