From 3142fb30eaa451c955a1607b8cffe2069cbd15b2 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 23 Jan 2021 03:27:18 -0800 Subject: Remove some unnecessary function attributes The alloc_size was wrong anyway since the function parameter takes the number of objects to be allocated and the attribute declares which is the number of bytes. The assume_aligned is unnecessary since the function is inlined and al_malloc/al_calloc already have appropriate attributes for the compiler to see. --- common/almalloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/almalloc.h b/common/almalloc.h index 75388d9d..58bd5eed 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -82,14 +82,14 @@ struct allocator { using other = allocator; }; - allocator() noexcept = default; + constexpr explicit allocator() noexcept = default; template - constexpr allocator(const allocator&) noexcept { } + constexpr explicit allocator(const allocator&) noexcept { } - [[gnu::assume_aligned(alignment), gnu::alloc_size(2)]] T *allocate(std::size_t n) + T *allocate(std::size_t n) { if(n > std::numeric_limits::max()/sizeof(T)) throw std::bad_alloc(); - if(auto p = static_cast(al_malloc(alignment, n*sizeof(T)))) return p; + if(auto p = al_malloc(alignment, n*sizeof(T))) return static_cast(p); throw std::bad_alloc(); } void deallocate(T *p, std::size_t) noexcept { al_free(p); } -- cgit v1.2.3