aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/kstd/include/kstd/bits/shared_ptr.hpp6
-rw-r--r--libs/kstd/include/kstd/bits/unique_ptr.hpp6
-rw-r--r--libs/kstd/src/libc/stdlib.cpp5
-rw-r--r--libs/kstd/src/libc/string.cpp2
-rw-r--r--libs/kstd/src/mutex.cpp10
-rw-r--r--libs/multiboot2/include/multiboot2/constants.hpp2
-rw-r--r--libs/multiboot2/include/multiboot2/impl/data.hpp7
-rw-r--r--libs/multiboot2/include/multiboot2/impl/iterator.hpp19
-rw-r--r--libs/multiboot2/include/multiboot2/impl/tag.hpp34
-rw-r--r--libs/multiboot2/include/multiboot2/information.hpp102
10 files changed, 136 insertions, 57 deletions
diff --git a/libs/kstd/include/kstd/bits/shared_ptr.hpp b/libs/kstd/include/kstd/bits/shared_ptr.hpp
index d41b165..251c187 100644
--- a/libs/kstd/include/kstd/bits/shared_ptr.hpp
+++ b/libs/kstd/include/kstd/bits/shared_ptr.hpp
@@ -39,7 +39,7 @@ namespace kstd
* @param other The shared_ptr to copy from.
*/
[[gnu::section(".stl_text")]]
- shared_ptr(const shared_ptr & other)
+ shared_ptr(shared_ptr const & other)
: pointer(other.pointer)
, ref_count(other.ref_count)
{
@@ -72,7 +72,7 @@ namespace kstd
* @return Reference to this shared pointer.
*/
[[gnu::section(".stl_text")]]
- shared_ptr & operator=(const shared_ptr & other)
+ shared_ptr & operator=(shared_ptr const & other)
{
if (this != &other)
{
@@ -216,7 +216,7 @@ namespace kstd
* @brief Defaulted three-way comparator operator.
*/
[[gnu::section(".stl_text")]]
- auto operator<=>(const shared_ptr & other) const = default;
+ auto operator<=>(shared_ptr const & other) const = default;
private:
/**
diff --git a/libs/kstd/include/kstd/bits/unique_ptr.hpp b/libs/kstd/include/kstd/bits/unique_ptr.hpp
index 1932913..5f54848 100644
--- a/libs/kstd/include/kstd/bits/unique_ptr.hpp
+++ b/libs/kstd/include/kstd/bits/unique_ptr.hpp
@@ -38,12 +38,12 @@ namespace kstd
/**
* @brief Deleted copy constructor to enforce unique ownership.
*/
- unique_ptr(const unique_ptr &) = delete;
+ unique_ptr(unique_ptr const &) = delete;
/**
* @brief Deleted copy assignment operator to enforce unique ownership.
*/
- auto operator=(const unique_ptr &) -> unique_ptr & = delete;
+ auto operator=(unique_ptr const &) -> unique_ptr & = delete;
/**
* @brief Move constructor.
@@ -167,7 +167,7 @@ namespace kstd
* @brief Defaulted three-way comparator operator.
*/
[[gnu::section(".stl_text")]]
- auto operator<=>(const unique_ptr & other) const = default;
+ auto operator<=>(unique_ptr const & other) const = default;
private:
T * pointer; ///< The managed pointer.
diff --git a/libs/kstd/src/libc/stdlib.cpp b/libs/kstd/src/libc/stdlib.cpp
index fe1bc95..752e616 100644
--- a/libs/kstd/src/libc/stdlib.cpp
+++ b/libs/kstd/src/libc/stdlib.cpp
@@ -5,7 +5,10 @@ namespace kstd::libc
extern "C"
{
- [[noreturn]] auto abort() -> void { kstd::os::abort(); }
+ [[noreturn]] auto abort() -> void
+ {
+ kstd::os::abort();
+ }
}
} // namespace kstd::libc \ No newline at end of file
diff --git a/libs/kstd/src/libc/string.cpp b/libs/kstd/src/libc/string.cpp
index c6b3847..a42aedc 100644
--- a/libs/kstd/src/libc/string.cpp
+++ b/libs/kstd/src/libc/string.cpp
@@ -6,7 +6,7 @@ namespace kstd::libc
extern "C"
{
- auto strlen(const char * string) -> std::size_t
+ auto strlen(char const * string) -> std::size_t
{
return std::distance(string, std::ranges::find(string, nullptr, '\0'));
}
diff --git a/libs/kstd/src/mutex.cpp b/libs/kstd/src/mutex.cpp
index 137ebc0..da1357f 100644
--- a/libs/kstd/src/mutex.cpp
+++ b/libs/kstd/src/mutex.cpp
@@ -10,7 +10,13 @@ namespace kstd
}
}
- auto mutex::try_lock() -> bool { return !locked.exchange(true, std::memory_order_acquire); }
+ auto mutex::try_lock() -> bool
+ {
+ return !locked.exchange(true, std::memory_order_acquire);
+ }
- auto mutex::unlock() -> void { locked.store(false, std::memory_order_release); }
+ auto mutex::unlock() -> void
+ {
+ locked.store(false, std::memory_order_release);
+ }
} // namespace kstd
diff --git a/libs/multiboot2/include/multiboot2/constants.hpp b/libs/multiboot2/include/multiboot2/constants.hpp
index 30d52d0..0f6b82f 100644
--- a/libs/multiboot2/include/multiboot2/constants.hpp
+++ b/libs/multiboot2/include/multiboot2/constants.hpp
@@ -13,7 +13,7 @@ namespace multiboot2
using impl::memory_type;
using impl::tag_id;
- auto constexpr inline header_magic = std::uint32_t{0xe85250d6};
+ constexpr auto inline header_magic = std::uint32_t{0xe852'50d6};
} // namespace multiboot2
diff --git a/libs/multiboot2/include/multiboot2/impl/data.hpp b/libs/multiboot2/include/multiboot2/impl/data.hpp
index a5f2e14..3cda162 100644
--- a/libs/multiboot2/include/multiboot2/impl/data.hpp
+++ b/libs/multiboot2/include/multiboot2/impl/data.hpp
@@ -10,7 +10,7 @@ namespace multiboot2::impl
template<auto Id>
struct tag_data
{
- auto constexpr inline static id = Id;
+ constexpr auto static inline id = Id;
};
/**
@@ -94,7 +94,10 @@ namespace multiboot2::impl
/**
* @brief Check if the memory described by this region is available for use.
*/
- auto constexpr available() const noexcept { return type == memory_type::AVAILABLE; }
+ constexpr auto available() const noexcept
+ {
+ return type == memory_type::AVAILABLE;
+ }
/**
* @brief Start address of this region
diff --git a/libs/multiboot2/include/multiboot2/impl/iterator.hpp b/libs/multiboot2/include/multiboot2/impl/iterator.hpp
index e82326d..f8955cb 100644
--- a/libs/multiboot2/include/multiboot2/impl/iterator.hpp
+++ b/libs/multiboot2/include/multiboot2/impl/iterator.hpp
@@ -23,16 +23,21 @@ namespace multiboot2::impl
constexpr explicit information_iterator(impl::tag_header const * offset)
: m_current(offset)
- {
- }
+ {}
- auto constexpr operator==(information_iterator const &) const noexcept -> bool = default;
+ constexpr auto operator==(information_iterator const &) const noexcept -> bool = default;
- auto constexpr operator*() const noexcept -> reference { return *(m_current.value()); }
+ constexpr auto operator*() const noexcept -> reference
+ {
+ return *(m_current.value());
+ }
- auto constexpr operator->() const noexcept -> pointer { return m_current.value(); }
+ constexpr auto operator->() const noexcept -> pointer
+ {
+ return m_current.value();
+ }
- auto constexpr operator++() noexcept -> information_iterator &
+ constexpr auto operator++() noexcept -> information_iterator &
{
if (m_current)
{
@@ -48,7 +53,7 @@ namespace multiboot2::impl
return *this;
}
- auto constexpr operator++(int) noexcept -> information_iterator
+ constexpr auto operator++(int) noexcept -> information_iterator
{
auto copy = *this;
++(*this);
diff --git a/libs/multiboot2/include/multiboot2/impl/tag.hpp b/libs/multiboot2/include/multiboot2/impl/tag.hpp
index f7471a4..f151b54 100644
--- a/libs/multiboot2/include/multiboot2/impl/tag.hpp
+++ b/libs/multiboot2/include/multiboot2/impl/tag.hpp
@@ -18,24 +18,31 @@ namespace multiboot2::impl
tag_header()
: m_id{}
, m_size{}
- {
- }
+ {}
tag_header(tag_header const * data)
: tag_header{*data}
+ {}
+
+ auto full_size() const noexcept -> std::size_t
{
+ return (m_size + 7) & (~7);
}
- auto full_size() const noexcept -> std::size_t { return (m_size + 7) & (~7); }
-
- auto information_id() const noexcept -> impl::information_id const & { return m_id; }
+ auto information_id() const noexcept -> impl::information_id const &
+ {
+ return m_id;
+ }
auto next() const noexcept -> tag_header const *
{
return std::bit_cast<tag_header const *>(std::bit_cast<std::byte const *>(this) + full_size());
}
- auto unaligned_size() const noexcept -> std::uint32_t { return m_size; }
+ auto unaligned_size() const noexcept -> std::uint32_t
+ {
+ return m_size;
+ }
protected:
impl::information_id const m_id;
@@ -51,22 +58,19 @@ namespace multiboot2::impl
tag()
: tag_header{}
, Data{}
- {
- }
+ {}
explicit tag(tag_header const * header)
requires(sizeof(tag) > sizeof(tag_header))
: tag_header{header}
, Data{*std::bit_cast<Data const *>(header + 1)}
- {
- }
+ {}
explicit tag(tag_header const * header)
requires(sizeof(tag) == sizeof(tag_header))
: tag_header{header}
, Data{}
- {
- }
+ {}
};
/**
@@ -80,14 +84,12 @@ namespace multiboot2::impl
vla_tag()
: tag<Data>{}
, m_vla{}
- {
- }
+ {}
explicit vla_tag(tag_header const * header)
: tag<Data>{header}
, m_vla{vla_start(header), vla_size(header)}
- {
- }
+ {}
protected:
auto static vla_start(tag_header const * header) noexcept -> VlaData *
diff --git a/libs/multiboot2/include/multiboot2/information.hpp b/libs/multiboot2/include/multiboot2/information.hpp
index 04ba183..ac03069 100644
--- a/libs/multiboot2/include/multiboot2/information.hpp
+++ b/libs/multiboot2/include/multiboot2/information.hpp
@@ -41,7 +41,10 @@ namespace multiboot2
/**
* @brief The command line string
*/
- auto string() const noexcept -> range_type { return m_vla; }
+ auto string() const noexcept -> range_type
+ {
+ return m_vla;
+ }
};
/**
@@ -53,7 +56,10 @@ namespace multiboot2
using iterator = range_type::iterator;
- auto data() const noexcept -> range_type { return m_vla; }
+ auto data() const noexcept -> range_type
+ {
+ return m_vla;
+ }
};
/**
@@ -66,7 +72,10 @@ namespace multiboot2
/**
* @brief The name of the bootloader
*/
- auto string() const noexcept -> std::string_view { return m_vla; }
+ auto string() const noexcept -> std::string_view
+ {
+ return m_vla;
+ }
};
/**
@@ -78,14 +87,23 @@ namespace multiboot2
using iterator = range_type::iterator;
- auto begin() const noexcept -> iterator { return regions().begin(); }
+ auto begin() const noexcept -> iterator
+ {
+ return regions().begin();
+ }
- auto end() const noexcept -> iterator { return regions().end(); }
+ auto end() const noexcept -> iterator
+ {
+ return regions().end();
+ }
/**
* @brief The available memory regions
*/
- auto regions() const noexcept -> range_type { return m_vla; }
+ auto regions() const noexcept -> range_type
+ {
+ return m_vla;
+ }
};
struct information_view
@@ -95,13 +113,22 @@ namespace multiboot2
using pointer = impl::information_iterator::pointer;
using reference = impl::information_iterator::reference;
- auto size_bytes() const noexcept -> std::size_t { return m_size; }
+ auto size_bytes() const noexcept -> std::size_t
+ {
+ return m_size;
+ }
// Range access
- auto begin() const noexcept -> iterator { return iterator{&m_tags}; }
+ auto begin() const noexcept -> iterator
+ {
+ return iterator{&m_tags};
+ }
- auto end() const noexcept -> iterator { return iterator{}; }
+ auto end() const noexcept -> iterator
+ {
+ return iterator{};
+ }
// Tag access
@@ -111,36 +138,69 @@ namespace multiboot2
return get<Tag>().has_value();
}
- auto maybe_basic_memory() const noexcept -> std::optional<basic_memory> { return get<multiboot2::basic_memory>(); }
+ auto maybe_basic_memory() const noexcept -> std::optional<basic_memory>
+ {
+ return get<multiboot2::basic_memory>();
+ }
- auto basic_memory() const -> basic_memory { return maybe_basic_memory().value(); }
+ auto basic_memory() const -> basic_memory
+ {
+ return maybe_basic_memory().value();
+ }
auto maybe_bios_boot_device() const noexcept -> std::optional<bios_boot_device>
{
return get<multiboot2::bios_boot_device>();
}
- auto bios_boot_device() const -> bios_boot_device { return maybe_bios_boot_device().value(); }
+ auto bios_boot_device() const -> bios_boot_device
+ {
+ return maybe_bios_boot_device().value();
+ }
- auto maybe_command_line() const noexcept -> std::optional<command_line> { return get<multiboot2::command_line>(); }
+ auto maybe_command_line() const noexcept -> std::optional<command_line>
+ {
+ return get<multiboot2::command_line>();
+ }
- auto command_line() const -> command_line { return maybe_command_line().value(); }
+ auto command_line() const -> command_line
+ {
+ return maybe_command_line().value();
+ }
- auto maybe_elf_symbols() const noexcept -> std::optional<elf_symbols> { return get<multiboot2::elf_symbols>(); }
+ auto maybe_elf_symbols() const noexcept -> std::optional<elf_symbols>
+ {
+ return get<multiboot2::elf_symbols>();
+ }
- auto elf_symbols() const -> elf_symbols { return maybe_elf_symbols().value(); }
+ auto elf_symbols() const -> elf_symbols
+ {
+ return maybe_elf_symbols().value();
+ }
- auto maybe_loader_name() const noexcept -> std::optional<loader_name> { return get<multiboot2::loader_name>(); }
+ auto maybe_loader_name() const noexcept -> std::optional<loader_name>
+ {
+ return get<multiboot2::loader_name>();
+ }
- auto loader_name() const -> loader_name { return maybe_loader_name().value(); }
+ auto loader_name() const -> loader_name
+ {
+ return maybe_loader_name().value();
+ }
- auto maybe_memory_map() const noexcept -> std::optional<memory_map> { return get<multiboot2::memory_map>(); }
+ auto maybe_memory_map() const noexcept -> std::optional<memory_map>
+ {
+ return get<multiboot2::memory_map>();
+ }
- auto memory_map() const -> memory_map { return maybe_memory_map().value(); }
+ auto memory_map() const -> memory_map
+ {
+ return maybe_memory_map().value();
+ }
private:
template<typename Tag>
- auto constexpr get() const noexcept -> std::optional<Tag>
+ constexpr auto get() const noexcept -> std::optional<Tag>
{
if (auto found = std::ranges::find_if(*this, [](auto tag) { return tag.information_id() == Tag::id; });
found != end())