From 416a2c6b5680d6087348d826cb751bc19145e57e Mon Sep 17 00:00:00 2001 From: Merry Date: Tue, 26 Apr 2022 12:16:55 +0100 Subject: [PATCH] mcl: clang-format: Adopt WebKit style bracing --- .clang-format | 4 +- include/mcl/assert.hpp | 3 +- include/mcl/bit/bit_count.hpp | 12 ++- include/mcl/bit/bit_field.hpp | 66 +++++++++----- include/mcl/bit/rotate.hpp | 6 +- include/mcl/bit/swap.hpp | 18 ++-- include/mcl/bit_cast.hpp | 6 +- include/mcl/container/intrusive_list.hpp | 108 +++++++++++++++-------- include/mcl/iterator/reverse.hpp | 9 +- include/mcl/mp/typelist/contains.hpp | 2 +- include/mcl/scope_exit.hpp | 27 ++++-- src/assert.cpp | 3 +- tests/bit/bit_field_tests.cpp | 3 +- 13 files changed, 174 insertions(+), 93 deletions(-) diff --git a/.clang-format b/.clang-format index 5c5555e..28884fb 100644 --- a/.clang-format +++ b/.clang-format @@ -34,7 +34,7 @@ BraceWrapping: AfterClass: false AfterControlStatement: Never AfterEnum: false - AfterFunction: false + AfterFunction: true AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false @@ -62,7 +62,7 @@ ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true -ConstructorInitializerIndentWidth: 8 +ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DeriveLineEnding: true diff --git a/include/mcl/assert.hpp b/include/mcl/assert.hpp index 3b9377a..daf49d7 100644 --- a/include/mcl/assert.hpp +++ b/include/mcl/assert.hpp @@ -16,7 +16,8 @@ namespace mcl::detail { [[noreturn]] void assert_terminate_impl(fmt::string_view msg, fmt::format_args args); template -[[noreturn]] void assert_terminate(fmt::string_view msg, Ts... args) { +[[noreturn]] void assert_terminate(fmt::string_view msg, Ts... args) +{ assert_terminate_impl(msg, fmt::make_format_args(args...)); } diff --git a/include/mcl/bit/bit_count.hpp b/include/mcl/bit/bit_count.hpp index c08abd0..104af9c 100644 --- a/include/mcl/bit/bit_count.hpp +++ b/include/mcl/bit/bit_count.hpp @@ -13,12 +13,14 @@ namespace mcl::bit { template -inline size_t count_ones(T x) { +inline size_t count_ones(T x) +{ return std::bitset>(x).count(); } template -constexpr size_t count_leading_zeros(T x) { +constexpr size_t count_leading_zeros(T x) +{ size_t result = bitsizeof; while (x != 0) { x >>= 1; @@ -28,7 +30,8 @@ constexpr size_t count_leading_zeros(T x) { } template -constexpr int highest_set_bit(T x) { +constexpr int highest_set_bit(T x) +{ int result = -1; while (x != 0) { x >>= 1; @@ -38,7 +41,8 @@ constexpr int highest_set_bit(T x) { } template -constexpr size_t lowest_set_bit(T x) { +constexpr size_t lowest_set_bit(T x) +{ if (x == 0) { return bitsizeof; } diff --git a/include/mcl/bit/bit_field.hpp b/include/mcl/bit/bit_field.hpp index b967ed4..91e2749 100644 --- a/include/mcl/bit/bit_field.hpp +++ b/include/mcl/bit/bit_field.hpp @@ -13,7 +13,8 @@ namespace mcl::bit { /// Create a mask with `count` number of one bits. template -constexpr T ones() { +constexpr T ones() +{ static_assert(count <= bitsizeof, "count larger than bitsize of T"); if constexpr (count == 0) { @@ -25,7 +26,8 @@ constexpr T ones() { /// Create a mask with `count` number of one bits. template -constexpr T ones(size_t count) { +constexpr T ones(size_t count) +{ ASSERT_MSG(count <= bitsizeof, "count larger than bitsize of T"); if (count == 0) { @@ -36,7 +38,8 @@ constexpr T ones(size_t count) { /// Create a mask of type T for bits [begin_bit, end_bit] inclusive. template -constexpr T mask() { +constexpr T mask() +{ static_assert(begin_bit <= end_bit, "invalid bit range (position of beginning bit cannot be greater than that of end bit)"); static_assert(begin_bit < bitsizeof, "begin_bit must be smaller than size of T"); static_assert(end_bit < bitsizeof, "end_bit must be smaller than size of T"); @@ -46,7 +49,8 @@ constexpr T mask() { /// Create a mask of type T for bits [begin_bit, end_bit] inclusive. template -constexpr T mask(size_t begin_bit, size_t end_bit) { +constexpr T mask(size_t begin_bit, size_t end_bit) +{ ASSERT_MSG(begin_bit <= end_bit, "invalid bit range (position of beginning bit cannot be greater than that of end bit)"); ASSERT_MSG(begin_bit < bitsizeof, "begin_bit must be smaller than size of T"); ASSERT_MSG(end_bit < bitsizeof, "end_bit must be smaller than size of T"); @@ -56,91 +60,104 @@ constexpr T mask(size_t begin_bit, size_t end_bit) { /// Extract bits [begin_bit, end_bit] inclusive from value of type T. template -constexpr T get_bits(T value) { +constexpr T get_bits(T value) +{ constexpr T m = mask(); return (value & m) >> begin_bit; } /// Extract bits [begin_bit, end_bit] inclusive from value of type T. template -constexpr T get_bits(size_t begin_bit, size_t end_bit, T value) { +constexpr T get_bits(size_t begin_bit, size_t end_bit, T value) +{ const T m = mask(begin_bit, end_bit); return (value & m) >> begin_bit; } /// Clears bits [begin_bit, end_bit] inclusive of value of type T. template -constexpr T clear_bits(T value) { +constexpr T clear_bits(T value) +{ constexpr T m = mask(); return value & ~m; } /// Clears bits [begin_bit, end_bit] inclusive of value of type T. template -constexpr T clear_bits(size_t begin_bit, size_t end_bit, T value) { +constexpr T clear_bits(size_t begin_bit, size_t end_bit, T value) +{ const T m = mask(begin_bit, end_bit); return value & ~m; } /// Modifies bits [begin_bit, end_bit] inclusive of value of type T. template -constexpr T set_bits(T value, T new_bits) { +constexpr T set_bits(T value, T new_bits) +{ constexpr T m = mask(); return (value & ~m) | ((new_bits << begin_bit) & m); } /// Modifies bits [begin_bit, end_bit] inclusive of value of type T. template -constexpr T set_bits(size_t begin_bit, size_t end_bit, T value, T new_bits) { +constexpr T set_bits(size_t begin_bit, size_t end_bit, T value, T new_bits) +{ const T m = mask(begin_bit, end_bit); return (value & ~m) | ((new_bits << begin_bit) & m); } /// Extract bit at bit_position from value of type T. template -constexpr bool get_bit(T value) { +constexpr bool get_bit(T value) +{ constexpr T m = mask(); return (value & m) != 0; } /// Extract bit at bit_position from value of type T. template -constexpr bool get_bit(size_t bit_position, T value) { +constexpr bool get_bit(size_t bit_position, T value) +{ const T m = mask(bit_position, bit_position); return (value & m) != 0; } /// Clears bit at bit_position of value of type T. template -constexpr T clear_bit(T value) { +constexpr T clear_bit(T value) +{ constexpr T m = mask(); return value & ~m; } /// Clears bit at bit_position of value of type T. template -constexpr T clear_bit(size_t bit_position, T value) { +constexpr T clear_bit(size_t bit_position, T value) +{ const T m = mask(bit_position, bit_position); return value & ~m; } /// Modifies bit at bit_position of value of type T. template -constexpr T set_bit(T value, bool new_bit) { +constexpr T set_bit(T value, bool new_bit) +{ constexpr T m = mask(); return (value & ~m) | (new_bit ? m : static_cast(0)); } /// Modifies bit at bit_position of value of type T. template -constexpr T set_bit(size_t bit_position, T value, bool new_bit) { +constexpr T set_bit(size_t bit_position, T value, bool new_bit) +{ const T m = mask(bit_position, bit_position); return (value & ~m) | (new_bit ? m : static_cast(0)); } /// Sign-extends a value that has bit_count bits to the full bitwidth of type T. template -constexpr T sign_extend(T value) { +constexpr T sign_extend(T value) +{ static_assert(bit_count != 0, "cannot sign-extend zero-sized value"); using S = std::make_signed_t; @@ -150,7 +167,8 @@ constexpr T sign_extend(T value) { /// Sign-extends a value that has bit_count bits to the full bitwidth of type T. template -constexpr T sign_extend(size_t bit_count, T value) { +constexpr T sign_extend(size_t bit_count, T value) +{ ASSERT_MSG(bit_count != 0, "cannot sign-extend zero-sized value"); using S = std::make_signed_t; @@ -160,7 +178,8 @@ constexpr T sign_extend(size_t bit_count, T value) { /// Replicate an element across a value of type T. template -constexpr T replicate_element(T value) { +constexpr T replicate_element(T value) +{ static_assert(element_size <= bitsizeof, "element_size is too large"); static_assert(bitsizeof % element_size == 0, "bitsize of T not divisible by element_size"); @@ -173,7 +192,8 @@ constexpr T replicate_element(T value) { /// Replicate an element of type U across a value of type T. template -constexpr T replicate_element(T value) { +constexpr T replicate_element(T value) +{ static_assert(bitsizeof <= bitsizeof, "element_size is too large"); return replicate_element, T>(value); @@ -181,7 +201,8 @@ constexpr T replicate_element(T value) { /// Replicate an element across a value of type T. template -constexpr T replicate_element(size_t element_size, T value) { +constexpr T replicate_element(size_t element_size, T value) +{ ASSERT_MSG(element_size <= bitsizeof, "element_size is too large"); ASSERT_MSG(bitsizeof % element_size == 0, "bitsize of T not divisible by element_size"); @@ -192,7 +213,8 @@ constexpr T replicate_element(size_t element_size, T value) { } template -constexpr bool most_significant_bit(T value) { +constexpr bool most_significant_bit(T value) +{ return get_bit - 1, T>(value); } diff --git a/include/mcl/bit/rotate.hpp b/include/mcl/bit/rotate.hpp index 649e5e2..cb7e7bd 100644 --- a/include/mcl/bit/rotate.hpp +++ b/include/mcl/bit/rotate.hpp @@ -11,7 +11,8 @@ namespace mcl::bit { template -constexpr T rotate_right(T x, size_t amount) { +constexpr T rotate_right(T x, size_t amount) +{ amount %= bitsizeof; if (amount == 0) { return x; @@ -20,7 +21,8 @@ constexpr T rotate_right(T x, size_t amount) { } template -constexpr T rotate_left(T x, size_t amount) { +constexpr T rotate_left(T x, size_t amount) +{ amount %= bitsizeof; if (amount == 0) { return x; diff --git a/include/mcl/bit/swap.hpp b/include/mcl/bit/swap.hpp index 0df6bac..f96b6af 100644 --- a/include/mcl/bit/swap.hpp +++ b/include/mcl/bit/swap.hpp @@ -8,18 +8,21 @@ namespace mcl::bit { -constexpr u16 swap_bytes_16(u16 value) { +constexpr u16 swap_bytes_16(u16 value) +{ return static_cast(u32{value} >> 8 | u32{value} << 8); } -constexpr u32 swap_bytes_32(u32 value) { +constexpr u32 swap_bytes_32(u32 value) +{ return ((value & 0xff000000u) >> 24) | ((value & 0x00ff0000u) >> 8) | ((value & 0x0000ff00u) << 8) | ((value & 0x000000ffu) << 24); } -constexpr u64 swap_bytes_64(u64 value) { +constexpr u64 swap_bytes_64(u64 value) +{ return ((value & 0xff00000000000000ull) >> 56) | ((value & 0x00ff000000000000ull) >> 40) | ((value & 0x0000ff0000000000ull) >> 24) @@ -30,19 +33,22 @@ constexpr u64 swap_bytes_64(u64 value) { | ((value & 0x00000000000000ffull) << 56); } -constexpr u32 swap_halves_32(u32 value) { +constexpr u32 swap_halves_32(u32 value) +{ return ((value & 0xffff0000u) >> 16) | ((value & 0x0000ffffu) << 16); } -constexpr u64 swap_halves_64(u64 value) { +constexpr u64 swap_halves_64(u64 value) +{ return ((value & 0xffff000000000000ull) >> 48) | ((value & 0x0000ffff00000000ull) >> 16) | ((value & 0x00000000ffff0000ull) << 16) | ((value & 0x000000000000ffffull) << 48); } -constexpr u64 swap_words_64(u64 value) { +constexpr u64 swap_words_64(u64 value) +{ return ((value & 0xffffffff00000000ull) >> 32) | ((value & 0x00000000ffffffffull) << 32); } diff --git a/include/mcl/bit_cast.hpp b/include/mcl/bit_cast.hpp index cfa8860..3eda265 100644 --- a/include/mcl/bit_cast.hpp +++ b/include/mcl/bit_cast.hpp @@ -11,7 +11,8 @@ namespace mcl { /// Reinterpret objects of one type as another by bit-casting between object representations. template -inline Dest bit_cast(const Source& source) noexcept { +inline Dest bit_cast(const Source& source) noexcept +{ static_assert(sizeof(Dest) == sizeof(Source), "size of destination and source objects must be equal"); static_assert(std::is_trivially_copyable_v, "destination type must be trivially copyable."); static_assert(std::is_trivially_copyable_v, "source type must be trivially copyable"); @@ -24,7 +25,8 @@ inline Dest bit_cast(const Source& source) noexcept { /// Reinterpret objects of any arbitrary type as another type by bit-casting between object representations. /// Note that here we do not verify if source pointed to by source_ptr has enough bytes to read from. template -inline Dest bit_cast_pointee(const SourcePtr source_ptr) noexcept { +inline Dest bit_cast_pointee(const SourcePtr source_ptr) noexcept +{ static_assert(sizeof(SourcePtr) == sizeof(void*), "source pointer must have size of a pointer"); static_assert(std::is_trivially_copyable_v, "destination type must be trivially copyable."); diff --git a/include/mcl/container/intrusive_list.hpp b/include/mcl/container/intrusive_list.hpp index b757f21..515fd89 100644 --- a/include/mcl/container/intrusive_list.hpp +++ b/include/mcl/container/intrusive_list.hpp @@ -21,7 +21,8 @@ class intrusive_list_iterator; template class intrusive_list_node { public: - bool is_sentinel() const { + bool is_sentinel() const + { return is_sentinel_; } @@ -42,7 +43,8 @@ class intrusive_list_sentinel final : public intrusive_list_node { using intrusive_list_node::is_sentinel_; public: - intrusive_list_sentinel() { + intrusive_list_sentinel() + { next = this; prev = this; is_sentinel_ = true; @@ -72,50 +74,56 @@ public: intrusive_list_iterator& operator=(const intrusive_list_iterator& other) = default; explicit intrusive_list_iterator(node_pointer list_node) - : node(list_node) { - } + : node(list_node) {} explicit intrusive_list_iterator(pointer data) - : node(data) { - } + : node(data) {} explicit intrusive_list_iterator(reference data) - : node(&data) { - } + : node(&data) {} - intrusive_list_iterator& operator++() { + intrusive_list_iterator& operator++() + { node = node->next; return *this; } - intrusive_list_iterator& operator--() { + intrusive_list_iterator& operator--() + { node = node->prev; return *this; } - intrusive_list_iterator operator++(int) { + intrusive_list_iterator operator++(int) + { intrusive_list_iterator it(*this); ++*this; return it; } - intrusive_list_iterator operator--(int) { + intrusive_list_iterator operator--(int) + { intrusive_list_iterator it(*this); --*this; return it; } - bool operator==(const intrusive_list_iterator& other) const { + bool operator==(const intrusive_list_iterator& other) const + { return node == other.node; } - bool operator!=(const intrusive_list_iterator& other) const { + bool operator!=(const intrusive_list_iterator& other) const + { return !operator==(other); } - reference operator*() const { + reference operator*() const + { DEBUG_ASSERT(!node->is_sentinel()); return static_cast(*node); } - pointer operator->() const { + pointer operator->() const + { return std::addressof(operator*()); } - node_pointer AsNodePointer() const { + node_pointer AsNodePointer() const + { return node; } @@ -145,7 +153,8 @@ public: * @param location The location to insert the node. * @param new_node The node to add. */ - iterator insert(iterator location, pointer new_node) { + iterator insert(iterator location, pointer new_node) + { return insert_before(location, new_node); } @@ -156,7 +165,8 @@ public: * @param location The location to insert the new node. * @param new_node The node to insert into the list. */ - iterator insert_before(iterator location, pointer new_node) { + iterator insert_before(iterator location, pointer new_node) + { auto existing_node = location.AsNodePointer(); new_node->next = existing_node; @@ -173,7 +183,8 @@ public: * @param position Location to insert the node in front of. * @param new_node The node to be inserted into the list. */ - iterator insert_after(iterator position, pointer new_node) { + iterator insert_after(iterator position, pointer new_node) + { if (empty()) return insert(begin(), new_node); @@ -184,7 +195,8 @@ public: * Add an entry to the start of the list. * @param node Node to add to the list. */ - void push_front(pointer node) { + void push_front(pointer node) + { insert(begin(), node); } @@ -192,7 +204,8 @@ public: * Add an entry to the end of the list * @param node Node to add to the list. */ - void push_back(pointer node) { + void push_back(pointer node) + { insert(end(), node); } @@ -200,7 +213,8 @@ public: * Erases the node at the front of the list. * @note Must not be called on an empty list. */ - void pop_front() { + void pop_front() + { DEBUG_ASSERT(!empty()); erase(begin()); } @@ -209,7 +223,8 @@ public: * Erases the node at the back of the list. * @note Must not be called on an empty list. */ - void pop_back() { + void pop_back() + { DEBUG_ASSERT(!empty()); erase(--end()); } @@ -218,7 +233,8 @@ public: * Removes a node from this list * @param it An iterator that points to the node to remove from list. */ - pointer remove(iterator& it) { + pointer remove(iterator& it) + { DEBUG_ASSERT(it != end()); pointer node = &*it++; @@ -237,7 +253,8 @@ public: * Removes a node from this list * @param it A constant iterator that points to the node to remove from list. */ - pointer remove(const iterator& it) { + pointer remove(const iterator& it) + { iterator copy = it; return remove(copy); } @@ -246,7 +263,8 @@ public: * Removes a node from this list. * @param node A pointer to the node to remove. */ - pointer remove(pointer node) { + pointer remove(pointer node) + { return remove(iterator(node)); } @@ -254,7 +272,8 @@ public: * Removes a node from this list. * @param node A reference to the node to remove. */ - pointer remove(reference node) { + pointer remove(reference node) + { return remove(iterator(node)); } @@ -262,7 +281,8 @@ public: * Is this list empty? * @returns true if there are no nodes in this list. */ - bool empty() const { + bool empty() const + { return root->next == root.get(); } @@ -270,7 +290,8 @@ public: * Gets the total number of elements within this list. * @return the number of elements in this list. */ - size_type size() const { + size_type size() const + { return static_cast(std::distance(begin(), end())); } @@ -278,7 +299,8 @@ public: * Retrieves a reference to the node at the front of the list. * @note Must not be called on an empty list. */ - reference front() { + reference front() + { DEBUG_ASSERT(!empty()); return *begin(); } @@ -287,7 +309,8 @@ public: * Retrieves a constant reference to the node at the front of the list. * @note Must not be called on an empty list. */ - const_reference front() const { + const_reference front() const + { DEBUG_ASSERT(!empty()); return *begin(); } @@ -296,7 +319,8 @@ public: * Retrieves a reference to the node at the back of the list. * @note Must not be called on an empty list. */ - reference back() { + reference back() + { DEBUG_ASSERT(!empty()); return *--end(); } @@ -305,7 +329,8 @@ public: * Retrieves a constant reference to the node at the back of the list. * @note Must not be called on an empty list. */ - const_reference back() const { + const_reference back() const + { DEBUG_ASSERT(!empty()); return *--end(); } @@ -331,7 +356,8 @@ public: * Erases a node from the list, indicated by an iterator. * @param it The iterator that points to the node to erase. */ - iterator erase(iterator it) { + iterator erase(iterator it) + { remove(it); return it; } @@ -340,7 +366,8 @@ public: * Erases a node from this list. * @param node A pointer to the node to erase from this list. */ - iterator erase(pointer node) { + iterator erase(pointer node) + { return erase(iterator(node)); } @@ -348,7 +375,8 @@ public: * Erases a node from this list. * @param node A reference to the node to erase from this list. */ - iterator erase(reference node) { + iterator erase(reference node) + { return erase(iterator(node)); } @@ -356,7 +384,8 @@ public: * Exchanges contents of this list with another list instance. * @param other The other list to swap with. */ - void swap(intrusive_list& other) noexcept { + void swap(intrusive_list& other) noexcept + { root.swap(other.root); } @@ -371,7 +400,8 @@ private: * @param rhs The second list. */ template -void swap(intrusive_list& lhs, intrusive_list& rhs) noexcept { +void swap(intrusive_list& lhs, intrusive_list& rhs) noexcept +{ lhs.swap(rhs); } diff --git a/include/mcl/iterator/reverse.hpp b/include/mcl/iterator/reverse.hpp index eb21b9e..d7bdab6 100644 --- a/include/mcl/iterator/reverse.hpp +++ b/include/mcl/iterator/reverse.hpp @@ -13,12 +13,14 @@ template struct reverse_adapter { T& iterable; - constexpr auto begin() { + constexpr auto begin() + { using namespace std; return rbegin(iterable); } - constexpr auto end() { + constexpr auto end() + { using namespace std; return rend(iterable); } @@ -27,7 +29,8 @@ struct reverse_adapter { } // namespace detail template -constexpr detail::reverse_adapter reverse(T&& iterable) { +constexpr detail::reverse_adapter reverse(T&& iterable) +{ return detail::reverse_adapter{iterable}; } diff --git a/include/mcl/mp/typelist/contains.hpp b/include/mcl/mp/typelist/contains.hpp index f8d1fbf..1b7a0ed 100644 --- a/include/mcl/mp/typelist/contains.hpp +++ b/include/mcl/mp/typelist/contains.hpp @@ -14,7 +14,7 @@ struct contains; template class LT, class... Ts, class T> struct contains, T> - : bool_value<(false || ... || std::is_same_v)> {}; + : bool_value<(false || ... || std::is_same_v)> {}; /// Does list L contain an element which is same as type T? template diff --git a/include/mcl/scope_exit.hpp b/include/mcl/scope_exit.hpp index d6d11ed..d3772e9 100644 --- a/include/mcl/scope_exit.hpp +++ b/include/mcl/scope_exit.hpp @@ -20,8 +20,10 @@ template class scope_exit final { public: explicit scope_exit(Function&& fn) - : function(std::move(fn)) {} - ~scope_exit() noexcept { + : function(std::move(fn)) {} + + ~scope_exit() noexcept + { function(); } @@ -33,8 +35,10 @@ template class scope_fail final { public: explicit scope_fail(Function&& fn) - : function(std::move(fn)), exception_count(std::uncaught_exceptions()) {} - ~scope_fail() noexcept { + : function(std::move(fn)), exception_count(std::uncaught_exceptions()) {} + + ~scope_fail() noexcept + { if (std::uncaught_exceptions() > exception_count) { function(); } @@ -49,8 +53,10 @@ template class scope_success final { public: explicit scope_success(Function&& fn) - : function(std::move(fn)), exception_count(std::uncaught_exceptions()) {} - ~scope_success() { + : function(std::move(fn)), exception_count(std::uncaught_exceptions()) {} + + ~scope_success() + { if (std::uncaught_exceptions() <= exception_count) { function(); } @@ -64,17 +70,20 @@ private: // We use ->* here as it has the highest precedence of the operators we can use. template -auto operator->*(scope_exit_tag, Function&& function) { +auto operator->*(scope_exit_tag, Function&& function) +{ return scope_exit>{std::forward(function)}; } template -auto operator->*(scope_fail_tag, Function&& function) { +auto operator->*(scope_fail_tag, Function&& function) +{ return scope_fail>{std::forward(function)}; } template -auto operator->*(scope_success_tag, Function&& function) { +auto operator->*(scope_success_tag, Function&& function) +{ return scope_success>{std::forward(function)}; } diff --git a/src/assert.cpp b/src/assert.cpp index 9c42260..1e64ea9 100644 --- a/src/assert.cpp +++ b/src/assert.cpp @@ -11,7 +11,8 @@ namespace mcl::detail { -[[noreturn]] void assert_terminate_impl(fmt::string_view msg, fmt::format_args args) { +[[noreturn]] void assert_terminate_impl(fmt::string_view msg, fmt::format_args args) +{ fmt::print(stderr, "assertion failed: "); fmt::vprint(stderr, msg, args); std::fflush(stderr); diff --git a/tests/bit/bit_field_tests.cpp b/tests/bit/bit_field_tests.cpp index fba31eb..42b88c1 100644 --- a/tests/bit/bit_field_tests.cpp +++ b/tests/bit/bit_field_tests.cpp @@ -9,7 +9,8 @@ #include #include -TEST_CASE("mcl::bit::ones", "[bit]") { +TEST_CASE("mcl::bit::ones", "[bit]") +{ const std::array cases{ std::make_tuple(0, 0x00), std::make_tuple(1, 0x01),