diff --git a/src/ds/aba.h b/src/ds/aba.h index 21950ff..fc8e3f8 100644 --- a/src/ds/aba.h +++ b/src/ds/aba.h @@ -121,6 +121,7 @@ namespace snmalloc } Cmp(const Cmp&) = delete; + Cmp(Cmp&&) noexcept = default; }; // This method is used in Verona diff --git a/src/ds/helpers.h b/src/ds/helpers.h index b479011..a042981 100644 --- a/src/ds/helpers.h +++ b/src/ds/helpers.h @@ -14,7 +14,7 @@ namespace snmalloc class Singleton { inline static std::atomic_flag flag; - inline static std::atomic initialised = false; + inline static std::atomic initialised{false}; inline static Object obj; public: diff --git a/src/ds/mpscq.h b/src/ds/mpscq.h index d5d5161..2b98dca 100644 --- a/src/ds/mpscq.h +++ b/src/ds/mpscq.h @@ -14,7 +14,7 @@ namespace snmalloc std::is_same>::value, "T->next must be a std::atomic"); - std::atomic back = nullptr; + std::atomic back{nullptr}; T* front = nullptr; public: @@ -72,10 +72,10 @@ namespace snmalloc SNMALLOC_ASSERT(front); std::atomic_thread_fence(std::memory_order_acquire); invariant(); - return std::pair(first, true); + return {first, true}; } - return std::pair(nullptr, false); + return {nullptr, false}; } }; } // namespace snmalloc diff --git a/src/mem/alloc.h b/src/mem/alloc.h index c58015b..82005df 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -284,6 +284,7 @@ namespace snmalloc UNUSED(size); return free(p); #else + SNMALLOC_ASSERT(p != nullptr); check_size(p, size); if (likely((size - 1) <= (sizeclass_to_size(NUM_SMALL_CLASSES - 1) - 1))) { diff --git a/src/mem/pagemap.h b/src/mem/pagemap.h index fc3da85..bc75fd3 100644 --- a/src/mem/pagemap.h +++ b/src/mem/pagemap.h @@ -188,7 +188,7 @@ namespace snmalloc { PagemapEntry* value = get_node(e, result); if (unlikely(!result)) - return std::pair(nullptr, 0); + return {nullptr, 0}; shift -= BITS_PER_INDEX_LEVEL; ix = (static_cast(addr) >> shift) & ENTRIES_MASK; @@ -208,11 +208,11 @@ namespace snmalloc Leaf* leaf = reinterpret_cast(get_node(e, result)); if (unlikely(!result)) - return std::pair(nullptr, 0); + return {nullptr, 0}; shift -= BITS_FOR_LEAF; ix = (static_cast(addr) >> shift) & LEAF_MASK; - return std::pair(leaf, ix); + return {leaf, ix}; } template diff --git a/src/mem/pooled.h b/src/mem/pooled.h index 71f8d91..4778a8f 100644 --- a/src/mem/pooled.h +++ b/src/mem/pooled.h @@ -14,7 +14,7 @@ namespace snmalloc friend class MPMCStack; /// Used by the pool for chaining together entries when not in use. - std::atomic next = nullptr; + std::atomic next{nullptr}; /// Used by the pool to keep the list of all entries ever created. T* list_next; std::atomic_flag in_use = ATOMIC_FLAG_INIT; diff --git a/src/mem/remoteallocator.h b/src/mem/remoteallocator.h index 4c1f906..d833a25 100644 --- a/src/mem/remoteallocator.h +++ b/src/mem/remoteallocator.h @@ -19,7 +19,7 @@ namespace snmalloc union { Remote* non_atomic_next; - std::atomic next = nullptr; + std::atomic next{nullptr}; }; alloc_id_t allocator_id; diff --git a/src/mem/slowalloc.h b/src/mem/slowalloc.h index f2fcba1..0ab1169 100644 --- a/src/mem/slowalloc.h +++ b/src/mem/slowalloc.h @@ -63,6 +63,6 @@ namespace snmalloc */ inline SlowAllocator get_slow_allocator() { - return SlowAllocator{}; + return {}; } } // namespace snmalloc diff --git a/src/pal/pal_consts.h b/src/pal/pal_consts.h index 538f90d..20359cd 100644 --- a/src/pal/pal_consts.h +++ b/src/pal/pal_consts.h @@ -78,7 +78,7 @@ namespace snmalloc /** * List of callbacks to notify */ - std::atomic callbacks = nullptr; + std::atomic callbacks{nullptr}; public: /**