blob: 9d1c6fc662cb1bfa656b905f2d4058f376758f2c [file] [log] [blame]
Elliott Hughesaa8db1b2021-02-16 15:05:44 -08001/*
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 Project1dc9e472009-03-03 19:28:35 -080018
Elliott Hughesf44b2322016-05-26 17:35:00 -070019#include <stddef.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020
David 'Digit' Turner0621a272010-06-25 16:53:37 -070021extern "C++" {
22
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080023namespace std {
Elliott Hughesf44b2322016-05-26 17:35:00 -070024 using ::size_t;
25 struct nothrow_t {};
26 extern const nothrow_t nothrow;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080027}
28
29void* operator new(std::size_t);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030void* operator new(std::size_t, const std::nothrow_t&);
Elliott Hughesf44b2322016-05-26 17:35:00 -070031void operator delete(void*) throw();
32// TODO: void operator delete(void*, std::size_t) throw();
33void operator delete(void*, const std::nothrow_t&) throw();
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034
Elliott Hughesf44b2322016-05-26 17:35:00 -070035void* operator new[](std::size_t);
36void* operator new[](std::size_t, const std::nothrow_t&);
37void operator delete[](void*) throw();
38// TODO: void operator delete[](void*, std::size_t) throw();
39void operator delete[](void*, const std::nothrow_t&) throw();
40
41// These four are not replaceable, so should be inlined.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080042inline void* operator new(std::size_t, void* p) { return p; }
43inline void* operator new[](std::size_t, void* p) { return p; }
Elliott Hughesf44b2322016-05-26 17:35:00 -070044inline void operator delete(void*, void*) throw() { }
45inline void operator delete[](void*, void*) throw() { }
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046
David 'Digit' Turner0621a272010-06-25 16:53:37 -070047} // extern C++