Add a libcxx with a new operator
This commit is contained in:
parent
dcc05f2741
commit
010e261dc7
8 changed files with 132 additions and 2 deletions
34
lib/libcxx/include/cstddef
Normal file
34
lib/libcxx/include/cstddef
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* vim: syntax=cpp */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cstdint"
|
||||
|
||||
namespace std {
|
||||
using ptrdiff_t = uint64_t;
|
||||
using size_t = uint64_t;
|
||||
// FIXME: I don't understand what this does.
|
||||
using max_align_t = uint64_t;
|
||||
using nullptr_t = decltype(nullptr);
|
||||
|
||||
enum class byte : unsigned char {};
|
||||
|
||||
// byte type operations
|
||||
template<class IntType>
|
||||
constexpr byte& operator<<=(byte& b, IntType shift) noexcept;
|
||||
template<class IntType>
|
||||
constexpr byte operator<<(byte b, IntType shift) noexcept;
|
||||
template<class IntType>
|
||||
constexpr byte& operator>>=(byte& b, IntType shift) noexcept;
|
||||
template<class IntType>
|
||||
constexpr byte operator>>(byte b, IntType shift) noexcept;
|
||||
constexpr byte& operator|=(byte& l, byte r) noexcept;
|
||||
constexpr byte operator|(byte l, byte r) noexcept;
|
||||
constexpr byte& operator&=(byte& l, byte r) noexcept;
|
||||
constexpr byte operator&(byte l, byte r) noexcept;
|
||||
constexpr byte& operator^=(byte& l, byte r) noexcept;
|
||||
constexpr byte operator^(byte l, byte r) noexcept;
|
||||
constexpr byte operator~(byte b) noexcept;
|
||||
template<class IntType>
|
||||
constexpr IntType to_integer(byte b) noexcept;
|
||||
}
|
||||
5
lib/libcxx/include/cstdint
Normal file
5
lib/libcxx/include/cstdint
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* vim: syntax=cpp */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
69
lib/libcxx/include/new
Normal file
69
lib/libcxx/include/new
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/* vim: syntax=cpp */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cstddef"
|
||||
|
||||
namespace std {
|
||||
// storage allocation errors
|
||||
class bad_alloc;
|
||||
class bad_array_new_length;
|
||||
|
||||
struct destroying_delete_t {
|
||||
explicit destroying_delete_t() = default;
|
||||
};
|
||||
inline constexpr destroying_delete_t destroying_delete{};
|
||||
|
||||
// global operator new control
|
||||
enum class align_val_t : size_t {};
|
||||
|
||||
struct nothrow_t { explicit nothrow_t() = default; };
|
||||
extern const nothrow_t nothrow;
|
||||
|
||||
using new_handler = void (*)();
|
||||
new_handler get_new_handler() noexcept;
|
||||
new_handler set_new_handler(new_handler new_p) noexcept;
|
||||
|
||||
// pointer optimization barrier
|
||||
template<class T> [[nodiscard]] constexpr T* launder(T* p) noexcept;
|
||||
|
||||
// hardware interference size
|
||||
// inline constexpr size_t hardware_destructive_interference_size =
|
||||
// /* implementation-defined */;
|
||||
// inline constexpr size_t hardware_constructive_interference_size =
|
||||
// /* implementation-defined */;
|
||||
}
|
||||
|
||||
// storage allocation and deallocation
|
||||
[[nodiscard]] void* operator new(std::size_t size);
|
||||
[[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment);
|
||||
[[nodiscard]] void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
|
||||
[[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment,
|
||||
const std::nothrow_t&) noexcept;
|
||||
|
||||
void operator delete(void* ptr) noexcept;
|
||||
void operator delete(void* ptr, std::size_t size) noexcept;
|
||||
void operator delete(void* ptr, std::align_val_t alignment) noexcept;
|
||||
void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept;
|
||||
void operator delete(void* ptr, std::align_val_t alignment,
|
||||
const std::nothrow_t&) noexcept;
|
||||
|
||||
[[nodiscard]] void* operator new[](std::size_t size);
|
||||
[[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment);
|
||||
[[nodiscard]] void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
|
||||
[[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment,
|
||||
const std::nothrow_t&) noexcept;
|
||||
|
||||
void operator delete[](void* ptr) noexcept;
|
||||
void operator delete[](void* ptr, std::size_t size) noexcept;
|
||||
void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
|
||||
void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
|
||||
void operator delete[](void* ptr, std::align_val_t alignment,
|
||||
const std::nothrow_t&) noexcept;
|
||||
|
||||
[[nodiscard]] void* operator new (std::size_t size, void* ptr) noexcept;
|
||||
[[nodiscard]] void* operator new[](std::size_t size, void* ptr) noexcept;
|
||||
void operator delete (void* ptr, void*) noexcept;
|
||||
void operator delete[](void* ptr, void*) noexcept;
|
||||
Loading…
Add table
Add a link
Reference in a new issue