diff options
| -rw-r--r-- | CMakeLists.txt | 17 | ||||
| -rw-r--r-- | arch/x86_64/src/boot/initialize_runtime.cpp | 4 | ||||
| -rw-r--r-- | arch/x86_64/src/memory/region_allocator.cpp | 6 | ||||
| -rw-r--r-- | arch/x86_64/src/vga/text.cpp | 6 |
4 files changed, 25 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d45997..8e53923 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,12 @@ include("ElfTransformations") include("GenerateBootableIso") #[============================================================================[ +# Global Build System Options +#]============================================================================] + +option(TEACHOS_ENABLE_LINTING "Enable linting during build" ON) + +#[============================================================================[ # Global Build System Configuration #]============================================================================] @@ -32,6 +38,17 @@ add_compile_options( ) #[============================================================================[ +# Global Linting Configuration +#]============================================================================] + +find_program(CLANG_TIDY_EXE "clang-tidy") + +if(CLANG_TIDY_EXE AND TEACHOS_ENABLE_LINTING) + set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}") + set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}") +endif() + +#[============================================================================[ # Kernel Executable #]============================================================================] diff --git a/arch/x86_64/src/boot/initialize_runtime.cpp b/arch/x86_64/src/boot/initialize_runtime.cpp index 70172c9..46dd5e4 100644 --- a/arch/x86_64/src/boot/initialize_runtime.cpp +++ b/arch/x86_64/src/boot/initialize_runtime.cpp @@ -16,8 +16,8 @@ extern "C" auto constructors = std::span{&__ctors_start, &__ctors_end}; auto initializers = std::span{&__init_array_start, &__init_array_end}; - auto apply_invoke = [](auto invokable) { - return std::invoke(invokable); + auto apply_invoke = [](auto invokable) -> void { + std::invoke(invokable); }; std::ranges::for_each(constructors, apply_invoke); diff --git a/arch/x86_64/src/memory/region_allocator.cpp b/arch/x86_64/src/memory/region_allocator.cpp index a0579a3..8ea76c6 100644 --- a/arch/x86_64/src/memory/region_allocator.cpp +++ b/arch/x86_64/src/memory/region_allocator.cpp @@ -40,10 +40,10 @@ namespace teachos::memory::x86_64 m_current_region.reset(); auto next_area_with_free_frames = m_memory_map | std::views::filter(&multiboot2::memory_map::region::available) | - std::views::filter([next = m_next_frame](auto const & region) { return last_frame(region) >= next; }); + std::views::filter([next = m_next_frame](auto const & region) -> bool { return last_frame(region) >= next; }); - auto lowest_region_with_free_frames = - std::ranges::min_element(next_area_with_free_frames, [](auto lhs, auto rhs) { return lhs.base < rhs.base; }); + auto lowest_region_with_free_frames = std::ranges::min_element( + next_area_with_free_frames, [](auto lhs, auto rhs) -> bool { return lhs.base < rhs.base; }); if (lowest_region_with_free_frames != next_area_with_free_frames.end()) { diff --git a/arch/x86_64/src/vga/text.cpp b/arch/x86_64/src/vga/text.cpp index 0e0d353..6ecffa3 100644 --- a/arch/x86_64/src/vga/text.cpp +++ b/arch/x86_64/src/vga/text.cpp @@ -48,7 +48,7 @@ namespace teachos::vga::x86_64::text auto current_line = buffer_offset / DEFAULT_TEXT_BUFFER_WIDTH; auto next_line = current_line + 1; - if (next_line >= DEFAULT_TEXT_BUFFER_HEIGHT) + if (std::cmp_greater_equal(next_line, DEFAULT_TEXT_BUFFER_HEIGHT)) { auto begin = vga_buffer_pointer + DEFAULT_TEXT_BUFFER_WIDTH; auto end = vga_buffer_pointer + DEFAULT_TEXT_BUFFER_WIDTH * DEFAULT_TEXT_BUFFER_HEIGHT; @@ -63,12 +63,12 @@ namespace teachos::vga::x86_64::text auto device::write(std::string_view code_points, attribute attribute) -> void { - std::ranges::for_each(code_points, [&](auto code_point) { write_char(code_point, attribute); }); + std::ranges::for_each(code_points, [&](auto code_point) -> void { write_char(code_point, attribute); }); } auto device::writeln(std::string_view code_points, attribute attribute) -> void { - std::ranges::for_each(code_points, [&](auto code_point) { write_char(code_point, attribute); }); + std::ranges::for_each(code_points, [&](auto code_point) -> void { write_char(code_point, attribute); }); newline(); } |
