diff --git a/AK/Time.h b/AK/Time.h index 1813822b3ae..580f26e9c4c 100644 --- a/AK/Time.h +++ b/AK/Time.h @@ -484,10 +484,7 @@ public: [[nodiscard]] static MonotonicTime now_coarse(); #endif - // clang-format off - // Clang-format likes to expand this function for some reason. [[nodiscard]] i64 seconds() const { return m_offset.to_seconds(); } - // clang-format on [[nodiscard]] i64 milliseconds() const { return m_offset.to_milliseconds(); } [[nodiscard]] i64 nanoseconds() const { return m_offset.to_nanoseconds(); } // Never returns a point in the future, since fractional seconds are cut off. diff --git a/Kernel/Arch/aarch64/Processor.cpp b/Kernel/Arch/aarch64/Processor.cpp index 0388fb011b1..23d8968873e 100644 --- a/Kernel/Arch/aarch64/Processor.cpp +++ b/Kernel/Arch/aarch64/Processor.cpp @@ -191,7 +191,6 @@ void ProcessorBase::switch_context(Thread*& from_thread, Thread*& to_thread) // m_in_critical is restored in enter_thread_context from_thread->save_critical(m_in_critical); - // clang-format off asm volatile( "sub sp, sp, #256 \n" "stp x0, x1, [sp, #(0 * 0)] \n" @@ -268,7 +267,6 @@ void ProcessorBase::switch_context(Thread*& from_thread, Thread*& to_thread) [from_thread] "m"(from_thread), [to_thread] "m"(to_thread) : "memory", "x0", "x1", "x2"); - // clang-format on dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); } diff --git a/Kernel/Arch/riscv64/Processor.cpp b/Kernel/Arch/riscv64/Processor.cpp index b67b9c2436e..16a00e6274e 100644 --- a/Kernel/Arch/riscv64/Processor.cpp +++ b/Kernel/Arch/riscv64/Processor.cpp @@ -141,12 +141,10 @@ void ProcessorBase::flush_tlb_local(VirtualAddress vaddr, size_t page_count) { auto addr = vaddr.get(); while (page_count > 0) { - // clang-format off asm volatile("sfence.vma %0" - : - : "r"(addr) - : "memory"); - // clang-format on + : + : "r"(addr) + : "memory"); addr += PAGE_SIZE; page_count--; } @@ -221,7 +219,6 @@ void ProcessorBase::switch_context(Thread*& from_thread, Thread*& to_thread) // m_in_critical is restored in enter_thread_context from_thread->save_critical(m_in_critical); - // clang-format off asm volatile( // Store a RegisterState of from_thread on from_thread's stack "addi sp, sp, -(34 * 8) \n" @@ -338,7 +335,6 @@ void ProcessorBase::switch_context(Thread*& from_thread, Thread*& to_thread) [from_thread] "m"(from_thread), [to_thread] "m"(to_thread) : "memory", "t0", "s1", "a0", "a1"); - // clang-format on dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); } diff --git a/Kernel/Arch/x86_64/DescriptorTable.h b/Kernel/Arch/x86_64/DescriptorTable.h index 80c8d9438ea..8c22bf299a0 100644 --- a/Kernel/Arch/x86_64/DescriptorTable.h +++ b/Kernel/Arch/x86_64/DescriptorTable.h @@ -98,10 +98,7 @@ enum class IDTEntryType { TrapGate32 = 0b1111, }; -// Clang doesn't format this right due to the compiler magic -// clang-format off -struct [[gnu::packed]] IDTEntry -{ +struct [[gnu::packed]] IDTEntry { u16 offset_1; // offset bits 0..15 u16 selector; // a code segment selector in GDT or LDT @@ -147,7 +144,6 @@ struct [[gnu::packed]] IDTEntry return IDTEntryType(type_attr.gate_type); } }; -// clang-format on static_assert(AssertSize()); diff --git a/Kernel/Arch/x86_64/Processor.cpp b/Kernel/Arch/x86_64/Processor.cpp index c4883860644..5da74900762 100644 --- a/Kernel/Arch/x86_64/Processor.cpp +++ b/Kernel/Arch/x86_64/Processor.cpp @@ -951,12 +951,10 @@ void ProcessorBase::flush_tlb_local(VirtualAddress vaddr, size_t page_count) { auto ptr = vaddr.as_ptr(); while (page_count > 0) { - // clang-format off asm volatile("invlpg %0" - : - : "m"(*ptr) - : "memory"); - // clang-format on + : + : "m"(*ptr) + : "memory"); ptr += PAGE_SIZE; page_count--; } diff --git a/Tests/LibGfx/BenchmarkJPEGLoader.cpp b/Tests/LibGfx/BenchmarkJPEGLoader.cpp index 2fd6ff7a974..1522487153a 100644 --- a/Tests/LibGfx/BenchmarkJPEGLoader.cpp +++ b/Tests/LibGfx/BenchmarkJPEGLoader.cpp @@ -14,14 +14,10 @@ # define TEST_INPUT(x) ("test-inputs/" x) #endif -// FIXME: Enable formatting when the patch will be mainstream -// https://github.com/llvm/llvm-project/commit/fd86789962964a98157e8159c3d95cdc241942e3 -// clang-format off auto small_image = Core::File::open(TEST_INPUT("jpg/rgb24.jpg"sv), Core::File::OpenMode::Read).release_value()->read_until_eof().release_value(); auto big_image = Core::File::open(TEST_INPUT("jpg/big_image.jpg"sv), Core::File::OpenMode::Read).release_value()->read_until_eof().release_value(); auto rgb_image = Core::File::open(TEST_INPUT("jpg/rgb_components.jpg"sv), Core::File::OpenMode::Read).release_value()->read_until_eof().release_value(); auto several_scans = Core::File::open(TEST_INPUT("jpg/several_scans.jpg"sv), Core::File::OpenMode::Read).release_value()->read_until_eof().release_value(); -// clang-format on BENCHMARK_CASE(small_image) { diff --git a/Userland/Libraries/LibGPU/Driver.cpp b/Userland/Libraries/LibGPU/Driver.cpp index 74b9bfec3de..ad2bf9cdba9 100644 --- a/Userland/Libraries/LibGPU/Driver.cpp +++ b/Userland/Libraries/LibGPU/Driver.cpp @@ -13,9 +13,7 @@ namespace GPU { // FIXME: Think of a better way to configure these paths. Maybe use ConfigServer? -// clang-format off -static HashMap const s_driver_path_map -{ +static HashMap const s_driver_path_map { #if defined(AK_OS_SERENITY) { "softgpu"sv, "libsoftgpu.so.serenity" }, { "virtgpu"sv, "libvirtgpu.so.serenity" }, @@ -25,7 +23,6 @@ static HashMap const s_driver_path_map { "softgpu"sv, "liblagom-softgpu.so.0" }, #endif }; -// clang-format on static HashMap> s_loaded_drivers; diff --git a/Userland/Libraries/LibWasm/Types.h b/Userland/Libraries/LibWasm/Types.h index aff3feee465..547b8d4b978 100644 --- a/Userland/Libraries/LibWasm/Types.h +++ b/Userland/Libraries/LibWasm/Types.h @@ -466,7 +466,6 @@ public: private: OpCode m_opcode { 0 }; - // clang-format off Variant< BlockType, DataIndex, @@ -495,9 +494,8 @@ private: i32, i64, u128, - u8 // Empty state - > m_arguments; - // clang-format on + u8> // Empty state + m_arguments; }; class CustomSection { diff --git a/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp b/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp index 3af86a8d545..2131ea9253d 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp @@ -539,12 +539,12 @@ JS::NonnullGCPtr DOMMatrix::rotate_axis_angle_self(Optional x JS::NonnullGCPtr DOMMatrix::skew_x_self(double sx) { // 1. Post-multiply a skewX transformation on the current matrix by the specified angle sx in degrees. The 2D skewX matrix is described in CSS Transforms with alpha = sx in degrees. [CSS3-TRANSFORMS] - // clang-format off - Gfx::DoubleMatrix4x4 skew_matrix = { 1, tan(AK::to_radians(sx)), 0, 0, + Gfx::DoubleMatrix4x4 skew_matrix = { + 1, tan(AK::to_radians(sx)), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 1 }; - // clang-format on + 0, 0, 0, 1 + }; m_matrix = m_matrix * skew_matrix; // 3. Return the current matrix. @@ -555,12 +555,12 @@ JS::NonnullGCPtr DOMMatrix::skew_x_self(double sx) JS::NonnullGCPtr DOMMatrix::skew_y_self(double sy) { // 1. Post-multiply a skewX transformation on the current matrix by the specified angle sy in degrees. The 2D skewY matrix is described in CSS Transforms with beta = sy in degrees. [CSS3-TRANSFORMS] - // clang-format off - Gfx::DoubleMatrix4x4 skew_matrix = { 1, 0, 0, 0, + Gfx::DoubleMatrix4x4 skew_matrix = { + 1, 0, 0, 0, tan(AK::to_radians(sy)), 1, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 1 }; - // clang-format on + 0, 0, 0, 1 + }; m_matrix = m_matrix * skew_matrix; // 3. Return the current matrix. diff --git a/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp index 2ac0c7dfa50..173ae2578b2 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp @@ -449,12 +449,12 @@ JS::NonnullGCPtr DOMMatrixReadOnly::flip_x() auto result = DOMMatrix::create_from_dom_matrix_read_only(realm(), *this); // 2. Post-multiply result with new DOMMatrix([-1, 0, 0, 1, 0, 0]). - // clang-format off - Gfx::DoubleMatrix4x4 flip_matrix = { -1, 0, 0, 0, + Gfx::DoubleMatrix4x4 flip_matrix = { + -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 1 }; - // clang-format on + 0, 0, 0, 1 + }; result->m_matrix = result->m_matrix * flip_matrix; // 3. Return result. @@ -468,12 +468,12 @@ JS::NonnullGCPtr DOMMatrixReadOnly::flip_y() auto result = DOMMatrix::create_from_dom_matrix_read_only(realm(), *this); // 2. Post-multiply result with new DOMMatrix([1, 0, 0, -1, 0, 0]). - // clang-format off - Gfx::DoubleMatrix4x4 flip_matrix = { 1, 0, 0, 0, + Gfx::DoubleMatrix4x4 flip_matrix = { + 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 1 }; - // clang-format on + 0, 0, 0, 1 + }; result->m_matrix = result->m_matrix * flip_matrix; // 3. Return result. diff --git a/Userland/Services/LookupServer/MulticastDNS.h b/Userland/Services/LookupServer/MulticastDNS.h index 9c712ba097e..65a5580541e 100644 --- a/Userland/Services/LookupServer/MulticastDNS.h +++ b/Userland/Services/LookupServer/MulticastDNS.h @@ -36,9 +36,6 @@ private: Name m_hostname; - // https://github.com/llvm/llvm-project/issues/56685 - // https://github.com/llvm/llvm-project/pull/65409 - // clang-format off static constexpr sockaddr_in mdns_addr { #if defined(AK_OS_BSD_GENERIC) || defined(AK_OS_GNU_HURD) .sin_len = sizeof(struct sockaddr_in), @@ -50,7 +47,6 @@ private: .sin_addr = { 0xfb0000e0 }, .sin_zero = { 0 } }; - // clang-format on }; } diff --git a/Userland/Services/RequestServer/ConnectionCache.h b/Userland/Services/RequestServer/ConnectionCache.h index 9ebe6cb27f9..f812d91ad51 100644 --- a/Userland/Services/RequestServer/ConnectionCache.h +++ b/Userland/Services/RequestServer/ConnectionCache.h @@ -63,15 +63,9 @@ struct Connection { template static JobData create(NonnullRefPtr job) { - // Clang-format _really_ messes up formatting this, so just format it manually. - // clang-format off return JobData { - .start = [job](auto& socket) { - job->start(socket); - }, - .fail = [job](auto error) { - job->fail(error); - }, + .start = [job](auto& socket) { job->start(socket); }, + .fail = [job](auto error) { job->fail(error); }, .provide_client_certificates = [job] { if constexpr (requires { job->on_certificate_requested; }) { if (job->on_certificate_requested) @@ -80,10 +74,8 @@ struct Connection { // "use" `job`, otherwise clang gets sad. (void)job; } - return Vector {}; - }, + return Vector {}; }, }; - // clang-format on } }; using QueueType = Vector; diff --git a/Userland/Utilities/mkfs.fat.cpp b/Userland/Utilities/mkfs.fat.cpp index 21b441f6ac6..8e5f7e1cf88 100644 --- a/Userland/Utilities/mkfs.fat.cpp +++ b/Userland/Utilities/mkfs.fat.cpp @@ -20,7 +20,6 @@ // Public domain boot code adapted from: // https://github.com/dosfstools/dosfstools/blob/289a48b9cb5b3c589391d28aa2515c325c932c7a/src/mkfs.fat.c#L205 -// clang-format off static u8 s_bootcode[74] = { 0x0E, // push cs 0x1F, // pop ds @@ -36,10 +35,10 @@ static u8 s_bootcode[74] = { 0x5E, // pop si 0xEB, 0xF0, // jmp write_msg // key_press: - 0x32, 0xE4, // xor ah, ah - 0xCD, 0x16, // int 16h - 0xCD, 0x19, // int 19h - 0xEB, 0xFE, // foo: jmp foo + 0x32, 0xE4, // xor ah, ah + 0xCD, 0x16, // int 16h + 0xCD, 0x19, // int 19h + 0xEB, 0xFE, // foo: jmp foo // message_txt: '\r', '\n', 'N', 'o', 'n', '-', 's', 'y', 's', 't', @@ -51,7 +50,6 @@ static u8 s_bootcode[74] = { '\r', '\n', 0 }; -// clang-format on // FIXME: Modify the boot code to use relative offsets. static constexpr size_t s_message_offset_offset = 3; diff --git a/Userland/Utilities/test-pthread.cpp b/Userland/Utilities/test-pthread.cpp index 2b11604c0de..77fc3ec56b3 100644 --- a/Userland/Utilities/test-pthread.cpp +++ b/Userland/Utilities/test-pthread.cpp @@ -30,11 +30,9 @@ static ErrorOr test_once() }))); threads.last()->start(); } - // clang-format off - // It wants to put [[maybe_unused]] on its own line, for some reason. + for (auto& thread : threads) - [[maybe_unused]] auto res = thread->join(); - // clang-format on + (void)thread->join(); VERIFY(v.size() == 1); @@ -63,11 +61,9 @@ static ErrorOr test_mutex() }))); threads.last()->start(); } - // clang-format off - // It wants to put [[maybe_unused]] on its own line, for some reason. + for (auto& thread : threads) - [[maybe_unused]] auto res = thread->join(); - // clang-format on + (void)thread->join(); VERIFY(v.size() == threads_count * num_times); VERIFY(pthread_mutex_trylock(&mutex) == 0); @@ -99,11 +95,9 @@ static ErrorOr test_semaphore_as_lock() }))); threads.last()->start(); } - // clang-format off - // It wants to put [[maybe_unused]] on its own line, for some reason. + for (auto& thread : threads) - [[maybe_unused]] auto res = thread->join(); - // clang-format on + (void)thread->join(); VERIFY(v.size() == threads_count * num_times); VERIFY(sem_trywait(&semaphore) == 0); @@ -172,11 +166,9 @@ static ErrorOr test_semaphore_nonbinary() }))); threads.last()->start(); } - // clang-format off - // It wants to put [[maybe_unused]] on its own line, for some reason. + for (auto& thread : threads) - [[maybe_unused]] auto res = thread->join(); - // clang-format on + (void)thread->join(); VERIFY(value.load() == 0); VERIFY(seen_more_than_two.load());