From b4ff67c8a9bebd99eb3c06ea141fe0f1b8feb5a4 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 22 Dec 2025 14:53:33 +0100 Subject: chore: clean up linter warnings --- libs/kstd/include/kstd/asm_ptr | 1 + libs/kstd/include/kstd/bits/formatter.hpp | 1 - libs/kstd/include/kstd/bits/shared_ptr.hpp | 5 +++-- libs/kstd/include/kstd/stack | 1 + libs/kstd/include/kstd/vector | 17 +++++++++-------- libs/multiboot2/include/multiboot2/impl/tag.hpp | 3 +-- 6 files changed, 15 insertions(+), 13 deletions(-) (limited to 'libs') diff --git a/libs/kstd/include/kstd/asm_ptr b/libs/kstd/include/kstd/asm_ptr index e8636c3..c06a8b5 100644 --- a/libs/kstd/include/kstd/asm_ptr +++ b/libs/kstd/include/kstd/asm_ptr @@ -2,6 +2,7 @@ #define KSTD_ASM_POINTER_HPP #include +#include namespace kstd { diff --git a/libs/kstd/include/kstd/bits/formatter.hpp b/libs/kstd/include/kstd/bits/formatter.hpp index 4d983f3..eadc0ef 100644 --- a/libs/kstd/include/kstd/bits/formatter.hpp +++ b/libs/kstd/include/kstd/bits/formatter.hpp @@ -278,7 +278,6 @@ namespace kstd { if (index >= m_number_of_args) return {.value = nullptr, .format = nullptr}; - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) return m_args[index]; } diff --git a/libs/kstd/include/kstd/bits/shared_ptr.hpp b/libs/kstd/include/kstd/bits/shared_ptr.hpp index 4bcf499..8caae3b 100644 --- a/libs/kstd/include/kstd/bits/shared_ptr.hpp +++ b/libs/kstd/include/kstd/bits/shared_ptr.hpp @@ -2,6 +2,7 @@ #define KSTD_BITS_SHARED_PTR_HPP #include +#include namespace kstd { @@ -72,7 +73,7 @@ namespace kstd * @return Reference to this shared pointer. */ [[gnu::section(".stl_text")]] - shared_ptr & operator=(shared_ptr const & other) + auto operator=(shared_ptr const & other) -> shared_ptr & { if (this != &other) { @@ -97,7 +98,7 @@ namespace kstd * @return Reference to this shared pointer. */ [[gnu::section(".stl_text")]] - shared_ptr & operator=(shared_ptr && other) noexcept + auto operator=(shared_ptr && other) noexcept -> shared_ptr & { if (this != &other) { diff --git a/libs/kstd/include/kstd/stack b/libs/kstd/include/kstd/stack index 8cd208a..8dc8e10 100644 --- a/libs/kstd/include/kstd/stack +++ b/libs/kstd/include/kstd/stack @@ -2,6 +2,7 @@ #define KSTD_STACK_HPP #include "kstd/vector" +#include #include namespace kstd diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/include/kstd/vector index 9d96eb8..bbb2287 100644 --- a/libs/kstd/include/kstd/vector +++ b/libs/kstd/include/kstd/vector @@ -1,9 +1,11 @@ #ifndef KSTD_VECTOR_HPP #define KSTD_VECTOR_HPP -#include "bits/os.hpp" +#include #include +#include +#include namespace kstd { @@ -62,14 +64,14 @@ namespace kstd /** * @brief Construct data by copying all elements from the initializer list. * - * @param initalizer_list List we want to copy all elements from. + * @param initializer_list List we want to copy all elements from. */ - explicit vector(std::initializer_list initalizer_list) - : _size(initalizer_list.size()) - , _capacity(initalizer_list.size()) + explicit vector(std::initializer_list initializer_list) + : _size(initializer_list.size()) + , _capacity(initializer_list.size()) , _data(new value_type[_capacity]{}) { - std::ranges::copy(initalizer_list, _data); + std::ranges::copy(initializer_list, _data); } /** @@ -83,9 +85,8 @@ namespace kstd vector(vector const & other) : _size(other._size) , _capacity(other._capacity) + , _data(new value_type[_capacity]{}) { - delete[] _data; - _data = new value_type[_capacity]{}; std::ranges::copy(other, _data); } diff --git a/libs/multiboot2/include/multiboot2/impl/tag.hpp b/libs/multiboot2/include/multiboot2/impl/tag.hpp index 3d0cea5..708cda4 100644 --- a/libs/multiboot2/include/multiboot2/impl/tag.hpp +++ b/libs/multiboot2/include/multiboot2/impl/tag.hpp @@ -29,7 +29,6 @@ namespace multiboot2::impl [[nodiscard]] auto full_size() const noexcept -> std::size_t { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) return (m_size + 7) & (~7); } @@ -67,7 +66,7 @@ namespace multiboot2::impl explicit tag(tag_header const * header) requires(sizeof(tag) > sizeof(tag_header)) : tag_header{header} - , Data{*std::bit_cast(header + 1)} // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + , Data{*std::bit_cast(header + 1)} {} explicit tag(tag_header const * header) -- cgit v1.2.3