mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 09:48:29 +00:00
Make new.cc definitions weak (#1233)
The STL says that these should be replaceable by user code. new.cc now defines only a few direct functions (including a free wrapper that perplexingly is needed since g++ didn’t want to alias "free".) Now, all of the operators are weak references to those functions.
This commit is contained in:
parent
7e780e57d4
commit
f86e6f8eb0
2 changed files with 64 additions and 78 deletions
11
ctl/new.h
11
ctl/new.h
|
@ -3,12 +3,11 @@
|
|||
#ifndef COSMOPOLITAN_CTL_NEW_H_
|
||||
#define COSMOPOLITAN_CTL_NEW_H_
|
||||
|
||||
// XXX clang-format currently mutilates these for some reason.
|
||||
// clang-format off
|
||||
|
||||
namespace ctl {
|
||||
|
||||
enum class align_val_t : size_t {};
|
||||
enum class align_val_t : size_t
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace ctl
|
||||
|
||||
|
@ -16,6 +15,10 @@ void* operator new(size_t);
|
|||
void* operator new[](size_t);
|
||||
void* operator new(size_t, ctl::align_val_t);
|
||||
void* operator new[](size_t, ctl::align_val_t);
|
||||
|
||||
// XXX clang-format currently mutilates these for some reason.
|
||||
// clang-format off
|
||||
|
||||
void* operator new(size_t, void*);
|
||||
void* operator new[](size_t, void*);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue