From d5fc56db4bdebcf4f45e39e9c9d0f40229de8cea Mon Sep 17 00:00:00 2001 From: Levi Behunin Date: Sun, 29 Jan 2023 13:54:13 -0700 Subject: [PATCH] Move to Clang Format 15 Depends on https://github.com/yuzu-emu/build-environments/pull/69 clang-15 primary run --- .ci/scripts/format/script.sh | 2 +- src/common/address_space.h | 7 +- src/common/alignment.h | 18 ++--- src/common/atomic_helpers.h | 2 +- src/common/bit_util.h | 6 +- src/common/concepts.h | 6 +- src/common/div_ceil.h | 4 +- src/common/expected.h | 60 +++++++-------- src/common/intrusive_red_black_tree.h | 20 ++--- src/common/make_unique_for_overwrite.h | 8 +- src/common/polyfill_ranges.h | 8 +- src/common/polyfill_thread.h | 4 +- src/common/settings.h | 12 ++- src/common/tree.h | 74 +++++++++---------- src/common/vector_math.h | 16 ++-- src/core/hle/kernel/k_auto_object.h | 20 ++--- src/core/hle/kernel/k_priority_queue.h | 50 +++++++------ src/core/hle/kernel/k_scoped_lock.h | 11 +-- src/core/hle/kernel/k_thread.h | 8 +- src/core/hle/kernel/k_thread_local_page.h | 6 +- .../helpers/joycon_protocol/common_protocol.h | 4 +- .../frontend/ir/ir_emitter.h | 3 +- src/shader_recompiler/frontend/ir/value.h | 13 ++-- src/shader_recompiler/object_pool.h | 4 +- .../texture_cache/descriptor_table.h | 4 +- src/video_core/texture_cache/slot_vector.h | 2 +- 26 files changed, 184 insertions(+), 188 deletions(-) diff --git a/.ci/scripts/format/script.sh b/.ci/scripts/format/script.sh index 225bbc972..25b0718f0 100755 --- a/.ci/scripts/format/script.sh +++ b/.ci/scripts/format/script.sh @@ -10,7 +10,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis fi # Default clang-format points to default 3.5 version one -CLANG_FORMAT=${CLANG_FORMAT:-clang-format-12} +CLANG_FORMAT=${CLANG_FORMAT:-clang-format-15} $CLANG_FORMAT --version if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then diff --git a/src/common/address_space.h b/src/common/address_space.h index 9222b2fdc..8683c23c3 100644 --- a/src/common/address_space.h +++ b/src/common/address_space.h @@ -12,7 +12,8 @@ namespace Common { template -concept AddressSpaceValid = std::is_unsigned_v && sizeof(VaType) * 8 >= AddressSpaceBits; +concept AddressSpaceValid = std::is_unsigned_v && sizeof(VaType) * 8 >= +AddressSpaceBits; struct EmptyStruct {}; @@ -21,7 +22,7 @@ struct EmptyStruct {}; */ template -requires AddressSpaceValid + requires AddressSpaceValid class FlatAddressSpaceMap { public: /// The maximum VA that this AS can technically reach @@ -109,7 +110,7 @@ private: * initial, fast linear pass and a subsequent slower pass that iterates until it finds a free block */ template -requires AddressSpaceValid + requires AddressSpaceValid class FlatAllocator : public FlatAddressSpaceMap { private: diff --git a/src/common/alignment.h b/src/common/alignment.h index 7e897334b..fa715d497 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -10,7 +10,7 @@ namespace Common { template -requires std::is_unsigned_v + requires std::is_unsigned_v [[nodiscard]] constexpr T AlignUp(T value, size_t size) { auto mod{static_cast(value % size)}; value -= mod; @@ -18,31 +18,31 @@ requires std::is_unsigned_v } template -requires std::is_unsigned_v + requires std::is_unsigned_v [[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { return static_cast((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); } template -requires std::is_unsigned_v + requires std::is_unsigned_v [[nodiscard]] constexpr T AlignDown(T value, size_t size) { return static_cast(value - value % size); } template -requires std::is_unsigned_v + requires std::is_unsigned_v [[nodiscard]] constexpr bool Is4KBAligned(T value) { return (value & 0xFFF) == 0; } template -requires std::is_unsigned_v + requires std::is_unsigned_v [[nodiscard]] constexpr bool IsWordAligned(T value) { return (value & 0b11) == 0; } template -requires std::is_integral_v + requires std::is_integral_v [[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { using U = typename std::make_unsigned_t; const U mask = static_cast(alignment - 1); @@ -50,7 +50,7 @@ requires std::is_integral_v } template -requires std::is_integral_v + requires std::is_integral_v [[nodiscard]] constexpr T DivideUp(T x, U y) { return (x + (y - 1)) / y; } @@ -73,11 +73,11 @@ public: constexpr AlignmentAllocator(const AlignmentAllocator&) noexcept {} [[nodiscard]] T* allocate(size_type n) { - return static_cast(::operator new (n * sizeof(T), std::align_val_t{Align})); + return static_cast(::operator new(n * sizeof(T), std::align_val_t{Align})); } void deallocate(T* p, size_type n) { - ::operator delete (p, n * sizeof(T), std::align_val_t{Align}); + ::operator delete(p, n * sizeof(T), std::align_val_t{Align}); } template diff --git a/src/common/atomic_helpers.h b/src/common/atomic_helpers.h index aef3b66a4..d997f10ba 100644 --- a/src/common/atomic_helpers.h +++ b/src/common/atomic_helpers.h @@ -75,7 +75,7 @@ extern "C" void AnnotateHappensAfter(const char*, int, void*); #if defined(AE_VCPP) || defined(AE_ICC) #define AE_FORCEINLINE __forceinline #elif defined(AE_GCC) -//#define AE_FORCEINLINE __attribute__((always_inline)) +// #define AE_FORCEINLINE __attribute__((always_inline)) #define AE_FORCEINLINE inline #else #define AE_FORCEINLINE inline diff --git a/src/common/bit_util.h b/src/common/bit_util.h index e4e6287f3..13368b439 100644 --- a/src/common/bit_util.h +++ b/src/common/bit_util.h @@ -45,19 +45,19 @@ template } template -requires std::is_unsigned_v + requires std::is_unsigned_v [[nodiscard]] constexpr bool IsPow2(T value) { return std::has_single_bit(value); } template -requires std::is_integral_v + requires std::is_integral_v [[nodiscard]] T NextPow2(T value) { return static_cast(1ULL << ((8U * sizeof(T)) - std::countl_zero(value - 1U))); } template -requires std::is_integral_v + requires std::is_integral_v [[nodiscard]] constexpr bool Bit(const T value) { static_assert(bit_index < BitSize(), "bit_index must be smaller than size of T"); return ((value >> bit_index) & T(1)) == T(1); diff --git a/src/common/concepts.h b/src/common/concepts.h index a9acff3e7..61df1d32a 100644 --- a/src/common/concepts.h +++ b/src/common/concepts.h @@ -16,9 +16,9 @@ concept IsContiguousContainer = std::contiguous_iterator; // is available on all supported platforms. template concept DerivedFrom = requires { - std::is_base_of_v; - std::is_convertible_v; -}; + std::is_base_of_v; + std::is_convertible_v; + }; // TODO: Replace with std::convertible_to when libc++ implements it. template diff --git a/src/common/div_ceil.h b/src/common/div_ceil.h index eebc279c2..c12477d42 100644 --- a/src/common/div_ceil.h +++ b/src/common/div_ceil.h @@ -10,14 +10,14 @@ namespace Common { /// Ceiled integer division. template -requires std::is_integral_v && std::is_unsigned_v + requires std::is_integral_v && std::is_unsigned_v [[nodiscard]] constexpr N DivCeil(N number, D divisor) { return static_cast((static_cast(number) + divisor - 1) / divisor); } /// Ceiled integer division with logarithmic divisor in base 2 template -requires std::is_integral_v && std::is_unsigned_v + requires std::is_integral_v && std::is_unsigned_v [[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { return static_cast((static_cast(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); } diff --git a/src/common/expected.h b/src/common/expected.h index 6e6c86ee7..5fccfbcbd 100644 --- a/src/common/expected.h +++ b/src/common/expected.h @@ -64,7 +64,7 @@ struct no_init_t { * Additionally, this requires E to be trivially destructible */ template > -requires std::is_trivially_destructible_v + requires std::is_trivially_destructible_v struct expected_storage_base { constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} @@ -111,7 +111,7 @@ struct expected_storage_base { * Additionally, this requires E to be trivially destructible */ template -requires std::is_trivially_destructible_v + requires std::is_trivially_destructible_v struct expected_storage_base { constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} @@ -251,7 +251,7 @@ struct expected_operations_base : expected_storage_base { * Additionally, this requires E to be trivially copy constructible */ template > -requires std::is_trivially_copy_constructible_v + requires std::is_trivially_copy_constructible_v struct expected_copy_base : expected_operations_base { using expected_operations_base::expected_operations_base; }; @@ -261,7 +261,7 @@ struct expected_copy_base : expected_operations_base { * Additionally, this requires E to be trivially copy constructible */ template -requires std::is_trivially_copy_constructible_v + requires std::is_trivially_copy_constructible_v struct expected_copy_base : expected_operations_base { using expected_operations_base::expected_operations_base; @@ -289,7 +289,7 @@ struct expected_copy_base : expected_operations_base { * Additionally, this requires E to be trivially move constructible */ template > -requires std::is_trivially_move_constructible_v + requires std::is_trivially_move_constructible_v struct expected_move_base : expected_copy_base { using expected_copy_base::expected_copy_base; }; @@ -299,7 +299,7 @@ struct expected_move_base : expected_copy_base { * Additionally, this requires E to be trivially move constructible */ template -requires std::is_trivially_move_constructible_v + requires std::is_trivially_move_constructible_v struct expected_move_base : expected_copy_base { using expected_copy_base::expected_copy_base; @@ -330,9 +330,9 @@ template , std::is_trivially_copy_constructible, std::is_trivially_destructible>> -requires std::conjunction_v, - std::is_trivially_copy_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_copy_constructible, + std::is_trivially_destructible> struct expected_copy_assign_base : expected_move_base { using expected_move_base::expected_move_base; }; @@ -342,9 +342,9 @@ struct expected_copy_assign_base : expected_move_base { * Additionally, this requires E to be trivially copy assignable */ template -requires std::conjunction_v, - std::is_trivially_copy_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_copy_constructible, + std::is_trivially_destructible> struct expected_copy_assign_base : expected_move_base { using expected_move_base::expected_move_base; @@ -371,9 +371,9 @@ template , std::is_trivially_move_constructible, std::is_trivially_destructible>> -requires std::conjunction_v, - std::is_trivially_move_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_move_constructible, + std::is_trivially_destructible> struct expected_move_assign_base : expected_copy_assign_base { using expected_copy_assign_base::expected_copy_assign_base; }; @@ -383,9 +383,9 @@ struct expected_move_assign_base : expected_copy_assign_base { * Additionally, this requires E to be trivially move assignable */ template -requires std::conjunction_v, - std::is_trivially_move_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_move_constructible, + std::is_trivially_destructible> struct expected_move_assign_base : expected_copy_assign_base { using expected_copy_assign_base::expected_copy_assign_base; @@ -412,7 +412,7 @@ struct expected_move_assign_base : expected_copy_assign_base */ template , bool EnableMove = std::is_move_constructible_v> -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = default; @@ -422,7 +422,7 @@ struct expected_delete_ctor_base { }; template -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = default; @@ -432,7 +432,7 @@ struct expected_delete_ctor_base { }; template -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; @@ -442,7 +442,7 @@ struct expected_delete_ctor_base { }; template -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; @@ -460,8 +460,8 @@ template < typename T, typename E, bool EnableCopy = std::conjunction_v, std::is_copy_assignable>, bool EnableMove = std::conjunction_v, std::is_move_assignable>> -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; @@ -471,8 +471,8 @@ struct expected_delete_assign_base { }; template -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; @@ -482,8 +482,8 @@ struct expected_delete_assign_base { }; template -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; @@ -493,8 +493,8 @@ struct expected_delete_assign_base { }; template -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h index 93046615e..5f6b34e82 100644 --- a/src/common/intrusive_red_black_tree.h +++ b/src/common/intrusive_red_black_tree.h @@ -242,19 +242,21 @@ public: template concept HasRedBlackKeyType = requires { - { std::is_same::value } -> std::convertible_to; -}; + { + std::is_same::value + } -> std::convertible_to; + }; namespace impl { - template - consteval auto* GetRedBlackKeyType() { - if constexpr (HasRedBlackKeyType) { - return static_cast(nullptr); - } else { - return static_cast(nullptr); - } +template +consteval auto* GetRedBlackKeyType() { + if constexpr (HasRedBlackKeyType) { + return static_cast(nullptr); + } else { + return static_cast(nullptr); } +} } // namespace impl diff --git a/src/common/make_unique_for_overwrite.h b/src/common/make_unique_for_overwrite.h index c7413cf51..17f81bba4 100644 --- a/src/common/make_unique_for_overwrite.h +++ b/src/common/make_unique_for_overwrite.h @@ -9,17 +9,19 @@ namespace Common { template -requires(!std::is_array_v) std::unique_ptr make_unique_for_overwrite() { + requires(!std::is_array_v) +std::unique_ptr make_unique_for_overwrite() { return std::unique_ptr(new T); } template -requires std::is_unbounded_array_v std::unique_ptr make_unique_for_overwrite(std::size_t n) { + requires std::is_unbounded_array_v +std::unique_ptr make_unique_for_overwrite(std::size_t n) { return std::unique_ptr(new std::remove_extent_t[n]); } template -requires std::is_bounded_array_v + requires std::is_bounded_array_v void make_unique_for_overwrite(Args&&...) = delete; } // namespace Common diff --git a/src/common/polyfill_ranges.h b/src/common/polyfill_ranges.h index ca44bfaef..512dbcbcb 100644 --- a/src/common/polyfill_ranges.h +++ b/src/common/polyfill_ranges.h @@ -18,9 +18,9 @@ namespace ranges { template concept range = requires(T& t) { - begin(t); - end(t); -}; + begin(t); + end(t); + }; template concept input_range = range; @@ -421,7 +421,7 @@ struct generate_fn { } template - requires std::invocable && ranges::output_range + requires std::invocable && ranges::output_range constexpr ranges::iterator_t operator()(R&& r, F gen) const { return operator()(ranges::begin(r), ranges::end(r), std::move(gen)); } diff --git a/src/common/polyfill_thread.h b/src/common/polyfill_thread.h index b4c94a5fc..b5ef055db 100644 --- a/src/common/polyfill_thread.h +++ b/src/common/polyfill_thread.h @@ -213,7 +213,7 @@ public: using callback_type = Callback; template - requires constructible_from + requires constructible_from explicit stop_callback(const stop_token& st, C&& cb) noexcept(is_nothrow_constructible_v) : m_stop_state(st.m_stop_state) { @@ -222,7 +222,7 @@ public: } } template - requires constructible_from + requires constructible_from explicit stop_callback(stop_token&& st, C&& cb) noexcept(is_nothrow_constructible_v) : m_stop_state(move(st.m_stop_state)) { diff --git a/src/common/settings.h b/src/common/settings.h index 4b4da4da2..64db66f37 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -131,7 +131,8 @@ public: * @param default_val Intial value of the setting, and default value of the setting * @param name Label for the setting */ - explicit Setting(const Type& default_val, const std::string& name) requires(!ranged) + explicit Setting(const Type& default_val, const std::string& name) + requires(!ranged) : value{default_val}, default_value{default_val}, label{name} {} virtual ~Setting() = default; @@ -144,7 +145,8 @@ public: * @param name Label for the setting */ explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, - const std::string& name) requires(ranged) + const std::string& name) + requires(ranged) : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} @@ -232,7 +234,8 @@ public: * @param default_val Intial value of the setting, and default value of the setting * @param name Label for the setting */ - explicit SwitchableSetting(const Type& default_val, const std::string& name) requires(!ranged) + explicit SwitchableSetting(const Type& default_val, const std::string& name) + requires(!ranged) : Setting{default_val, name} {} virtual ~SwitchableSetting() = default; @@ -245,7 +248,8 @@ public: * @param name Label for the setting */ explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, - const std::string& name) requires(ranged) + const std::string& name) + requires(ranged) : Setting{default_val, min_val, max_val, name} {} /** diff --git a/src/common/tree.h b/src/common/tree.h index f77859209..f4fc43de3 100644 --- a/src/common/tree.h +++ b/src/common/tree.h @@ -103,12 +103,12 @@ concept IsRBEntry = CheckRBEntry::value; template concept HasRBEntry = requires(T& t, const T& ct) { - { t.GetRBEntry() } -> std::same_as&>; - { ct.GetRBEntry() } -> std::same_as&>; -}; + { t.GetRBEntry() } -> std::same_as&>; + { ct.GetRBEntry() } -> std::same_as&>; + }; template -requires HasRBEntry + requires HasRBEntry class RBHead { private: T* m_rbh_root = nullptr; @@ -130,90 +130,90 @@ public: }; template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr RBEntry& RB_ENTRY(T* t) { return t->GetRBEntry(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr const RBEntry& RB_ENTRY(const T* t) { return t->GetRBEntry(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr T* RB_LEFT(T* t) { return RB_ENTRY(t).Left(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr const T* RB_LEFT(const T* t) { return RB_ENTRY(t).Left(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr T* RB_RIGHT(T* t) { return RB_ENTRY(t).Right(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr const T* RB_RIGHT(const T* t) { return RB_ENTRY(t).Right(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr T* RB_PARENT(T* t) { return RB_ENTRY(t).Parent(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr const T* RB_PARENT(const T* t) { return RB_ENTRY(t).Parent(); } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_SET_LEFT(T* t, T* e) { RB_ENTRY(t).SetLeft(e); } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_SET_RIGHT(T* t, T* e) { RB_ENTRY(t).SetRight(e); } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_SET_PARENT(T* t, T* e) { RB_ENTRY(t).SetParent(e); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr bool RB_IS_BLACK(const T* t) { return RB_ENTRY(t).IsBlack(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr bool RB_IS_RED(const T* t) { return RB_ENTRY(t).IsRed(); } template -requires HasRBEntry + requires HasRBEntry [[nodiscard]] constexpr RBColor RB_COLOR(const T* t) { return RB_ENTRY(t).Color(); } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_SET_COLOR(T* t, RBColor c) { RB_ENTRY(t).SetColor(c); } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_SET(T* elm, T* parent) { auto& rb_entry = RB_ENTRY(elm); rb_entry.SetParent(parent); @@ -223,14 +223,14 @@ constexpr void RB_SET(T* elm, T* parent) { } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_SET_BLACKRED(T* black, T* red) { RB_SET_COLOR(black, RBColor::RB_BLACK); RB_SET_COLOR(red, RBColor::RB_RED); } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_ROTATE_LEFT(RBHead& head, T* elm, T*& tmp) { tmp = RB_RIGHT(elm); if (RB_SET_RIGHT(elm, RB_LEFT(tmp)); RB_RIGHT(elm) != nullptr) { @@ -252,7 +252,7 @@ constexpr void RB_ROTATE_LEFT(RBHead& head, T* elm, T*& tmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_ROTATE_RIGHT(RBHead& head, T* elm, T*& tmp) { tmp = RB_LEFT(elm); if (RB_SET_LEFT(elm, RB_RIGHT(tmp)); RB_LEFT(elm) != nullptr) { @@ -274,7 +274,7 @@ constexpr void RB_ROTATE_RIGHT(RBHead& head, T* elm, T*& tmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_REMOVE_COLOR(RBHead& head, T* parent, T* elm) { T* tmp; while ((elm == nullptr || RB_IS_BLACK(elm)) && elm != head.Root()) { @@ -358,7 +358,7 @@ constexpr void RB_REMOVE_COLOR(RBHead& head, T* parent, T* elm) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_REMOVE(RBHead& head, T* elm) { T* child = nullptr; T* parent = nullptr; @@ -451,7 +451,7 @@ constexpr T* RB_REMOVE(RBHead& head, T* elm) { } template -requires HasRBEntry + requires HasRBEntry constexpr void RB_INSERT_COLOR(RBHead& head, T* elm) { T *parent = nullptr, *tmp = nullptr; while ((parent = RB_PARENT(elm)) != nullptr && RB_IS_RED(parent)) { @@ -499,7 +499,7 @@ constexpr void RB_INSERT_COLOR(RBHead& head, T* elm) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_INSERT(RBHead& head, T* elm, Compare cmp) { T* parent = nullptr; T* tmp = head.Root(); @@ -534,7 +534,7 @@ constexpr T* RB_INSERT(RBHead& head, T* elm, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_FIND(RBHead& head, T* elm, Compare cmp) { T* tmp = head.Root(); @@ -553,7 +553,7 @@ constexpr T* RB_FIND(RBHead& head, T* elm, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_NFIND(RBHead& head, T* elm, Compare cmp) { T* tmp = head.Root(); T* res = nullptr; @@ -574,7 +574,7 @@ constexpr T* RB_NFIND(RBHead& head, T* elm, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_FIND_KEY(RBHead& head, const U& key, Compare cmp) { T* tmp = head.Root(); @@ -593,7 +593,7 @@ constexpr T* RB_FIND_KEY(RBHead& head, const U& key, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_NFIND_KEY(RBHead& head, const U& key, Compare cmp) { T* tmp = head.Root(); T* res = nullptr; @@ -614,7 +614,7 @@ constexpr T* RB_NFIND_KEY(RBHead& head, const U& key, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_FIND_EXISTING(RBHead& head, T* elm, Compare cmp) { T* tmp = head.Root(); @@ -631,7 +631,7 @@ constexpr T* RB_FIND_EXISTING(RBHead& head, T* elm, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_FIND_EXISTING_KEY(RBHead& head, const U& key, Compare cmp) { T* tmp = head.Root(); @@ -648,7 +648,7 @@ constexpr T* RB_FIND_EXISTING_KEY(RBHead& head, const U& key, Compare cmp) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_NEXT(T* elm) { if (RB_RIGHT(elm)) { elm = RB_RIGHT(elm); @@ -669,7 +669,7 @@ constexpr T* RB_NEXT(T* elm) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_PREV(T* elm) { if (RB_LEFT(elm)) { elm = RB_LEFT(elm); @@ -690,7 +690,7 @@ constexpr T* RB_PREV(T* elm) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_MIN(RBHead& head) { T* tmp = head.Root(); T* parent = nullptr; @@ -704,7 +704,7 @@ constexpr T* RB_MIN(RBHead& head) { } template -requires HasRBEntry + requires HasRBEntry constexpr T* RB_MAX(RBHead& head) { T* tmp = head.Root(); T* parent = nullptr; diff --git a/src/common/vector_math.h b/src/common/vector_math.h index e62eeea2e..0e2095c45 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -348,9 +348,7 @@ public: // _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all // component names (x<->r) and permutations (xy<->yx) #define _DEFINE_SWIZZLER2(a, b, name) \ - [[nodiscard]] constexpr Vec2 name() const { \ - return Vec2(a, b); \ - } + [[nodiscard]] constexpr Vec2 name() const { return Vec2(a, b); } #define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \ _DEFINE_SWIZZLER2(a, b, a##b); \ _DEFINE_SWIZZLER2(a, b, a2##b2); \ @@ -543,9 +541,7 @@ public: // DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and // permutations (xy<->yx) #define _DEFINE_SWIZZLER2(a, b, name) \ - [[nodiscard]] constexpr Vec2 name() const { \ - return Vec2(a, b); \ - } + [[nodiscard]] constexpr Vec2 name() const { return Vec2(a, b); } #define DEFINE_SWIZZLER2_COMP1(a, a2) \ _DEFINE_SWIZZLER2(a, a, a##a); \ _DEFINE_SWIZZLER2(a, a, a2##a2) @@ -570,9 +566,7 @@ public: #undef _DEFINE_SWIZZLER2 #define _DEFINE_SWIZZLER3(a, b, c, name) \ - [[nodiscard]] constexpr Vec3 name() const { \ - return Vec3(a, b, c); \ - } + [[nodiscard]] constexpr Vec3 name() const { return Vec3(a, b, c); } #define DEFINE_SWIZZLER3_COMP1(a, a2) \ _DEFINE_SWIZZLER3(a, a, a, a##a##a); \ _DEFINE_SWIZZLER3(a, a, a, a2##a2##a2) @@ -641,8 +635,8 @@ template // linear interpolation via float: 0.0=begin, 1.0=end template -[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) - Lerp(const X& begin, const X& end, const float t) { +[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, + const float t) { return begin * (1.f - t) + end * t; } diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h index 2827763d5..e8118c2b8 100644 --- a/src/core/hle/kernel/k_auto_object.h +++ b/src/core/hle/kernel/k_auto_object.h @@ -24,9 +24,7 @@ private: friend class ::Kernel::KClassTokenGenerator; \ static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \ static constexpr inline const char* const TypeName = #CLASS; \ - static constexpr inline ClassTokenType ClassToken() { \ - return ::Kernel::ClassToken; \ - } \ + static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken; } \ \ public: \ YUZU_NON_COPYABLE(CLASS); \ @@ -37,15 +35,9 @@ public: constexpr ClassTokenType Token = ClassToken(); \ return TypeObj(TypeName, Token); \ } \ - static constexpr const char* GetStaticTypeName() { \ - return TypeName; \ - } \ - virtual TypeObj GetTypeObj() ATTRIBUTE { \ - return GetStaticTypeObj(); \ - } \ - virtual const char* GetTypeName() ATTRIBUTE { \ - return GetStaticTypeName(); \ - } \ + static constexpr const char* GetStaticTypeName() { return TypeName; } \ + virtual TypeObj GetTypeObj() ATTRIBUTE { return GetStaticTypeObj(); } \ + virtual const char* GetTypeName() ATTRIBUTE { return GetStaticTypeName(); } \ \ private: \ constexpr bool operator!=(const TypeObj& rhs) @@ -245,8 +237,8 @@ public: } template - requires(std::derived_from || - std::derived_from) constexpr KScopedAutoObject(KScopedAutoObject&& rhs) { + requires(std::derived_from || std::derived_from) + constexpr KScopedAutoObject(KScopedAutoObject&& rhs) { if constexpr (std::derived_from) { // Upcast. m_obj = rhs.m_obj; diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index cb2512b0b..645c5b531 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -17,35 +17,41 @@ namespace Kernel { class KThread; template -concept KPriorityQueueAffinityMask = !std::is_reference_v && requires(T & t) { - { t.GetAffinityMask() } -> Common::ConvertibleTo; - {t.SetAffinityMask(0)}; +concept KPriorityQueueAffinityMask = ! +std::is_reference_v&& requires(T& t) { + { t.GetAffinityMask() } -> Common::ConvertibleTo; + { t.SetAffinityMask(0) }; - { t.GetAffinity(0) } -> std::same_as; - {t.SetAffinity(0, false)}; - {t.SetAll()}; -}; + { t.GetAffinity(0) } -> std::same_as; + { t.SetAffinity(0, false) }; + { t.SetAll() }; + }; template -concept KPriorityQueueMember = !std::is_reference_v && requires(T & t) { - {typename T::QueueEntry()}; - {(typename T::QueueEntry()).Initialize()}; - {(typename T::QueueEntry()).SetPrev(std::addressof(t))}; - {(typename T::QueueEntry()).SetNext(std::addressof(t))}; - { (typename T::QueueEntry()).GetNext() } -> std::same_as; - { (typename T::QueueEntry()).GetPrev() } -> std::same_as; - { t.GetPriorityQueueEntry(0) } -> std::same_as; +concept KPriorityQueueMember = ! +std::is_reference_v&& requires(T& t) { + { typename T::QueueEntry() }; + { (typename T::QueueEntry()).Initialize() }; + { (typename T::QueueEntry()).SetPrev(std::addressof(t)) }; + { (typename T::QueueEntry()).SetNext(std::addressof(t)) }; + { (typename T::QueueEntry()).GetNext() } -> std::same_as; + { (typename T::QueueEntry()).GetPrev() } -> std::same_as; + { + t.GetPriorityQueueEntry(0) + } -> std::same_as; - {t.GetAffinityMask()}; - { std::remove_cvref_t() } -> KPriorityQueueAffinityMask; + { t.GetAffinityMask() }; + { + std::remove_cvref_t() + } -> KPriorityQueueAffinityMask; - { t.GetActiveCore() } -> Common::ConvertibleTo; - { t.GetPriority() } -> Common::ConvertibleTo; - { t.IsDummyThread() } -> Common::ConvertibleTo; -}; + { t.GetActiveCore() } -> Common::ConvertibleTo; + { t.GetPriority() } -> Common::ConvertibleTo; + { t.IsDummyThread() } -> Common::ConvertibleTo; + }; template -requires KPriorityQueueMember + requires KPriorityQueueMember class KPriorityQueue { public: using AffinityMaskType = std::remove_cv_t< diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index 857e21156..59b3e32ae 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h @@ -9,13 +9,14 @@ namespace Kernel { template -concept KLockable = !std::is_reference_v && requires(T & t) { - { t.Lock() } -> std::same_as; - { t.Unlock() } -> std::same_as; -}; +concept KLockable = ! +std::is_reference_v&& requires(T& t) { + { t.Lock() } -> std::same_as; + { t.Unlock() } -> std::same_as; + }; template -requires KLockable + requires KLockable class [[nodiscard]] KScopedLock { public: explicit KScopedLock(T* l) : lock_ptr(l) { diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 9d771de0e..8b8dc51be 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -677,7 +677,7 @@ private: union SyncObjectBuffer { std::array sync_objects{}; std::array + Svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject*) / sizeof(Handle))> handles; constexpr SyncObjectBuffer() {} }; @@ -698,10 +698,8 @@ private: }; template - requires( - std::same_as || - std::same_as) static constexpr int Compare(const T& lhs, - const KThread& rhs) { + requires(std::same_as || std::same_as) + static constexpr int Compare(const T& lhs, const KThread& rhs) { const u64 l_key = lhs.GetConditionVariableKey(); const u64 r_key = rhs.GetConditionVariableKey(); diff --git a/src/core/hle/kernel/k_thread_local_page.h b/src/core/hle/kernel/k_thread_local_page.h index fe0cff084..71254eb55 100644 --- a/src/core/hle/kernel/k_thread_local_page.h +++ b/src/core/hle/kernel/k_thread_local_page.h @@ -70,10 +70,8 @@ public: } template - requires(std::same_as || - std::same_as) static constexpr int Compare(const T& lhs, - const KThreadLocalPage& - rhs) { + requires(std::same_as || std::same_as) + static constexpr int Compare(const T& lhs, const KThreadLocalPage& rhs) { const VAddr lval = GetRedBlackKey(lhs); const VAddr rval = GetRedBlackKey(rhs); diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.h b/src/input_common/helpers/joycon_protocol/common_protocol.h index 75d3f20a4..188f6ecfa 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.h +++ b/src/input_common/helpers/joycon_protocol/common_protocol.h @@ -107,8 +107,8 @@ public: * @returns output object containing the responce */ template - requires std::is_trivially_copyable_v DriverResult ReadSPI(SpiAddress addr, - Output& output) { + requires std::is_trivially_copyable_v + DriverResult ReadSPI(SpiAddress addr, Output& output) { std::array buffer; output = {}; diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index df158c928..f3c81dbe1 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h @@ -409,7 +409,8 @@ private: } template - requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v) struct Flags { + requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v) + struct Flags { Flags() = default; Flags(T proxy_) : proxy{proxy_} {} diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 883dfa24e..22e89dd1b 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h @@ -101,9 +101,8 @@ public: TypedValue() = default; template - requires((other_type & type_) != IR::Type::Void) explicit(false) - TypedValue(const TypedValue& value) - : Value(value) {} + requires((other_type & type_) != IR::Type::Void) + explicit(false) TypedValue(const TypedValue& value) : Value(value) {} explicit TypedValue(const Value& value) : Value(value) { if ((value.Type() & type_) == IR::Type::Void) { @@ -194,16 +193,16 @@ public: void ReplaceOpcode(IR::Opcode opcode); template - requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v) - [[nodiscard]] FlagsType Flags() const noexcept { + requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v) + [[nodiscard]] FlagsType Flags() const noexcept { FlagsType ret; std::memcpy(reinterpret_cast(&ret), &flags, sizeof(ret)); return ret; } template - requires(sizeof(FlagsType) <= sizeof(u32) && - std::is_trivially_copyable_v) void SetFlags(FlagsType value) noexcept { + requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v) + void SetFlags(FlagsType value) noexcept { std::memcpy(&flags, &value, sizeof(value)); } diff --git a/src/shader_recompiler/object_pool.h b/src/shader_recompiler/object_pool.h index 2b42c4ba2..5d648b159 100644 --- a/src/shader_recompiler/object_pool.h +++ b/src/shader_recompiler/object_pool.h @@ -10,7 +10,7 @@ namespace Shader { template -requires std::is_destructible_v + requires std::is_destructible_v class ObjectPool { public: explicit ObjectPool(size_t chunk_size = 8192) : new_chunk_size{chunk_size} { @@ -18,7 +18,7 @@ public: } template - requires std::is_constructible_v + requires std::is_constructible_v [[nodiscard]] T* Create(Args&&... args) { return std::construct_at(Memory(), std::forward(args)...); } diff --git a/src/video_core/texture_cache/descriptor_table.h b/src/video_core/texture_cache/descriptor_table.h index ee4240288..1bad83fb4 100644 --- a/src/video_core/texture_cache/descriptor_table.h +++ b/src/video_core/texture_cache/descriptor_table.h @@ -19,9 +19,7 @@ public: explicit DescriptorTable(Tegra::MemoryManager& gpu_memory_) : gpu_memory{gpu_memory_} {} [[nodiscard]] bool Synchronize(GPUVAddr gpu_addr, u32 limit) { - [[likely]] if (current_gpu_addr == gpu_addr && current_limit == limit) { - return false; - } + [[likely]] if (current_gpu_addr == gpu_addr && current_limit == limit) { return false; } Refresh(gpu_addr, limit); return true; } diff --git a/src/video_core/texture_cache/slot_vector.h b/src/video_core/texture_cache/slot_vector.h index 1e2aad76a..9df6a2903 100644 --- a/src/video_core/texture_cache/slot_vector.h +++ b/src/video_core/texture_cache/slot_vector.h @@ -29,7 +29,7 @@ struct SlotId { }; template -requires std::is_nothrow_move_assignable_v && std::is_nothrow_move_constructible_v + requires std::is_nothrow_move_assignable_v && std::is_nothrow_move_constructible_v class SlotVector { public: class Iterator {