libstrat: fix override operator new to be noexcept (closes #1494)

This commit is contained in:
Michael Scire 2021-05-16 23:10:13 -07:00
parent 25be7c5b1b
commit c790d03693
3 changed files with 13 additions and 15 deletions

View file

@ -20,23 +20,23 @@ namespace ams::fs::impl {
class Newable { class Newable {
public: public:
static void *operator new(size_t size) { static ALWAYS_INLINE void *operator new(size_t size) noexcept {
return ::ams::fs::impl::Allocate(size); return ::ams::fs::impl::Allocate(size);
} }
static void *operator new(size_t size, Newable *placement) { static ALWAYS_INLINE void *operator new(size_t size, Newable *placement) noexcept {
return placement; return placement;
} }
static void *operator new[](size_t size) { static ALWAYS_INLINE void *operator new[](size_t size) noexcept {
return ::ams::fs::impl::Allocate(size); return ::ams::fs::impl::Allocate(size);
} }
static void operator delete(void *ptr, size_t size) { static ALWAYS_INLINE void operator delete(void *ptr, size_t size) noexcept {
return ::ams::fs::impl::Deallocate(ptr, size); return ::ams::fs::impl::Deallocate(ptr, size);
} }
static void operator delete[](void *ptr, size_t size) { static ALWAYS_INLINE void operator delete[](void *ptr, size_t size) noexcept {
return ::ams::fs::impl::Deallocate(ptr, size); return ::ams::fs::impl::Deallocate(ptr, size);
} }
}; };

View file

@ -106,11 +106,9 @@ namespace ams::fssystem {
using Newable::operator new; using Newable::operator new;
using Newable::operator delete; using Newable::operator delete;
static void *operator new(size_t, void *p) {
return p;
}
static void operator delete(void *, size_t, void*) { /* ... */ } static ALWAYS_INLINE void *operator new(size_t, void *p) noexcept { return p; }
static ALWAYS_INLINE void operator delete(void *, size_t, void*) noexcept { /* ... */ }
}; };
using AttrListTraits = util::IntrusiveListBaseTraits<AttrInfo>; using AttrListTraits = util::IntrusiveListBaseTraits<AttrInfo>;

View file

@ -22,13 +22,13 @@ namespace ams::erpt::srv {
class Allocator { class Allocator {
public: public:
void *operator new(size_t sz) { return lmem::AllocateFromExpHeap(g_heap_handle, sz); } void *operator new(size_t sz) noexcept { return lmem::AllocateFromExpHeap(g_heap_handle, sz); }
void *operator new(size_t sz, size_t algn) { return lmem::AllocateFromExpHeap(g_heap_handle, sz, static_cast<s32>(algn)); } void *operator new(size_t sz, size_t algn) noexcept { return lmem::AllocateFromExpHeap(g_heap_handle, sz, static_cast<s32>(algn)); }
void *operator new[](size_t sz) { return lmem::AllocateFromExpHeap(g_heap_handle, sz); } void *operator new[](size_t sz) noexcept { return lmem::AllocateFromExpHeap(g_heap_handle, sz); }
void *operator new[](size_t sz, size_t algn) { return lmem::AllocateFromExpHeap(g_heap_handle, sz, static_cast<s32>(algn)); } void *operator new[](size_t sz, size_t algn) noexcept { return lmem::AllocateFromExpHeap(g_heap_handle, sz, static_cast<s32>(algn)); }
void operator delete(void *p) { lmem::FreeToExpHeap(g_heap_handle, p); } void operator delete(void *p) noexcept { lmem::FreeToExpHeap(g_heap_handle, p); }
void operator delete[](void *p) { lmem::FreeToExpHeap(g_heap_handle, p); } void operator delete[](void *p) noexcept { lmem::FreeToExpHeap(g_heap_handle, p); }
}; };
inline void *Allocate(size_t sz) { inline void *Allocate(size_t sz) {