Everywhere: Remove 'clang-format off' comments that are no longer needed

This commit is contained in:
Timothy Flynn 2024-04-24 07:32:02 -04:00 committed by Tim Flynn
parent ec492a1a08
commit fecd08ce64
Notes: sideshowbarker 2024-07-16 21:30:46 +09:00
14 changed files with 41 additions and 87 deletions

View File

@ -484,10 +484,7 @@ public:
[[nodiscard]] static MonotonicTime now_coarse(); [[nodiscard]] static MonotonicTime now_coarse();
#endif #endif
// clang-format off
// Clang-format likes to expand this function for some reason.
[[nodiscard]] i64 seconds() const { return m_offset.to_seconds(); } [[nodiscard]] i64 seconds() const { return m_offset.to_seconds(); }
// clang-format on
[[nodiscard]] i64 milliseconds() const { return m_offset.to_milliseconds(); } [[nodiscard]] i64 milliseconds() const { return m_offset.to_milliseconds(); }
[[nodiscard]] i64 nanoseconds() const { return m_offset.to_nanoseconds(); } [[nodiscard]] i64 nanoseconds() const { return m_offset.to_nanoseconds(); }
// Never returns a point in the future, since fractional seconds are cut off. // Never returns a point in the future, since fractional seconds are cut off.

View File

@ -191,7 +191,6 @@ void ProcessorBase<T>::switch_context(Thread*& from_thread, Thread*& to_thread)
// m_in_critical is restored in enter_thread_context // m_in_critical is restored in enter_thread_context
from_thread->save_critical(m_in_critical); from_thread->save_critical(m_in_critical);
// clang-format off
asm volatile( asm volatile(
"sub sp, sp, #256 \n" "sub sp, sp, #256 \n"
"stp x0, x1, [sp, #(0 * 0)] \n" "stp x0, x1, [sp, #(0 * 0)] \n"
@ -268,7 +267,6 @@ void ProcessorBase<T>::switch_context(Thread*& from_thread, Thread*& to_thread)
[from_thread] "m"(from_thread), [from_thread] "m"(from_thread),
[to_thread] "m"(to_thread) [to_thread] "m"(to_thread)
: "memory", "x0", "x1", "x2"); : "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); dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread);
} }

View File

@ -141,12 +141,10 @@ void ProcessorBase<T>::flush_tlb_local(VirtualAddress vaddr, size_t page_count)
{ {
auto addr = vaddr.get(); auto addr = vaddr.get();
while (page_count > 0) { while (page_count > 0) {
// clang-format off
asm volatile("sfence.vma %0" asm volatile("sfence.vma %0"
: :
: "r"(addr) : "r"(addr)
: "memory"); : "memory");
// clang-format on
addr += PAGE_SIZE; addr += PAGE_SIZE;
page_count--; page_count--;
} }
@ -221,7 +219,6 @@ void ProcessorBase<T>::switch_context(Thread*& from_thread, Thread*& to_thread)
// m_in_critical is restored in enter_thread_context // m_in_critical is restored in enter_thread_context
from_thread->save_critical(m_in_critical); from_thread->save_critical(m_in_critical);
// clang-format off
asm volatile( asm volatile(
// Store a RegisterState of from_thread on from_thread's stack // Store a RegisterState of from_thread on from_thread's stack
"addi sp, sp, -(34 * 8) \n" "addi sp, sp, -(34 * 8) \n"
@ -338,7 +335,6 @@ void ProcessorBase<T>::switch_context(Thread*& from_thread, Thread*& to_thread)
[from_thread] "m"(from_thread), [from_thread] "m"(from_thread),
[to_thread] "m"(to_thread) [to_thread] "m"(to_thread)
: "memory", "t0", "s1", "a0", "a1"); : "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); dbgln_if(CONTEXT_SWITCH_DEBUG, "switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread);
} }

View File

