From 3d592972dc3fd61cc88771b889eff237e4e03e0f Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 20 Oct 2020 19:07:39 -0700 Subject: Revert "core: Fix clang build" --- src/common/fiber.h | 4 ++-- src/common/file_util.h | 3 +-- src/common/math_util.h | 4 ++-- src/common/multi_level_queue.h | 2 +- src/common/spin_lock.h | 8 -------- src/common/swap.h | 10 +++++----- src/common/thread_queue_list.h | 4 ++-- 7 files changed, 13 insertions(+), 22 deletions(-) (limited to 'src/common') diff --git a/src/common/fiber.h b/src/common/fiber.h index bc1db1582..89dde5e36 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h @@ -41,8 +41,8 @@ public: Fiber(const Fiber&) = delete; Fiber& operator=(const Fiber&) = delete; - Fiber(Fiber&&) = delete; - Fiber& operator=(Fiber&&) = delete; + Fiber(Fiber&&) = default; + Fiber& operator=(Fiber&&) = default; /// Yields control from Fiber 'from' to Fiber 'to' /// Fiber 'from' must be the currently running fiber. diff --git a/src/common/file_util.h b/src/common/file_util.h index 508b7a10a..8b587320f 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -189,8 +189,7 @@ template return {}; } last = std::min(last, vector.size()); - return std::vector(vector.begin() + static_cast(first), - vector.begin() + static_cast(first + last)); + return std::vector(vector.begin() + first, vector.begin() + first + last); } enum class DirectorySeparator { diff --git a/src/common/math_util.h b/src/common/math_util.h index 4c38d8040..7cec80d57 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -27,7 +27,7 @@ struct Rectangle { if constexpr (std::is_floating_point_v) { return std::abs(right - left); } else { - return static_cast(std::abs(static_cast>(right - left))); + return std::abs(static_cast>(right - left)); } } @@ -35,7 +35,7 @@ struct Rectangle { if constexpr (std::is_floating_point_v) { return std::abs(bottom - top); } else { - return static_cast(std::abs(static_cast>(bottom - top))); + return std::abs(static_cast>(bottom - top)); } } diff --git a/src/common/multi_level_queue.h b/src/common/multi_level_queue.h index 71613f18b..4b305bf40 100644 --- a/src/common/multi_level_queue.h +++ b/src/common/multi_level_queue.h @@ -320,7 +320,7 @@ private: } const auto begin_range = list.begin(); - const auto end_range = std::next(begin_range, static_cast(shift)); + const auto end_range = std::next(begin_range, shift); list.splice(list.end(), list, begin_range, end_range); } diff --git a/src/common/spin_lock.h b/src/common/spin_lock.h index 06ac2f5bb..4f946a258 100644 --- a/src/common/spin_lock.h +++ b/src/common/spin_lock.h @@ -15,14 +15,6 @@ namespace Common { */ class SpinLock { public: - SpinLock() = default; - - SpinLock(const SpinLock&) = delete; - SpinLock& operator=(const SpinLock&) = delete; - - SpinLock(SpinLock&&) = delete; - SpinLock& operator=(SpinLock&&) = delete; - void lock(); void unlock(); [[nodiscard]] bool try_lock(); diff --git a/src/common/swap.h b/src/common/swap.h index 8c68c1f26..7665942a2 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -504,35 +504,35 @@ bool operator==(const S& p, const swap_struct_t v) { template struct swap_64_t { static T swap(T x) { - return static_cast(Common::swap64(static_cast(x))); + return static_cast(Common::swap64(x)); } }; template struct swap_32_t { static T swap(T x) { - return static_cast(Common::swap32(static_cast(x))); + return static_cast(Common::swap32(x)); } }; template struct swap_16_t { static T swap(T x) { - return static_cast(Common::swap16(static_cast(x))); + return static_cast(Common::swap16(x)); } }; template struct swap_float_t { static T swap(T x) { - return static_cast(Common::swapf(static_cast(x))); + return static_cast(Common::swapf(x)); } }; template struct swap_double_t { static T swap(T x) { - return static_cast(Common::swapd(static_cast(x))); + return static_cast(Common::swapd(x)); } }; diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 69c9193da..def9e5d8d 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -33,7 +33,7 @@ struct ThreadQueueList { } } - return static_cast(-1); + return -1; } [[nodiscard]] T get_first() const { @@ -156,7 +156,7 @@ private: void link(Priority priority) { Queue* cur = &queues[priority]; - for (auto i = static_cast(priority - 1); i >= 0; --i) { + for (int i = priority - 1; i >= 0; --i) { if (queues[i].next_nonempty != UnlinkedTag()) { cur->next_nonempty = queues[i].next_nonempty; queues[i].next_nonempty = cur; -- cgit v1.2.3