always inline custom operator new/delete to avoid spurious warnings
GCC 11 warns incorrectly about mismatched new/delete because it auto inlines one but not the other, force inline those function to fix that.
This commit is contained in:
parent
15aa4fe137
commit
cbba348a83
|
@ -150,29 +150,35 @@ template<MemoryDomain d>
|
||||||
struct UseMemoryDomain
|
struct UseMemoryDomain
|
||||||
{
|
{
|
||||||
static constexpr MemoryDomain Domain = d;
|
static constexpr MemoryDomain Domain = d;
|
||||||
|
|
||||||
|
[[gnu::always_inline]]
|
||||||
static void* operator new(size_t size)
|
static void* operator new(size_t size)
|
||||||
{
|
{
|
||||||
on_alloc(Domain, size);
|
on_alloc(Domain, size);
|
||||||
return ::operator new(size);
|
return ::operator new(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::always_inline]]
|
||||||
static void* operator new[](size_t size)
|
static void* operator new[](size_t size)
|
||||||
{
|
{
|
||||||
on_alloc(Domain, size);
|
on_alloc(Domain, size);
|
||||||
return ::operator new[](size);
|
return ::operator new[](size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::always_inline]]
|
||||||
static void* operator new(size_t size, void* ptr)
|
static void* operator new(size_t size, void* ptr)
|
||||||
{
|
{
|
||||||
return ::operator new(size, ptr);
|
return ::operator new(size, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::always_inline]]
|
||||||
static void operator delete(void* ptr, size_t size)
|
static void operator delete(void* ptr, size_t size)
|
||||||
{
|
{
|
||||||
on_dealloc(Domain, size);
|
on_dealloc(Domain, size);
|
||||||
::operator delete(ptr);
|
::operator delete(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::always_inline]]
|
||||||
static void operator delete[](void* ptr, size_t size)
|
static void operator delete[](void* ptr, size_t size)
|
||||||
{
|
{
|
||||||
on_dealloc(Domain, size);
|
on_dealloc(Domain, size);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user