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();
#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.

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
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<T>::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);
}

View File

@ -141,12 +141,10 @@ void ProcessorBase<T>::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<T>::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<T>::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);
}

View File

@ -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<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();
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--;
}

View File

@ -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)
{

View File

@ -13,9 +13,7 @@
namespace GPU {
// 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)
{ "softgpu"sv, "libsoftgpu.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" },
#endif
};
// clang-format on
static HashMap<ByteString, WeakPtr<Driver>> s_loaded_drivers;

View File

@ -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 {

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)
{
// 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> DOMMatrix::skew_x_self(double sx)
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]
// 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.

View File

@ -449,12 +449,12 @@ JS::NonnullGCPtr<DOMMatrix> 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<DOMMatrix> 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.

View File

@ -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
};
}

View File

@ -63,15 +63,9 @@ struct Connection {
template<typename T>
static JobData create(NonnullRefPtr<T> 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<TLS::Certificate> {};
},
return Vector<TLS::Certificate> {}; },
};
// clang-format on
}
};
using QueueType = Vector<JobData>;

View File

@ -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;

View File

@ -30,11 +30,9 @@ static ErrorOr<void> 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<void> 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<void> 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<void> 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());