@ -98,10 +98,7 @@ enum class IDTEntryType {
TrapGate32 = 0b1111, TrapGate32 = 0b1111,
}; };
// Clang doesn't format this right due to the compiler magic struct [[gnu::packed]] IDTEntry {
// clang-format off
struct [[gnu::packed]] IDTEntry
{
u16 offset_1; // offset bits 0..15 u16 offset_1; // offset bits 0..15
u16 selector; // a code segment selector in GDT or LDT u16 selector; // a code segment selector in GDT or LDT
@ -147,7 +144,6 @@ struct [[gnu::packed]] IDTEntry
return IDTEntryType(type_attr.gate_type); return IDTEntryType(type_attr.gate_type);
} }
}; };
// clang-format on
static_assert(AssertSize<IDTEntry, 2 * sizeof(void*)>()); static_assert(AssertSize<IDTEntry, 2 * sizeof(void*)>());

View File

@ -951,12 +951,10 @@ void ProcessorBase<T>::flush_tlb_local(VirtualAddress vaddr, size_t page_count)
{ {
auto ptr = vaddr.as_ptr(); auto ptr = vaddr.as_ptr();
while (page_count > 0) { while (page_count > 0) {
// clang-format off
asm volatile("invlpg %0" asm volatile("invlpg %0"
: :
: "m"(*ptr) : "m"(*ptr)
: "memory"); : "memory");
// clang-format on
ptr += PAGE_SIZE; ptr += PAGE_SIZE;
page_count--; page_count--;
} }

View File

@ -14,14 +14,10 @@
# define TEST_INPUT(x) ("test-inputs/" x) # define TEST_INPUT(x) ("test-inputs/" x)
#endif #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 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 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 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(); 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) BENCHMARK_CASE(small_image)
{ {

View File

@ -13,9 +13,7 @@
namespace GPU { namespace GPU {
// FIXME: Think of a better way to configure these paths. Maybe use ConfigServer? // FIXME: Think of a better way to configure these paths. Maybe use ConfigServer?
// clang-format off static HashMap<StringView, char const*> const s_driver_path_map {
static HashMap<StringView, char const*> const s_driver_path_map
{
#if defined(AK_OS_SERENITY) #if defined(AK_OS_SERENITY)
{ "softgpu"sv, "libsoftgpu.so.serenity" }, { "softgpu"sv, "libsoftgpu.so.serenity" },
{ "virtgpu"sv, "libvirtgpu.so.serenity" }, { "virtgpu"sv, "libvirtgpu.so.serenity" },
@ -25,7 +23,6 @@ static HashMap<StringView, char const*> const s_driver_path_map
{ "softgpu"sv, "liblagom-softgpu.so.0" }, { "softgpu"sv, "liblagom-softgpu.so.0" },
#endif #endif
}; };
// clang-format on
static HashMap<ByteString, WeakPtr<Driver>> s_loaded_drivers; static HashMap<ByteString, WeakPtr<Driver>> s_loaded_drivers;

View File

@ -466,7 +466,6 @@ public:
private: private:
OpCode m_opcode { 0 }; OpCode m_opcode { 0 };
// clang-format off
Variant< Variant<
BlockType, BlockType,
DataIndex, DataIndex,
@ -495,9 +494,8 @@ private:
i32, i32,
i64, i64,
u128, u128,
u8 // Empty state u8> // Empty state
> m_arguments; m_arguments;
// clang-format on
}; };
class CustomSection { class CustomSection {

View File

@ -539,12 +539,12 @@ JS::NonnullGCPtr<DOMMatrix> DOMMatrix::rotate_axis_angle_self(Optional<double> x
JS::NonnullGCPtr<DOMMatrix> DOMMatrix::skew_x_self(double sx) JS::NonnullGCPtr<DOMMatrix> 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] // 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 = {
Gfx::DoubleMatrix4x4 skew_matrix = { 1, tan(AK::to_radians(sx)), 0, 0, 1, tan(AK::to_radians(sx)), 0, 0,
0, 1, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 0, 1 }; 0, 0, 0, 1
// clang-format on };
m_matrix = m_matrix * skew_matrix; m_matrix = m_matrix * skew_matrix;
// 3. Return the current matrix. // 3. Return the current matrix.
@ -555,12 +555,12 @@ JS::NonnullGCPtr<DOMMatrix> DOMMatrix::skew_x_self(double sx)
JS::NonnullGCPtr<DOMMatrix> DOMMatrix::skew_y_self(double sy) JS::NonnullGCPtr<DOMMatrix> 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] // 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 = {
Gfx::DoubleMatrix4x4 skew_matrix = { 1, 0, 0, 0, 1, 0, 0, 0,
tan(AK::to_radians(sy)), 1, 0, 0, tan(AK::to_radians(sy)), 1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 0, 1 }; 0, 0, 0, 1
// clang-format on };
m_matrix = m_matrix * skew_matrix; m_matrix = m_matrix * skew_matrix;
// 3. Return the current matrix. // 3. Return the current matrix.

View File

@ -449,12 +449,12 @@ JS::NonnullGCPtr<DOMMatrix> DOMMatrixReadOnly::flip_x()
auto result = DOMMatrix::create_from_dom_matrix_read_only(realm(), *this); auto result = DOMMatrix::create_from_dom_matrix_read_only(realm(), *this);
// 2. Post-multiply result with new DOMMatrix([-1, 0, 0, 1, 0, 0]). // 2. Post-multiply result with new DOMMatrix([-1, 0, 0, 1, 0, 0]).
// clang-format off Gfx::DoubleMatrix4x4 flip_matrix = {
Gfx::DoubleMatrix4x4 flip_matrix = { -1, 0, 0, 0, -1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 0, 1 }; 0, 0, 0, 1
// clang-format on };
result->m_matrix = result->m_matrix * flip_matrix; result->m_matrix = result->m_matrix * flip_matrix;
// 3. Return result. // 3. Return result.
@ -468,12 +468,12 @@ JS::NonnullGCPtr<DOMMatrix> DOMMatrixReadOnly::flip_y()
auto result = DOMMatrix::create_from_dom_matrix_read_only(realm(), *this); auto result = DOMMatrix::create_from_dom_matrix_read_only(realm(), *this);
// 2. Post-multiply result with new DOMMatrix([1, 0, 0, -1, 0, 0]). // 2. Post-multiply result with new DOMMatrix([1, 0, 0, -1, 0, 0]).
// clang-format off Gfx::DoubleMatrix4x4 flip_matrix = {
Gfx::DoubleMatrix4x4 flip_matrix = { 1, 0, 0, 0, 1, 0, 0, 0,
0, -1, 0, 0, 0, -1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 0, 1 }; 0, 0, 0, 1
// clang-format on };
result->m_matrix = result->m_matrix * flip_matrix; result->m_matrix = result->m_matrix * flip_matrix;
// 3. Return result. // 3. Return result.

View File

@ -36,9 +36,6 @@ private:
Name m_hostname; 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 { static constexpr sockaddr_in mdns_addr {
#if defined(AK_OS_BSD_GENERIC) || defined(AK_OS_GNU_HURD) #if defined(AK_OS_BSD_GENERIC) || defined(AK_OS_GNU_HURD)
.sin_len = sizeof(struct sockaddr_in), .sin_len = sizeof(struct sockaddr_in),
@ -50,7 +47,6 @@ private:
.sin_addr = { 0xfb0000e0 }, .sin_addr = { 0xfb0000e0 },
.sin_zero = { 0 } .sin_zero = { 0 }
}; };
// clang-format on
}; };
} }

