From 9b32c1d02abeefe6b1dcb0e4dd00ac06975615d3 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 3 Sep 2026 13:53:58 +0200 Subject: chore: add missing return types --- arch/x86_64/arch/cpu/interrupts.cpp | 7 +++---- arch/x86_64/arch/memory/region_allocator.cpp | 3 ++- arch/x86_64/kapi/memory.cpp | 2 +- libs/kstd/kstd/bits/basic_string.hpp | 16 ++++++++++------ libs/kstd/kstd/bits/format/error.hpp | 6 ++++-- libs/kstd/kstd/bits/format/formatter.hpp | 6 +++--- libs/kstd/kstd/vector.hpp | 12 ++++++------ 7 files changed, 29 insertions(+), 23 deletions(-) diff --git a/arch/x86_64/arch/cpu/interrupts.cpp b/arch/x86_64/arch/cpu/interrupts.cpp index c825e8ab..2fdc4671 100644 --- a/arch/x86_64/arch/cpu/interrupts.cpp +++ b/arch/x86_64/arch/cpu/interrupts.cpp @@ -50,7 +50,7 @@ namespace arch::cpu constexpr auto pic_master_irq_end = pic_master_irq_start + 8; constexpr auto pic_slave_irq_start = pic_master_irq_end; - constexpr auto to_exception_type(exception e) + constexpr auto to_exception_type(exception e) -> enum kapi::cpu::exception::type { switch (e) { @@ -75,7 +75,7 @@ namespace arch::cpu } } - constexpr auto has_error_code(exception e) + constexpr auto has_error_code(exception e) -> bool { switch (e) { @@ -155,8 +155,7 @@ namespace arch::cpu if (kapi::interrupts::dispatch(irq_number) == kapi::interrupts::status::unhandled) { - kstd::println(kstd::print_sink::stderr, "[ARCH:CPU] Unhandled interrupt {:#04x} (IRQ{})", number, - irq_number); + kstd::println(kstd::print_sink::stderr, "[ARCH:CPU] Unhandled interrupt {:#04x} (IRQ{})", number, irq_number); } acknowledge_pic_interrupt(frame); diff --git a/arch/x86_64/arch/memory/region_allocator.cpp b/arch/x86_64/arch/memory/region_allocator.cpp index ece492f3..b78924d8 100644 --- a/arch/x86_64/arch/memory/region_allocator.cpp +++ b/arch/x86_64/arch/memory/region_allocator.cpp @@ -15,12 +15,13 @@ namespace arch::memory { namespace { - constexpr auto last_frame(multiboot2::memory_map::region const & region) + constexpr auto last_frame(multiboot2::memory_map::region const & region) -> kapi::memory::frame { return kapi::memory::frame::containing(kapi::memory::physical_address{region.base + region.size_in_B - 1}); } constexpr auto falls_within(kapi::memory::frame candidate, kapi::memory::frame start, kapi::memory::frame end) + -> bool { return candidate >= start && candidate <= end; } diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp index 9cf955e5..03c5107c 100644 --- a/arch/x86_64/kapi/memory.cpp +++ b/arch/x86_64/kapi/memory.cpp @@ -40,7 +40,7 @@ namespace kapi::memory auto constinit higher_half_mapper = std::optional{}; //! Instantiate a basic, memory region based, early frame allocator for remapping. - auto collect_memory_information() + auto collect_memory_information() -> arch::memory::region_allocator::memory_information { auto memory_map = boot::bootstrap_information.mbi->maybe_memory_map(); if (!memory_map) diff --git a/libs/kstd/kstd/bits/basic_string.hpp b/libs/kstd/kstd/bits/basic_string.hpp index 1f8b60af..a2dd7f15 100644 --- a/libs/kstd/kstd/bits/basic_string.hpp +++ b/libs/kstd/kstd/bits/basic_string.hpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -1329,23 +1328,27 @@ namespace kstd } [[nodiscard]] constexpr friend auto operator<=>(basic_string const & lhs, basic_string const & rhs) noexcept + -> traits_type::comparison_category { return std::lexicographical_compare_three_way(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs), std::cend(rhs)); } [[nodiscard]] constexpr friend auto operator<=>(basic_string const & lhs, std::basic_string_view const & rhs) noexcept + -> traits_type::comparison_category { return std::lexicographical_compare_three_way(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs), std::cend(rhs)); } [[nodiscard]] constexpr friend auto operator<=>(std::basic_string_view const & lhs, - basic_string const & rhs) noexcept -> std::strong_ordering + basic_string const & rhs) noexcept + -> traits_type::comparison_category { return std::lexicographical_compare_three_way(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs), std::cend(rhs)); } [[nodiscard]] constexpr friend auto operator<=>(basic_string const & lhs, const_pointer rhs) noexcept + -> traits_type::comparison_category { if (rhs == nullptr) { @@ -1356,6 +1359,7 @@ namespace kstd } [[nodiscard]] constexpr friend auto operator<=>(const_pointer lhs, basic_string const & rhs) noexcept + -> traits_type::comparison_category { if (rhs == nullptr) { @@ -1443,7 +1447,7 @@ namespace kstd } [[nodiscard]] constexpr auto static do_compare(std::basic_string_view lhs, - std::basic_string_view rhs) noexcept + std::basic_string_view rhs) noexcept -> int { // clang-tidy is not smart enough to see that whe are, in essence, passing the correct length. // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage) @@ -1466,7 +1470,7 @@ namespace kstd //! Copy elements from a range described by an input iterator pair. //! //! @param first An iterator pointing to the first element to copy. - //! @param last An iterator pointing beyond the last elemento copy. + //! @param last An iterator pointing beyond the last element to copy. template requires std::input_iterator> constexpr auto forward_from(InputIterator && first, Sentinel last) -> void @@ -1496,7 +1500,7 @@ namespace kstd //! Copy elements from a range described by a forward iterator pair. //! //! @param first An iterator pointing to the first element to copy. - //! @param last An iterator pointing beyond the last elemento copy. + //! @param last An iterator pointing beyond the last element to copy. template requires std::forward_iterator> constexpr auto forward_from(ForwardIterator && first, Sentinel last) -> void @@ -1551,7 +1555,7 @@ namespace kstd //! Release the current buffer of this string. //! //! This function can be called even if this string is currently in tis SSO state. - [[nodiscard]] constexpr auto release_buffer() + constexpr auto release_buffer() -> void { if (!in_sso_state()) { diff --git a/libs/kstd/kstd/bits/format/error.hpp b/libs/kstd/kstd/bits/format/error.hpp index 30cb7523..1442d2be 100644 --- a/libs/kstd/kstd/bits/format/error.hpp +++ b/libs/kstd/kstd/bits/format/error.hpp @@ -3,14 +3,16 @@ #include +#include + namespace kstd::bits::format { - constexpr auto error(char const * message) -> void + constexpr auto error(std::string_view message) -> void { if consteval { - extern void compile_time_format_error_triggered(char const *); + extern auto compile_time_format_error_triggered(std::string_view)->void; compile_time_format_error_triggered(message); } else diff --git a/libs/kstd/kstd/bits/format/formatter.hpp b/libs/kstd/kstd/bits/format/formatter.hpp index c26907b2..5f1d89c6 100644 --- a/libs/kstd/kstd/bits/format/formatter.hpp +++ b/libs/kstd/kstd/bits/format/formatter.hpp @@ -30,13 +30,13 @@ namespace kstd m_separator = sep; } - constexpr auto set_brackets(std::string_view opening, std::string_view closing) + constexpr auto set_brackets(std::string_view opening, std::string_view closing) -> void { m_prefix = opening; m_suffix = closing; } - constexpr auto parse(format_parse_context & context) + constexpr auto parse(format_parse_context & context) -> format_parse_context::iterator { auto it = context.begin(); auto const end = context.end(); @@ -63,7 +63,7 @@ namespace kstd } template - auto format(Range const & range, format_context & context) + auto format(Range const & range, format_context & context) -> void { context.push(m_prefix); diff --git a/libs/kstd/kstd/vector.hpp b/libs/kstd/kstd/vector.hpp index 5a56381b..fc3020c7 100644 --- a/libs/kstd/kstd/vector.hpp +++ b/libs/kstd/kstd/vector.hpp @@ -898,7 +898,7 @@ namespace kstd } //! Release the memory of this vector. - constexpr auto deallocate() + constexpr auto deallocate() -> void { if (m_data) { @@ -914,7 +914,7 @@ namespace kstd //! @param position The position to insert the element at. //! @param value The value to insert. template - constexpr auto do_insert(const_iterator position, U && value) + constexpr auto do_insert(const_iterator position, U && value) -> iterator { auto prefix_size = std::ranges::distance(cbegin(), position); if (position == cend()) @@ -969,7 +969,7 @@ namespace kstd //! @param to The start of the target range inside this vector. //! @param count The number of elements to copy template - constexpr auto uninitialized_copy_with_allocator(SourceIterator from, iterator to, size_type count) + constexpr auto uninitialized_copy_with_allocator(SourceIterator from, iterator to, size_type count) -> void { for (auto i = 0uz; i < count; ++i) { @@ -983,7 +983,7 @@ namespace kstd //! @param to The start of the target range inside this vector. //! @param count The number of elements to copy template - constexpr auto uninitialized_move_with_allocator(SourceIterator from, iterator to, size_type count) + constexpr auto uninitialized_move_with_allocator(SourceIterator from, iterator to, size_type count) -> void { for (auto i = 0uz; i < count; ++i) { @@ -1004,7 +1004,7 @@ namespace kstd } //! Shift all elements, starting the given position, one position back inside the vector. - constexpr auto shift_back(iterator starting_at) + constexpr auto shift_back(iterator starting_at) -> void { std::allocator_traits::construct(m_allocator, end(), std::move(*(end() - 1))); std::ranges::move_backward(starting_at, end() - 1, end()); @@ -1015,7 +1015,7 @@ namespace kstd //! @param position The position to insert the element at. //! @param args The constructor arguments for the inserted element. template - constexpr auto reallocate_and_insert(iterator position, Args &&... args) + constexpr auto reallocate_and_insert(iterator position, Args &&... args) -> void { auto prefix_size = std::ranges::distance(begin(), position); auto suffix_size = std::ranges::distance(position, end()); -- cgit v1.2.3