Various minor changes to aid compiling with std14 (#182)
These changes make the code compile in clang10 with -std14.
This commit is contained in:
committed by
GitHub
parent
c899ee7ab2
commit
a9cfc3a2b4
@@ -121,6 +121,7 @@ namespace snmalloc
|
||||
}
|
||||
|
||||
Cmp(const Cmp&) = delete;
|
||||
Cmp(Cmp&&) noexcept = default;
|
||||
};
|
||||
|
||||
// This method is used in Verona
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace snmalloc
|
||||
class Singleton
|
||||
{
|
||||
inline static std::atomic_flag flag;
|
||||
inline static std::atomic<bool> initialised = false;
|
||||
inline static std::atomic<bool> initialised{false};
|
||||
inline static Object obj;
|
||||
|
||||
public:
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace snmalloc
|
||||
std::is_same<decltype(T::next), std::atomic<T*>>::value,
|
||||
"T->next must be a std::atomic<T*>");
|
||||
|
||||
std::atomic<T*> back = nullptr;
|
||||
std::atomic<T*> 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
|
||||
|
||||
@@ -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)))
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace snmalloc
|
||||
{
|
||||
PagemapEntry* value = get_node<create_addr>(e, result);
|
||||
if (unlikely(!result))
|
||||
return std::pair(nullptr, 0);
|
||||
return {nullptr, 0};
|
||||
|
||||
shift -= BITS_PER_INDEX_LEVEL;
|
||||
ix = (static_cast<size_t>(addr) >> shift) & ENTRIES_MASK;
|
||||
@@ -208,11 +208,11 @@ namespace snmalloc
|
||||
Leaf* leaf = reinterpret_cast<Leaf*>(get_node<create_addr>(e, result));
|
||||
|
||||
if (unlikely(!result))
|
||||
return std::pair(nullptr, 0);
|
||||
return {nullptr, 0};
|
||||
|
||||
shift -= BITS_FOR_LEAF;
|
||||
ix = (static_cast<size_t>(addr) >> shift) & LEAF_MASK;
|
||||
return std::pair(leaf, ix);
|
||||
return {leaf, ix};
|
||||
}
|
||||
|
||||
template<bool create_addr>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace snmalloc
|
||||
friend class MPMCStack;
|
||||
|
||||
/// Used by the pool for chaining together entries when not in use.
|
||||
std::atomic<T*> next = nullptr;
|
||||
std::atomic<T*> 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;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace snmalloc
|
||||
union
|
||||
{
|
||||
Remote* non_atomic_next;
|
||||
std::atomic<Remote*> next = nullptr;
|
||||
std::atomic<Remote*> next{nullptr};
|
||||
};
|
||||
|
||||
alloc_id_t allocator_id;
|
||||
|
||||
@@ -63,6 +63,6 @@ namespace snmalloc
|
||||
*/
|
||||
inline SlowAllocator get_slow_allocator()
|
||||
{
|
||||
return SlowAllocator{};
|
||||
return {};
|
||||
}
|
||||
} // namespace snmalloc
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace snmalloc
|
||||
/**
|
||||
* List of callbacks to notify
|
||||
*/
|
||||
std::atomic<PalNotificationObject*> callbacks = nullptr;
|
||||
std::atomic<PalNotificationObject*> callbacks{nullptr};
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user