View File

@ -63,15 +63,9 @@ struct Connection {
template<typename T> template<typename T>
static JobData create(NonnullRefPtr<T> job) static JobData create(NonnullRefPtr<T> job)
{ {
// Clang-format _really_ messes up formatting this, so just format it manually.
// clang-format off
return JobData { return JobData {
.start = [job](auto& socket) { .start = [job](auto& socket) { job->start(socket); },
job->start(socket); .fail = [job](auto error) { job->fail(error); },
},
.fail = [job](auto error) {
job->fail(error);
},
.provide_client_certificates = [job] { .provide_client_certificates = [job] {
if constexpr (requires { job->on_certificate_requested; }) { if constexpr (requires { job->on_certificate_requested; }) {
if (job->on_certificate_requested) if (job->on_certificate_requested)
@ -80,10 +74,8 @@ struct Connection {
// "use" `job`, otherwise clang gets sad. // "use" `job`, otherwise clang gets sad.
(void)job; (void)job;
} }
return Vector<TLS::Certificate> {}; return Vector<TLS::Certificate> {}; },
},
}; };
// clang-format on
} }
}; };
using QueueType = Vector<JobData>; using QueueType = Vector<JobData>;

View File

@ -20,7 +20,6 @@
// Public domain boot code adapted from: // Public domain boot code adapted from:
// https://github.com/dosfstools/dosfstools/blob/289a48b9cb5b3c589391d28aa2515c325c932c7a/src/mkfs.fat.c#L205 // https://github.com/dosfstools/dosfstools/blob/289a48b9cb5b3c589391d28aa2515c325c932c7a/src/mkfs.fat.c#L205
// clang-format off
static u8 s_bootcode[74] = { static u8 s_bootcode[74] = {
0x0E, // push cs 0x0E, // push cs
0x1F, // pop ds 0x1F, // pop ds
@ -36,10 +35,10 @@ static u8 s_bootcode[74] = {
0x5E, // pop si 0x5E, // pop si
0xEB, 0xF0, // jmp write_msg 0xEB, 0xF0, // jmp write_msg
// key_press: // key_press:
0x32, 0xE4, // xor ah, ah 0x32, 0xE4, // xor ah, ah
0xCD, 0x16, // int 16h 0xCD, 0x16, // int 16h
0xCD, 0x19, // int 19h 0xCD, 0x19, // int 19h
0xEB, 0xFE, // foo: jmp foo 0xEB, 0xFE, // foo: jmp foo
// message_txt: // message_txt:
'\r', '\n', '\r', '\n',
'N', 'o', 'n', '-', 's', 'y', 's', 't', 'N', 'o', 'n', '-', 's', 'y', 's', 't',
@ -51,7 +50,6 @@ static u8 s_bootcode[74] = {
'\r', '\n', '\r', '\n',
0 0
}; };
// clang-format on
// FIXME: Modify the boot code to use relative offsets. // FIXME: Modify the boot code to use relative offsets.
static constexpr size_t s_message_offset_offset = 3; static constexpr size_t s_message_offset_offset = 3;

View File

@ -30,11 +30,9 @@ static ErrorOr<void> test_once()
}))); })));
threads.last()->start(); threads.last()->start();
} }
// clang-format off
// It wants to put [[maybe_unused]] on its own line, for some reason.
for (auto& thread : threads) for (auto& thread : threads)
[[maybe_unused]] auto res = thread->join(); (void)thread->join();
// clang-format on
VERIFY(v.size() == 1); VERIFY(v.size() == 1);
@ -63,11 +61,9 @@ static ErrorOr<void> test_mutex()
}))); })));
threads.last()->start(); threads.last()->start();
} }
// clang-format off
// It wants to put [[maybe_unused]] on its own line, for some reason.
for (auto& thread : threads) for (auto& thread : threads)
[[maybe_unused]] auto res = thread->join(); (void)thread->join();
// clang-format on
VERIFY(v.size() == threads_count * num_times); VERIFY(v.size() == threads_count * num_times);
VERIFY(pthread_mutex_trylock(&mutex) == 0); VERIFY(pthread_mutex_trylock(&mutex) == 0);
@ -99,11 +95,9 @@ static ErrorOr<void> test_semaphore_as_lock()
}))); })));
threads.last()->start(); threads.last()->start();
} }
// clang-format off
// It wants to put [[maybe_unused]] on its own line, for some reason.
for (auto& thread : threads) for (auto& thread : threads)
[[maybe_unused]] auto res = thread->join(); (void)thread->join();
// clang-format on
VERIFY(v.size() == threads_count * num_times); VERIFY(v.size() == threads_count * num_times);
VERIFY(sem_trywait(&semaphore) == 0); VERIFY(sem_trywait(&semaphore) == 0);
@ -172,11 +166,9 @@ static ErrorOr<void> test_semaphore_nonbinary()
}))); })));
threads.last()->start(); threads.last()->start();
} }
// clang-format off
// It wants to put [[maybe_unused]] on its own line, for some reason.
for (auto& thread : threads) for (auto& thread : threads)
[[maybe_unused]] auto res = thread->join(); (void)thread->join();
// clang-format on
VERIFY(value.load() == 0); VERIFY(value.load() == 0);
VERIFY(seen_more_than_two.load()); VERIFY(seen_more_than_two.load());