Преглед на файлове

Everywhere: Run clang-format

The following command was used to clang-format these files:

    clang-format-18 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")

There are a couple of weird cases where clang-format now thinks that a
pointer access in an initializer list, e.g. `m_member(ptr->foo)`, is a
lambda return statement, and it puts spaces around the `->`.
Timothy Flynn преди 1 година
родител
ревизия
ec492a1a08
променени са 57 файла, в които са добавени 294 реда и са изтрити 287 реда
  1. 2 2
      AK/StdLibExtraDetails.h
  2. 2 2
      AK/Utf16View.h
  3. 1 1
      Kernel/API/POSIX/futex.h
  4. 1 1
      Kernel/API/POSIX/netinet/in.h
  5. 1 1
      Kernel/API/POSIX/signal.h
  6. 7 7
      Kernel/API/POSIX/sys/stat.h
  7. 4 4
      Kernel/API/POSIX/sys/wait.h
  8. 2 2
      Kernel/Arch/CPU.h
  9. 1 1
      Kernel/Arch/x86_64/Interrupts/APIC.cpp
  10. 10 10
      Kernel/Bus/PCI/Definitions.h
  11. 1 1
      Kernel/Bus/VirtIO/Device.cpp
  12. 1 1
      Kernel/Devices/GPU/Console/VGATextModeConsole.cpp
  13. 1 2
      Kernel/Devices/Storage/SD/SDMemoryCard.cpp
  14. 4 4
      Kernel/Net/Intel/E1000ENetworkAdapter.cpp
  15. 1 1
      Ladybird/Qt/Tab.cpp
  16. 1 1
      Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Compiler/Passes/IfBranchMergingPass.cpp
  17. 2 2
      Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp
  18. 2 2
      Tests/AK/TestChecked.cpp
  19. 2 2
      Tests/AK/TestIPv4Address.cpp
  20. 1 1
      Tests/AK/TestJSON.cpp
  21. 1 1
      Tests/AK/TestSpan.cpp
  22. 1 1
      Tests/AK/TestVariant.cpp
  23. 3 3
      Tests/JSSpecCompiler/test-runner.cpp
  24. 10 10
      Tests/Kernel/crash.cpp
  25. 1 1
      Tests/Kernel/elf-execve-mmap-race.cpp
  26. 1 1
      Tests/Kernel/fuzz-syscalls.cpp
  27. 1 1
      Tests/Kernel/kill-pidtid-confusion.cpp
  28. 1 1
      Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp
  29. 1 1
      Tests/Kernel/nanosleep-race-outbuf-munmap.cpp
  30. 1 1
      Tests/Kernel/setpgid-across-sessions-without-leader.cpp
  31. 3 3
      Tests/Kernel/siginfo-example.cpp
  32. 9 9
      Tests/LibC/TestMemmem.cpp
  33. 1 1
      Tests/LibC/TestQsort.cpp
  34. 1 1
      Tests/LibC/TestScanf.cpp
  35. 1 1
      Tests/LibC/TestSnprintf.cpp
  36. 3 3
      Tests/LibC/TestWchar.cpp
  37. 2 2
      Tests/LibC/TestWctype.cpp
  38. 3 3
      Tests/LibCompress/TestDeflate.cpp
  39. 2 2
      Tests/LibCompress/TestGzip.cpp
  40. 2 2
      Tests/LibCompress/TestZlib.cpp
  41. 79 77
      Tests/LibCrypto/TestBigInteger.cpp
  42. 4 4
      Tests/LibEDID/TestEDID.cpp
  43. 26 26
      Tests/LibSQL/TestSqlExpressionParser.cpp
  44. 59 59
      Tests/LibSQL/TestSqlStatementParser.cpp
  45. 4 4
      Tests/LibWasm/test-wasm.cpp
  46. 1 1
      Userland/Libraries/LibC/netinet/in.h
  47. 1 1
      Userland/Libraries/LibC/sys/param.h
  48. 2 2
      Userland/Libraries/LibC/syslog.h
  49. 5 5
      Userland/Libraries/LibELF/ELFABI.h
  50. 4 4
      Userland/Libraries/LibGUI/Model.cpp
  51. 3 1
      Userland/Libraries/LibGUI/Widget.cpp
  52. 2 1
      Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp
  53. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h
  54. 2 2
      Userland/Libraries/LibJS/Runtime/TypedArray.cpp
  55. 1 1
      Userland/Libraries/LibWeb/DOM/Document.cpp
  56. 3 0
      Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
  57. 1 1
      Userland/Libraries/LibWebSocket/WebSocket.cpp

+ 2 - 2
AK/StdLibExtraDetails.h

@@ -126,9 +126,9 @@ inline constexpr bool IsFunction<Ret(Args...) const volatile&> = true;
 template<class Ret, class... Args>
 inline constexpr bool IsFunction<Ret(Args..., ...) const volatile&> = true;
 template<class Ret, class... Args>
-inline constexpr bool IsFunction<Ret(Args...)&&> = true;
+inline constexpr bool IsFunction<Ret(Args...) &&> = true;
 template<class Ret, class... Args>
-inline constexpr bool IsFunction<Ret(Args..., ...)&&> = true;
+inline constexpr bool IsFunction<Ret(Args..., ...) &&> = true;
 template<class Ret, class... Args>
 inline constexpr bool IsFunction<Ret(Args...) const&&> = true;
 template<class Ret, class... Args>

+ 2 - 2
AK/Utf16View.h

@@ -74,8 +74,8 @@ public:
     template<size_t Size>
     Utf16View(char16_t const (&code_units)[Size])
         : m_code_units(
-            reinterpret_cast<u16 const*>(&code_units[0]),
-            code_units[Size - 1] == u'\0' ? Size - 1 : Size)
+              reinterpret_cast<u16 const*>(&code_units[0]),
+              code_units[Size - 1] == u'\0' ? Size - 1 : Size)
     {
     }
 

+ 1 - 1
Kernel/API/POSIX/futex.h

@@ -22,7 +22,7 @@ extern "C" {
 #define _FUTEX_OP_MASK_CMP_ARG 0xfff
 
 #define FUTEX_OP(op, op_arg, cmp, cmp_arg) \
-    ((((op)&_FUTEX_OP_MASK_OP) << _FUTEX_OP_SHIFT_OP) | (((cmp)&_FUTEX_OP_MASK_CMP) << _FUTEX_OP_SHIFT_CMP) | (((op_arg)&_FUTEX_OP_MASK_OP_ARG) << _FUTEX_OP_SHIFT_OP_ARG) | (((cmp_arg)&_FUTEX_OP_MASK_CMP_ARG) << _FUTEX_OP_SHIFT_CMP_ARG))
+    ((((op) & _FUTEX_OP_MASK_OP) << _FUTEX_OP_SHIFT_OP) | (((cmp) & _FUTEX_OP_MASK_CMP) << _FUTEX_OP_SHIFT_CMP) | (((op_arg) & _FUTEX_OP_MASK_OP_ARG) << _FUTEX_OP_SHIFT_OP_ARG) | (((cmp_arg) & _FUTEX_OP_MASK_CMP_ARG) << _FUTEX_OP_SHIFT_CMP_ARG))
 
 #define _FUTEX_OP(val3) (((val3) >> _FUTEX_OP_SHIFT_OP) & _FUTEX_OP_MASK_OP)
 #define _FUTEX_CMP(val3) (((val3) >> _FUTEX_OP_SHIFT_CMP) & _FUTEX_OP_MASK_CMP)

+ 1 - 1
Kernel/API/POSIX/netinet/in.h

@@ -16,7 +16,7 @@ extern "C" {
 typedef uint32_t in_addr_t;
 
 #define INADDR_ANY ((in_addr_t)0)
-#define INADDR_NONE ((in_addr_t)-1)
+#define INADDR_NONE ((in_addr_t)(-1))
 #define INADDR_LOOPBACK 0x7f000001
 #define INADDR_BROADCAST 0xffffffff
 

+ 1 - 1
Kernel/API/POSIX/signal.h

@@ -59,7 +59,7 @@ typedef struct {
 #define SIGSTKSZ 32768   // Recommended size
 
 #define SIG_DFL ((__sighandler_t)0)
-#define SIG_ERR ((__sighandler_t)-1)
+#define SIG_ERR ((__sighandler_t)(-1))
 #define SIG_IGN ((__sighandler_t)1)
 
 #define SA_NOCLDSTOP 1

+ 7 - 7
Kernel/API/POSIX/sys/stat.h

@@ -42,13 +42,13 @@ extern "C" {
 
 #define S_IRWXG (S_IRWXU >> 3)
 #define S_IRWXO (S_IRWXG >> 3)
-#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
-#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
-#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
-#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
-#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
-#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
-#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
 
 struct stat {
     dev_t st_dev;            /* ID of device containing file */

+ 4 - 4
Kernel/API/POSIX/sys/wait.h

@@ -12,12 +12,12 @@
 extern "C" {
 #endif
 
-#define WEXITSTATUS(status) (((status)&0xff00) >> 8)
+#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
 #define WSTOPSIG(status) WEXITSTATUS(status)
-#define WTERMSIG(status) ((status)&0x7f)
+#define WTERMSIG(status) ((status) & 0x7f)
 #define WIFEXITED(status) (WTERMSIG(status) == 0)
-#define WIFSTOPPED(status) (((status)&0xff) == 0x7f)
-#define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0)
+#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
+#define WIFSIGNALED(status) (((char)(((status) & 0x7f) + 1) >> 1) > 0)
 #define WIFCONTINUED(status) ((status) == 0xffff)
 
 #define WNOHANG 1

+ 2 - 2
Kernel/Arch/CPU.h

@@ -11,9 +11,9 @@
 
 #define PAGE_MASK (~(FlatPtr)0xfffu)
 
-#define LSW(x) ((u32)(x)&0xFFFF)
+#define LSW(x) ((u32)(x) & 0xFFFF)
 #define MSW(x) (((u32)(x) >> 16) & 0xFFFF)
-#define LSB(x) ((x)&0xFF)
+#define LSB(x) ((x) & 0xFF)
 #define MSB(x) (((x) >> 8) & 0xFF)
 
 #if ARCH(X86_64)

+ 1 - 1
Kernel/Arch/x86_64/Interrupts/APIC.cpp

@@ -205,7 +205,7 @@ void APIC::write_icr(ICRReg const& icr)
 
 #define APIC_LVT_MASKED (1 << 16)
 #define APIC_LVT_TRIGGER_LEVEL (1 << 14)
-#define APIC_LVT(iv, dm) (((iv)&0xff) | (((dm)&0x7) << 8))
+#define APIC_LVT(iv, dm) (((iv) & 0xff) | (((dm) & 0x7) << 8))
 
 extern "C" void apic_ap_start(void);
 extern "C" u16 apic_ap_start_size;

+ 10 - 10
Kernel/Bus/PCI/Definitions.h

@@ -481,16 +481,16 @@ public:
 private:
     DeviceIdentifier(EnumerableDeviceIdentifier const& other_identifier)
         : EnumerableDeviceIdentifier(other_identifier.address(),
-            other_identifier.hardware_id(),
-            other_identifier.revision_id(),
-            other_identifier.class_code(),
-            other_identifier.subclass_code(),
-            other_identifier.prog_if(),
-            other_identifier.subsystem_id(),
-            other_identifier.subsystem_vendor_id(),
-            other_identifier.interrupt_line(),
-            other_identifier.interrupt_pin(),
-            other_identifier.capabilities())
+              other_identifier.hardware_id(),
+              other_identifier.revision_id(),
+              other_identifier.class_code(),
+              other_identifier.subclass_code(),
+              other_identifier.prog_if(),
+              other_identifier.subsystem_id(),
+              other_identifier.subsystem_vendor_id(),
+              other_identifier.interrupt_line(),
+              other_identifier.interrupt_pin(),
+              other_identifier.capabilities())
     {
     }
 

+ 1 - 1
Kernel/Bus/VirtIO/Device.cpp

@@ -27,7 +27,7 @@ UNMAP_AFTER_INIT ErrorOr<void> Device::initialize_virtio_resources()
 }
 
 UNMAP_AFTER_INIT VirtIO::Device::Device(NonnullOwnPtr<TransportEntity> transport_entity)
-    : m_class_name(transport_entity->determine_device_class_name())
+    : m_class_name(transport_entity -> determine_device_class_name())
     , m_transport_entity(move(transport_entity))
 {
 }

+ 1 - 1
Kernel/Devices/GPU/Console/VGATextModeConsole.cpp

@@ -20,7 +20,7 @@ UNMAP_AFTER_INIT NonnullLockRefPtr<VGATextModeConsole> VGATextModeConsole::initi
 UNMAP_AFTER_INIT VGATextModeConsole::VGATextModeConsole(NonnullOwnPtr<Memory::Region> vga_window_region)
     : Console(80, 25)
     , m_vga_window_region(move(vga_window_region))
-    , m_current_vga_window(m_vga_window_region->vaddr().offset(0x18000).as_ptr())
+    , m_current_vga_window(m_vga_window_region -> vaddr().offset(0x18000).as_ptr())
 {
     for (size_t index = 0; index < height(); index++) {
         clear_vga_row(index);

+ 1 - 2
Kernel/Devices/Storage/SD/SDMemoryCard.cpp

@@ -11,8 +11,7 @@
 namespace Kernel {
 
 SDMemoryCard::SDMemoryCard(SDHostController& sdhc, StorageDevice::LUNAddress lun_address, u32 hardware_relative_controller_id, u32 block_len, u64 capacity_in_blocks, u32 relative_card_address, SD::OperatingConditionRegister ocr, SD::CardIdentificationRegister cid, SD::SDConfigurationRegister scr)
-    : StorageDevice(lun_address, hardware_relative_controller_id, block_len,
-        capacity_in_blocks)
+    : StorageDevice(lun_address, hardware_relative_controller_id, block_len, capacity_in_blocks)
     , m_sdhc(sdhc)
     , m_relative_card_address(relative_card_address)
     , m_ocr(ocr)

+ 4 - 4
Kernel/Net/Intel/E1000ENetworkAdapter.cpp

@@ -240,10 +240,10 @@ UNMAP_AFTER_INIT E1000ENetworkAdapter::E1000ENetworkAdapter(StringView interface
     NonnullOwnPtr<Memory::Region> tx_buffer_region, NonnullOwnPtr<Memory::Region> rx_descriptors_region,
     NonnullOwnPtr<Memory::Region> tx_descriptors_region)
     : E1000NetworkAdapter(interface_name, device_identifier, irq, move(registers_io_window),
-        move(rx_buffer_region),
-        move(tx_buffer_region),
-        move(rx_descriptors_region),
-        move(tx_descriptors_region))
+          move(rx_buffer_region),
+          move(tx_buffer_region),
+          move(rx_descriptors_region),
+          move(tx_descriptors_region))
 {
 }
 

+ 1 - 1
Ladybird/Qt/Tab.cpp

@@ -212,7 +212,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
 
         dialog.setWindowTitle("Ladybird");
         dialog.setOption(QColorDialog::ShowAlphaChannel, false);
-        QObject::connect(&dialog, &QColorDialog::currentColorChanged, this, [this](const QColor& color) {
+        QObject::connect(&dialog, &QColorDialog::currentColorChanged, this, [this](QColor const& color) {
             view().color_picker_update(Color(color.red(), color.green(), color.blue()), Web::HTML::ColorPickerUpdateState::Update);
         });
 

+ 1 - 1
Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Compiler/Passes/IfBranchMergingPass.cpp

@@ -44,7 +44,7 @@ RecursionDecision IfBranchMergingPass::on_entry(Tree tree)
 
 Tree IfBranchMergingPass::merge_branches(Vector<Tree> const& unmerged_branches)
 {
-    static const Tree error = make_ref_counted<ErrorNode>("Cannot make sense of if-elseif-else chain"sv);
+    static Tree const error = make_ref_counted<ErrorNode>("Cannot make sense of if-elseif-else chain"sv);
 
     VERIFY(unmerged_branches.size() >= 1);
 

+ 2 - 2
Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp

@@ -69,8 +69,8 @@ void replace_logical_aliases(JsonObject& properties)
     AK::HashMap<ByteString, ByteString> logical_aliases;
     properties.for_each_member([&](auto& name, auto& value) {
         VERIFY(value.is_object());
-        const auto& value_as_object = value.as_object();
-        const auto logical_alias_for = value_as_object.get_array("logical-alias-for"sv);
+        auto const& value_as_object = value.as_object();
+        auto const logical_alias_for = value_as_object.get_array("logical-alias-for"sv);
         if (logical_alias_for.has_value()) {
             auto const& aliased_properties = logical_alias_for.value();
             for (auto const& aliased_property : aliased_properties.values()) {

+ 2 - 2
Tests/AK/TestChecked.cpp

@@ -159,7 +159,7 @@ TEST_CASE(should_constexpr_convert_construct)
 TEST_CASE(should_constexpr_copy_construct)
 {
     constexpr auto checked_value = [] {
-        const Checked<int> old_value { 42 };
+        Checked<int> const old_value { 42 };
         Checked<int> value(old_value);
         return value;
     }();
@@ -180,7 +180,7 @@ TEST_CASE(should_constexpr_move_construct)
 TEST_CASE(should_constexpr_copy_assign)
 {
     constexpr auto checked_value = [] {
-        const Checked<int> old_value { 42 };
+        Checked<int> const old_value { 42 };
         Checked<int> value {};
         value = old_value;
         return value;

+ 2 - 2
Tests/AK/TestIPv4Address.cpp

@@ -21,7 +21,7 @@ TEST_CASE(should_default_contructor_with_0s)
 TEST_CASE(should_construct_from_c_array)
 {
     constexpr auto addr = [] {
-        const u8 a[4] = { 1, 2, 3, 4 };
+        u8 const a[4] = { 1, 2, 3, 4 };
         return IPv4Address(a);
     }();
 
@@ -33,7 +33,7 @@ TEST_CASE(should_construct_from_c_array)
 TEST_CASE(should_construct_from_u32)
 {
     constexpr auto addr = [] {
-        const NetworkOrdered<u32> a = 0x11'22'33'44;
+        NetworkOrdered<u32> const a = 0x11'22'33'44;
         return IPv4Address(a);
     }();
 

+ 1 - 1
Tests/AK/TestJSON.cpp

@@ -51,7 +51,7 @@ TEST_CASE(load_form)
     widgets->for_each([&](JsonValue const& widget_value) {
         auto& widget_object = widget_value.as_object();
         auto widget_class = widget_object.get_byte_string("class"sv).value();
-        widget_object.for_each_member([&]([[maybe_unused]] auto& property_name, [[maybe_unused]] const JsonValue& property_value) {
+        widget_object.for_each_member([&]([[maybe_unused]] auto& property_name, [[maybe_unused]] JsonValue const& property_value) {
         });
     });
 }

+ 1 - 1
Tests/AK/TestSpan.cpp

@@ -134,7 +134,7 @@ TEST_CASE(starts_with)
     ReadonlyBytes nah_bytes { str_nah, strlen(str_nah) };
     EXPECT(!bytes.starts_with(nah_bytes));
 
-    const u8 hey_array[3] = { 'H', 'e', 'y' };
+    u8 const hey_array[3] = { 'H', 'e', 'y' };
     ReadonlyBytes hey_bytes_u8 { hey_array, 3 };
     EXPECT(bytes.starts_with(hey_bytes_u8));
 }

+ 1 - 1
Tests/AK/TestVariant.cpp

@@ -188,7 +188,7 @@ TEST_CASE(return_values)
         EXPECT_EQ(value, 42);
     }
     {
-        const MyVariant the_value { "str" };
+        MyVariant const the_value { "str" };
 
         ByteString value = the_value.visit(
             [&](int const&) { return ByteString { "wrong" }; },

+ 3 - 3
Tests/JSSpecCompiler/test-runner.cpp

@@ -42,7 +42,7 @@ constexpr TestDescription::Flag dump_after_frontend = {
     .dump_cfg = false
 };
 
-const Array regression_tests = {
+Array const regression_tests = {
     TestDescription {
         .sources = { "simple.cpp"sv },
         .flags = { always_dump_all },
@@ -59,11 +59,11 @@ const Array regression_tests = {
     }
 };
 
-static const LexicalPath path_to_compiler_binary = [] {
+static LexicalPath const path_to_compiler_binary = [] {
     auto path_to_self = LexicalPath(MUST(Core::System::current_executable_path())).parent();
     return LexicalPath::join(path_to_self.string(), compiler_binary_name);
 }();
-static const LexicalPath path_to_tests_directory { relative_path_to_test };
+static LexicalPath const path_to_tests_directory { relative_path_to_test };
 
 Vector<ByteString> build_command_line_arguments(LexicalPath const& test_source, TestDescription const& description)
 {

+ 10 - 10
Tests/Kernel/crash.cpp

@@ -101,7 +101,7 @@ int main(int argc, char** argv)
 
     if (do_segmentation_violation || do_all_crash_types) {
         any_failures |= !Crash("Segmentation violation", []() {
-            volatile int* crashme = nullptr;
+            int volatile* crashme = nullptr;
             *crashme = 0xbeef;
             return Crash::Failure::DidNotCrash;
         }).run(run_type);
@@ -109,9 +109,9 @@ int main(int argc, char** argv)
 
     if (do_division_by_zero || do_all_crash_types) {
         any_failures |= !Crash("Division by zero", []() {
-            volatile int lala = 10;
-            volatile int zero = 0;
-            [[maybe_unused]] volatile int test = lala / zero;
+            int volatile lala = 10;
+            int volatile zero = 0;
+            [[maybe_unused]] int volatile test = lala / zero;
             return Crash::Failure::DidNotCrash;
         }).run(run_type);
     }
@@ -132,25 +132,25 @@ int main(int argc, char** argv)
 
     if (do_read_from_uninitialized_malloc_memory || do_all_crash_types) {
         any_failures |= !Crash("Read from uninitialized malloc memory", []() {
-            auto* uninitialized_memory = (volatile u32**)malloc(1024);
+            auto* uninitialized_memory = (u32 volatile**)malloc(1024);
             if (!uninitialized_memory)
                 return Crash::Failure::UnexpectedError;
 
-            [[maybe_unused]] volatile auto x = uninitialized_memory[0][0];
+            [[maybe_unused]] auto volatile x = uninitialized_memory[0][0];
             return Crash::Failure::DidNotCrash;
         }).run(run_type);
     }
 
     if (do_read_from_freed_memory || do_all_crash_types) {
         any_failures |= !Crash("Read from freed memory", []() {
-            auto* uninitialized_memory = (volatile u32**)malloc(1024);
+            auto* uninitialized_memory = (u32 volatile**)malloc(1024);
             if (!uninitialized_memory)
                 return Crash::Failure::UnexpectedError;
 
             free(uninitialized_memory);
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wuse-after-free"
-            [[maybe_unused]] volatile auto x = uninitialized_memory[4][0];
+            [[maybe_unused]] auto volatile x = uninitialized_memory[4][0];
 #pragma GCC diagnostic pop
             return Crash::Failure::DidNotCrash;
         }).run(run_type);
@@ -158,7 +158,7 @@ int main(int argc, char** argv)
 
     if (do_write_to_uninitialized_malloc_memory || do_all_crash_types) {
         any_failures |= !Crash("Write to uninitialized malloc memory", []() {
-            auto* uninitialized_memory = (volatile u32**)malloc(1024);
+            auto* uninitialized_memory = (u32 volatile**)malloc(1024);
             if (!uninitialized_memory)
                 return Crash::Failure::UnexpectedError;
 
@@ -169,7 +169,7 @@ int main(int argc, char** argv)
 
     if (do_write_to_freed_memory || do_all_crash_types) {
         any_failures |= !Crash("Write to freed memory", []() {
-            auto* uninitialized_memory = (volatile u32**)malloc(1024);
+            auto* uninitialized_memory = (u32 volatile**)malloc(1024);
             if (!uninitialized_memory)
                 return Crash::Failure::UnexpectedError;
 

+ 1 - 1
Tests/Kernel/elf-execve-mmap-race.cpp

@@ -114,7 +114,7 @@ int main()
     pthread_t t;
     pthread_create(
         &t, &attrs, [](void* ctx) -> void* {
-            auto& ph = *(volatile Elf32_Phdr*)ctx;
+            auto& ph = *(Elf32_Phdr volatile*)ctx;
             for (;;) {
                 if (!hax)
                     ph.p_offset = 0x60000000;

+ 1 - 1
Tests/Kernel/fuzz-syscalls.cpp

@@ -118,7 +118,7 @@ static void do_random_tests()
     }
 
     // Note that we will also make lots of syscalls for randomness and debugging.
-    const size_t fuzz_syscall_count = 10000;
+    size_t const fuzz_syscall_count = 10000;
 
     size_t direct_sc_args[3] = { 0 };
     // Isolate to a separate region to make corruption less likely, because we will write to it:

+ 1 - 1
Tests/Kernel/kill-pidtid-confusion.cpp

@@ -39,7 +39,7 @@ static constexpr useconds_t STEP_SIZE = 1100000;
 
 static void fork_into(void(fn)())
 {
-    const pid_t rc = fork();
+    pid_t const rc = fork();
     if (rc < 0) {
         perror("fork");
         exit(1);

+ 1 - 1
Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp

@@ -60,7 +60,7 @@ int main()
     ret
 #endif
 
-    const u8 payload[] = {
+    u8 const payload[] = {
         0xeb, 0x0f, 0x2f, 0x68, 0x6f, 0x6d, 0x65, 0x2f, 0x61, 0x6e, 0x6f,
         0x6e, 0x2f, 0x6f, 0x77, 0x6e, 0x00, 0xb8, 0x4f, 0x00, 0x00, 0x00,
         0xba, 0x13, 0xb1, 0x04, 0x08, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xbb,

+ 1 - 1
Tests/Kernel/nanosleep-race-outbuf-munmap.cpp

@@ -116,7 +116,7 @@ int main()
     signal(SIGUSR1, signal_printer);
 
     // T1: Go to sleep.
-    const timespec requested_sleep = { 3, 0 };
+    timespec const requested_sleep = { 3, 0 };
     rc = clock_nanosleep(CLOCK_MONOTONIC, 0, &requested_sleep, shared.remaining_sleep);
     // Now we are beyond T4.
 

+ 1 - 1
Tests/Kernel/setpgid-across-sessions-without-leader.cpp

@@ -51,7 +51,7 @@ static constexpr useconds_t STEP_SIZE = 1100000;
 
 static void fork_into(void (*fn)(void*), void* arg)
 {
-    const pid_t rc = fork();
+    pid_t const rc = fork();
     if (rc < 0) {
         perror("fork");
         exit(1);

+ 3 - 3
Tests/Kernel/siginfo-example.cpp

@@ -11,9 +11,9 @@
 #include <unistd.h>
 
 // Supposed to use volatile everywhere here but good lord does C++ make that a pain
-volatile sig_atomic_t saved_signal;
-volatile siginfo_t saved_siginfo;
-volatile ucontext_t saved_ucontext;
+sig_atomic_t volatile saved_signal;
+siginfo_t volatile saved_siginfo;
+ucontext_t volatile saved_ucontext;
 siginfo_t* sig_info_addr;
 ucontext_t* ucontext_addr;
 void* stack_ptr;

+ 9 - 9
Tests/LibC/TestMemmem.cpp

@@ -17,17 +17,17 @@ struct TestCase {
     ssize_t matching_offset { -1 };
 };
 
-const static TestCase g_test_cases[] = {
+static TestCase const g_test_cases[] = {
     { (u8 const*) {}, 0u, (u8 const*) {}, 0u, 0 },
-    { (const u8[]) { 1, 2, 3 }, 3u, (const u8[]) { 1, 2, 3 }, 3u, 0 },
-    { (const u8[]) { 1, 2, 4 }, 3u, (const u8[]) { 1, 2, 3 }, 3u, -1 },
-    { (u8 const*)"abcdef", 6u, (const u8[]) {}, 0u, 0 },
+    { (u8 const[]) { 1, 2, 3 }, 3u, (u8 const[]) { 1, 2, 3 }, 3u, 0 },
+    { (u8 const[]) { 1, 2, 4 }, 3u, (u8 const[]) { 1, 2, 3 }, 3u, -1 },
+    { (u8 const*)"abcdef", 6u, (u8 const[]) {}, 0u, 0 },
     { (u8 const*)"abcdef", 6u, (u8 const*)"de", 2u, 3 },
-    { (const u8[]) { 0, 1, 2, 5, 2, 5 }, 6u, (const u8[]) { 1 }, 1u, 1 },
-    { (const u8[]) { 0, 1, 2, 5, 2, 5 }, 6u, (const u8[]) { 1, 2 }, 2u, 1 },
-    { (const u8[]) { 0, 1, 1, 2 }, 4u, (const u8[]) { 1, 5 }, 2u, -1 },
-    { (const u8[64]) { 0 }, 64u, (const u8[33]) { 0 }, 33u, 0 },
-    { (const u8[64]) { 0, 1, 1, 2 }, 64u, (const u8[33]) { 1, 1 }, 2u, 1 },
+    { (u8 const[]) { 0, 1, 2, 5, 2, 5 }, 6u, (u8 const[]) { 1 }, 1u, 1 },
+    { (u8 const[]) { 0, 1, 2, 5, 2, 5 }, 6u, (u8 const[]) { 1, 2 }, 2u, 1 },
+    { (u8 const[]) { 0, 1, 1, 2 }, 4u, (u8 const[]) { 1, 5 }, 2u, -1 },
+    { (u8 const[64]) { 0 }, 64u, (u8 const[33]) { 0 }, 33u, 0 },
+    { (u8 const[64]) { 0, 1, 1, 2 }, 64u, (u8 const[33]) { 1, 1 }, 2u, 1 },
 };
 
 TEST_CASE(memmem_search)

+ 1 - 1
Tests/LibC/TestQsort.cpp

@@ -12,7 +12,7 @@
 #include <AK/Vector.h>
 #include <stdlib.h>
 
-const size_t NUM_RUNS = 10;
+size_t const NUM_RUNS = 10;
 
 struct SortableObject {
     int m_key;

+ 1 - 1
Tests/LibC/TestScanf.cpp

@@ -147,7 +147,7 @@ struct TestSuite {
     Array<unsigned char, 32> expected_values[8]; // 32 bytes for each argument's value.
 };
 
-const TestSuite test_suites[] {
+TestSuite const test_suites[] {
     { "%d", "", 0, 0, {}, {} },
     { "%x", "0x519", 1, 1, { unsignedarg0 }, { to_value_t(0x519) } },
     { "%x", "0x51g", 1, 1, { unsignedarg0 }, { to_value_t(0x51u) } },

+ 1 - 1
Tests/LibC/TestSnprintf.cpp

@@ -22,7 +22,7 @@ struct Testcase {
     char const* dest;
     size_t dest_n;
     char const* fmt;
-    const TArg arg;
+    TArg const arg;
     int expected_return;
     char const* dest_expected;
     size_t dest_expected_n; // == dest_n

+ 3 - 3
Tests/LibC/TestWchar.cpp

@@ -323,8 +323,8 @@ TEST_CASE(wcsrtombs)
 {
     mbstate_t state = {};
     char buf[MB_LEN_MAX * 4];
-    const wchar_t good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' };
-    const wchar_t bad_chars[] = { L'\U0001F41E', static_cast<wchar_t>(0x1111F41E), L'\0' };
+    wchar_t const good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' };
+    wchar_t const bad_chars[] = { L'\U0001F41E', static_cast<wchar_t>(0x1111F41E), L'\0' };
     wchar_t const* src;
     size_t ret = 0;
 
@@ -369,7 +369,7 @@ TEST_CASE(wcsrtombs)
 TEST_CASE(wcsnrtombs)
 {
     mbstate_t state = {};
-    const wchar_t good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' };
+    wchar_t const good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' };
     wchar_t const* src;
     size_t ret = 0;
 

+ 2 - 2
Tests/LibC/TestWctype.cpp

@@ -42,7 +42,7 @@ TEST_CASE(wctrans)
 
 TEST_CASE(iswctype)
 {
-    const wint_t test_chars[] = { L'A', L'a', L'F', L'f', L'Z', L'z', L'0', L'\n', L'.', L'\x00' };
+    wint_t const test_chars[] = { L'A', L'a', L'F', L'f', L'Z', L'z', L'0', L'\n', L'.', L'\x00' };
 
     // Test that valid properties are wired to the correct implementation.
     for (unsigned int i = 0; i < sizeof(test_chars) / sizeof(test_chars[0]); i++) {
@@ -69,7 +69,7 @@ TEST_CASE(iswctype)
 
 TEST_CASE(towctrans)
 {
-    const wint_t test_chars[] = { L'A', L'a', L'F', L'f', L'Z', L'z', L'0', L'\n', L'.', L'\x00' };
+    wint_t const test_chars[] = { L'A', L'a', L'F', L'f', L'Z', L'z', L'0', L'\n', L'.', L'\x00' };
 
     // Test that valid mappings are wired to the correct implementation.
     for (unsigned int i = 0; i < sizeof(test_chars) / sizeof(test_chars[0]); i++) {

+ 3 - 3
Tests/LibCompress/TestDeflate.cpp

@@ -77,7 +77,7 @@ TEST_CASE(deflate_decompress_compressed_block)
         0xCB, 0x4A, 0x13, 0x00
     };
 
-    const u8 uncompressed[] = "This is a simple text file :)";
+    u8 const uncompressed[] = "This is a simple text file :)";
 
     auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
     EXPECT(decompressed.value().bytes() == ReadonlyBytes({ uncompressed, sizeof(uncompressed) - 1 }));
@@ -90,7 +90,7 @@ TEST_CASE(deflate_decompress_uncompressed_block)
         0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21
     };
 
-    const u8 uncompressed[] = "Hello, World!";
+    u8 const uncompressed[] = "Hello, World!";
 
     auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
     EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
@@ -107,7 +107,7 @@ TEST_CASE(deflate_decompress_multiple_blocks)
         0x92, 0xf3, 0x73, 0x0b, 0x8a, 0x52, 0x8b, 0x8b, 0x53, 0x53, 0xf4, 0x00
     };
 
-    const u8 uncompressed[] = "The first block is uncompressed and the second block is compressed.";
+    u8 const uncompressed[] = "The first block is uncompressed and the second block is compressed.";
 
     auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
     EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));

+ 2 - 2
Tests/LibCompress/TestGzip.cpp

@@ -18,7 +18,7 @@ TEST_CASE(gzip_decompress_simple)
         0x00, 0xc2, 0x1d, 0x22, 0x15, 0x0f, 0x00, 0x00, 0x00
     };
 
-    const u8 uncompressed[] = "word1 abc word2";
+    u8 const uncompressed[] = "word1 abc word2";
 
     auto const decompressed = Compress::GzipDecompressor::decompress_all(compressed);
     EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
@@ -34,7 +34,7 @@ TEST_CASE(gzip_decompress_multiple_members)
         0x06, 0x00, 0x00, 0x00
     };
 
-    const u8 uncompressed[] = "abcabcabcabc";
+    u8 const uncompressed[] = "abcabcabcabc";
 
     auto const decompressed = Compress::GzipDecompressor::decompress_all(compressed);
     EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));

+ 2 - 2
Tests/LibCompress/TestZlib.cpp

@@ -19,7 +19,7 @@ TEST_CASE(zlib_decompress_simple)
         0x99, 0x5E, 0x09, 0xE8
     };
 
-    const u8 uncompressed[] = "This is a simple text file :)";
+    u8 const uncompressed[] = "This is a simple text file :)";
 
     auto stream = make<FixedMemoryStream>(compressed);
     auto decompressor = TRY_OR_FAIL(Compress::ZlibDecompressor::create(move(stream)));
@@ -40,7 +40,7 @@ TEST_CASE(zlib_compress_simple)
         0xE8
     };
 
-    const u8 uncompressed[] = "This is a simple text file :)";
+    u8 const uncompressed[] = "This is a simple text file :)";
 
     auto const freshly_pressed = Compress::ZlibCompressor::compress_all({ uncompressed, sizeof(uncompressed) - 1 });
     EXPECT(freshly_pressed.value().bytes() == compressed.span());

+ 79 - 77
Tests/LibCrypto/TestBigInteger.cpp

@@ -664,96 +664,98 @@ TEST_CASE(test_negative_zero_is_not_allowed)
     EXPECT(!zero.is_negative());
 }
 
-TEST_CASE(double_comparisons) {
+TEST_CASE(double_comparisons)
+{
 #define EXPECT_LESS_THAN(bigint, double_value) EXPECT_EQ(bigint.compare_to_double(double_value), Crypto::UnsignedBigInteger::CompareResult::DoubleGreaterThanBigInt)
 #define EXPECT_GREATER_THAN(bigint, double_value) EXPECT_EQ(bigint.compare_to_double(double_value), Crypto::UnsignedBigInteger::CompareResult::DoubleLessThanBigInt)
 #define EXPECT_EQUAL_TO(bigint, double_value) EXPECT_EQ(bigint.compare_to_double(double_value), Crypto::UnsignedBigInteger::CompareResult::DoubleEqualsBigInt)
-    { Crypto::SignedBigInteger zero { 0 };
-EXPECT_EQUAL_TO(zero, 0.0);
-EXPECT_EQUAL_TO(zero, -0.0);
-}
-
-{
-    Crypto::SignedBigInteger one { 1 };
-    EXPECT_EQUAL_TO(one, 1.0);
-    EXPECT_GREATER_THAN(one, -1.0);
-    EXPECT_GREATER_THAN(one, 0.5);
-    EXPECT_GREATER_THAN(one, -0.5);
-    EXPECT_LESS_THAN(one, 1.000001);
-
-    one.negate();
-    auto const& negative_one = one;
-    EXPECT_EQUAL_TO(negative_one, -1.0);
-    EXPECT_LESS_THAN(negative_one, 1.0);
-    EXPECT_LESS_THAN(one, 0.5);
-    EXPECT_LESS_THAN(one, -0.5);
-    EXPECT_GREATER_THAN(one, -1.5);
-    EXPECT_LESS_THAN(one, 1.000001);
-    EXPECT_GREATER_THAN(one, -1.000001);
-}
-
-{
-    double double_infinity = HUGE_VAL;
-    VERIFY(isinf(double_infinity));
-    Crypto::SignedBigInteger one { 1 };
-    EXPECT_LESS_THAN(one, double_infinity);
-    EXPECT_GREATER_THAN(one, -double_infinity);
-}
+    {
+        Crypto::SignedBigInteger zero { 0 };
+        EXPECT_EQUAL_TO(zero, 0.0);
+        EXPECT_EQUAL_TO(zero, -0.0);
+    }
 
-{
-    double double_max_value = NumericLimits<double>::max();
-    double double_below_max_value = nextafter(double_max_value, 0.0);
-    VERIFY(double_below_max_value < double_max_value);
-    VERIFY(double_below_max_value < (double_max_value - 1.0));
-    auto max_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "fffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
-    auto max_value_plus_one = max_value_in_bigint.plus(Crypto::SignedBigInteger { 1 });
-    auto max_value_minus_one = max_value_in_bigint.minus(Crypto::SignedBigInteger { 1 });
+    {
+        Crypto::SignedBigInteger one { 1 };
+        EXPECT_EQUAL_TO(one, 1.0);
+        EXPECT_GREATER_THAN(one, -1.0);
+        EXPECT_GREATER_THAN(one, 0.5);
+        EXPECT_GREATER_THAN(one, -0.5);
+        EXPECT_LESS_THAN(one, 1.000001);
 
-    auto below_max_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
+        one.negate();
+        auto const& negative_one = one;
+        EXPECT_EQUAL_TO(negative_one, -1.0);
+        EXPECT_LESS_THAN(negative_one, 1.0);
+        EXPECT_LESS_THAN(one, 0.5);
+        EXPECT_LESS_THAN(one, -0.5);
+        EXPECT_GREATER_THAN(one, -1.5);
+        EXPECT_LESS_THAN(one, 1.000001);
+        EXPECT_GREATER_THAN(one, -1.000001);
+    }
 
-    EXPECT_EQUAL_TO(max_value_in_bigint, double_max_value);
-    EXPECT_LESS_THAN(max_value_minus_one, double_max_value);
-    EXPECT_GREATER_THAN(max_value_plus_one, double_max_value);
-    EXPECT_LESS_THAN(below_max_value_in_bigint, double_max_value);
+    {
+        double double_infinity = HUGE_VAL;
+        VERIFY(isinf(double_infinity));
+        Crypto::SignedBigInteger one { 1 };
+        EXPECT_LESS_THAN(one, double_infinity);
+        EXPECT_GREATER_THAN(one, -double_infinity);
+    }
 
-    EXPECT_GREATER_THAN(max_value_in_bigint, double_below_max_value);
-    EXPECT_GREATER_THAN(max_value_minus_one, double_below_max_value);
-    EXPECT_GREATER_THAN(max_value_plus_one, double_below_max_value);
-    EXPECT_EQUAL_TO(below_max_value_in_bigint, double_below_max_value);
-}
+    {
+        double double_max_value = NumericLimits<double>::max();
+        double double_below_max_value = nextafter(double_max_value, 0.0);
+        VERIFY(double_below_max_value < double_max_value);
+        VERIFY(double_below_max_value < (double_max_value - 1.0));
+        auto max_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "fffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
+        auto max_value_plus_one = max_value_in_bigint.plus(Crypto::SignedBigInteger { 1 });
+        auto max_value_minus_one = max_value_in_bigint.minus(Crypto::SignedBigInteger { 1 });
 
-{
-    double double_min_value = NumericLimits<double>::lowest();
-    double double_above_min_value = nextafter(double_min_value, 0.0);
-    VERIFY(double_above_min_value > double_min_value);
-    VERIFY(double_above_min_value > (double_min_value + 1.0));
-    auto min_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "-fffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
-    auto min_value_plus_one = min_value_in_bigint.plus(Crypto::SignedBigInteger { 1 });
-    auto min_value_minus_one = min_value_in_bigint.minus(Crypto::SignedBigInteger { 1 });
+        auto below_max_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
 
-    auto above_min_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "-fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
+        EXPECT_EQUAL_TO(max_value_in_bigint, double_max_value);
+        EXPECT_LESS_THAN(max_value_minus_one, double_max_value);
+        EXPECT_GREATER_THAN(max_value_plus_one, double_max_value);
+        EXPECT_LESS_THAN(below_max_value_in_bigint, double_max_value);
 
-    EXPECT_EQUAL_TO(min_value_in_bigint, double_min_value);
-    EXPECT_LESS_THAN(min_value_minus_one, double_min_value);
-    EXPECT_GREATER_THAN(min_value_plus_one, double_min_value);
-    EXPECT_GREATER_THAN(above_min_value_in_bigint, double_min_value);
+        EXPECT_GREATER_THAN(max_value_in_bigint, double_below_max_value);
+        EXPECT_GREATER_THAN(max_value_minus_one, double_below_max_value);
+        EXPECT_GREATER_THAN(max_value_plus_one, double_below_max_value);
+        EXPECT_EQUAL_TO(below_max_value_in_bigint, double_below_max_value);
+    }
 
-    EXPECT_LESS_THAN(min_value_in_bigint, double_above_min_value);
-    EXPECT_LESS_THAN(min_value_minus_one, double_above_min_value);
-    EXPECT_LESS_THAN(min_value_plus_one, double_above_min_value);
-    EXPECT_EQUAL_TO(above_min_value_in_bigint, double_above_min_value);
-}
+    {
+        double double_min_value = NumericLimits<double>::lowest();
+        double double_above_min_value = nextafter(double_min_value, 0.0);
+        VERIFY(double_above_min_value > double_min_value);
+        VERIFY(double_above_min_value > (double_min_value + 1.0));
+        auto min_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "-fffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
+        auto min_value_plus_one = min_value_in_bigint.plus(Crypto::SignedBigInteger { 1 });
+        auto min_value_minus_one = min_value_in_bigint.minus(Crypto::SignedBigInteger { 1 });
+
+        auto above_min_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "-fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv));
+
+        EXPECT_EQUAL_TO(min_value_in_bigint, double_min_value);
+        EXPECT_LESS_THAN(min_value_minus_one, double_min_value);
+        EXPECT_GREATER_THAN(min_value_plus_one, double_min_value);
+        EXPECT_GREATER_THAN(above_min_value_in_bigint, double_min_value);
+
+        EXPECT_LESS_THAN(min_value_in_bigint, double_above_min_value);
+        EXPECT_LESS_THAN(min_value_minus_one, double_above_min_value);
+        EXPECT_LESS_THAN(min_value_plus_one, double_above_min_value);
+        EXPECT_EQUAL_TO(above_min_value_in_bigint, double_above_min_value);
+    }
 
-{
-    double just_above_255 = bit_cast<double>(0x406fe00000000001ULL);
-    double just_below_255 = bit_cast<double>(0x406fdfffffffffffULL);
-    double double_255 = 255.0;
-    Crypto::SignedBigInteger bigint_255 { 255 };
+    {
+        double just_above_255 = bit_cast<double>(0x406fe00000000001ULL);
+        double just_below_255 = bit_cast<double>(0x406fdfffffffffffULL);
+        double double_255 = 255.0;
+        Crypto::SignedBigInteger bigint_255 { 255 };
 
-    EXPECT_EQUAL_TO(bigint_255, double_255);
-    EXPECT_GREATER_THAN(bigint_255, just_below_255);
-    EXPECT_LESS_THAN(bigint_255, just_above_255);
-}
+        EXPECT_EQUAL_TO(bigint_255, double_255);
+        EXPECT_GREATER_THAN(bigint_255, just_below_255);
+        EXPECT_LESS_THAN(bigint_255, just_above_255);
+    }
 
 #undef EXPECT_LESS_THAN
 #undef EXPECT_GREATER_THAN

+ 4 - 4
Tests/LibEDID/TestEDID.cpp

@@ -8,7 +8,7 @@
 #include <LibEDID/EDID.h>
 #include <LibTest/TestCase.h>
 
-static const u8 edid1_bin[] = {
+static u8 const edid1_bin[] = {
     0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x49, 0x14, 0x34, 0x12,
     0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x01, 0x04, 0xa5, 0x1a, 0x13, 0x78,
     0x06, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54, 0x21,
@@ -170,7 +170,7 @@ TEST_CASE(edid1)
     }
 }
 
-static const u8 edid2_bin[] = {
+static u8 const edid2_bin[] = {
     0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x72, 0x1d, 0x08,
     0xd2, 0x02, 0x96, 0x49, 0x20, 0x1e, 0x01, 0x04, 0xb5, 0x3c, 0x22, 0x78,
     0x3b, 0xff, 0x15, 0xa6, 0x53, 0x4a, 0x98, 0x26, 0x0f, 0x50, 0x54, 0xbf,
@@ -353,7 +353,7 @@ TEST_CASE(edid2)
 }
 
 // This EDID has extension maps
-static const u8 edid_extension_maps[] = {
+static u8 const edid_extension_maps[] = {
     0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x4d, 0x29, 0x48, 0x44,
     0x01, 0x00, 0x00, 0x00, 0x0a, 0x0d, 0x01, 0x03, 0x80, 0x50, 0x2d, 0x78,
     0x0a, 0x0d, 0xc9, 0xa0, 0x57, 0x47, 0x98, 0x27, 0x12, 0x48, 0x4c, 0x20,
@@ -439,7 +439,7 @@ TEST_CASE(edid_extension_maps)
     }
 }
 
-static const u8 edid_1_0[] = {
+static u8 const edid_1_0[] = {
     0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x34, 0x38, 0xc2, 0x0b,
     0x7b, 0x00, 0x00, 0x00, 0x0f, 0x0a, 0x01, 0x00, 0x28, 0x20, 0x18, 0x32,
     0xe8, 0x7e, 0x4e, 0x9e, 0x57, 0x45, 0x98, 0x24, 0x10, 0x47, 0x4f, 0xa4,

+ 26 - 26
Tests/LibSQL/TestSqlExpressionParser.cpp

@@ -61,7 +61,7 @@ TEST_CASE(numeric_literal)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::NumericLiteral>(*expression));
 
-        const auto& literal = static_cast<const SQL::AST::NumericLiteral&>(*expression);
+        auto const& literal = static_cast<const SQL::AST::NumericLiteral&>(*expression);
         EXPECT_EQ(literal.value(), expected_value);
     };
 
@@ -82,7 +82,7 @@ TEST_CASE(string_literal)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::StringLiteral>(*expression));
 
-        const auto& literal = static_cast<const SQL::AST::StringLiteral&>(*expression);
+        auto const& literal = static_cast<const SQL::AST::StringLiteral&>(*expression);
         EXPECT_EQ(literal.value(), expected_value);
     };
 
@@ -101,7 +101,7 @@ TEST_CASE(blob_literal)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::BlobLiteral>(*expression));
 
-        const auto& literal = static_cast<const SQL::AST::BlobLiteral&>(*expression);
+        auto const& literal = static_cast<const SQL::AST::BlobLiteral&>(*expression);
         EXPECT_EQ(literal.value(), expected_value);
     };
 
@@ -154,7 +154,7 @@ TEST_CASE(column_name)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::ColumnNameExpression>(*expression));
 
-        const auto& column = static_cast<const SQL::AST::ColumnNameExpression&>(*expression);
+        auto const& column = static_cast<const SQL::AST::ColumnNameExpression&>(*expression);
         EXPECT_EQ(column.schema_name(), expected_schema);
         EXPECT_EQ(column.table_name(), expected_table);
         EXPECT_EQ(column.column_name(), expected_column);
@@ -181,10 +181,10 @@ TEST_CASE(unary_operator)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::UnaryOperatorExpression>(*expression));
 
-        const auto& unary = static_cast<const SQL::AST::UnaryOperatorExpression&>(*expression);
+        auto const& unary = static_cast<const SQL::AST::UnaryOperatorExpression&>(*expression);
         EXPECT_EQ(unary.type(), expected_operator);
 
-        const auto& secondary_expression = unary.expression();
+        auto const& secondary_expression = unary.expression();
         EXPECT(!is<SQL::AST::ErrorExpression>(*secondary_expression));
     };
 
@@ -240,7 +240,7 @@ TEST_CASE(binary_operator)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::BinaryOperatorExpression>(*expression));
 
-        const auto& binary = static_cast<const SQL::AST::BinaryOperatorExpression&>(*expression);
+        auto const& binary = static_cast<const SQL::AST::BinaryOperatorExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*binary.lhs()));
         EXPECT(!is<SQL::AST::ErrorExpression>(*binary.rhs()));
         EXPECT_EQ(binary.type(), expected_operator);
@@ -265,10 +265,10 @@ TEST_CASE(chained_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::ChainedExpression>(*expression));
 
-        const auto& chain = static_cast<const SQL::AST::ChainedExpression&>(*expression).expressions();
+        auto const& chain = static_cast<const SQL::AST::ChainedExpression&>(*expression).expressions();
         EXPECT_EQ(chain.size(), expected_chain_size);
 
-        for (const auto& chained_expression : chain)
+        for (auto const& chained_expression : chain)
             EXPECT(!is<SQL::AST::ErrorExpression>(chained_expression));
     };
 
@@ -291,10 +291,10 @@ TEST_CASE(cast_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::CastExpression>(*expression));
 
-        const auto& cast = static_cast<const SQL::AST::CastExpression&>(*expression);
+        auto const& cast = static_cast<const SQL::AST::CastExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*cast.expression()));
 
-        const auto& type_name = cast.type_name();
+        auto const& type_name = cast.type_name();
         EXPECT_EQ(type_name->name(), expected_type_name);
     };
 
@@ -322,21 +322,21 @@ TEST_CASE(case_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::CaseExpression>(*expression));
 
-        const auto& case_ = static_cast<const SQL::AST::CaseExpression&>(*expression);
+        auto const& case_ = static_cast<const SQL::AST::CaseExpression&>(*expression);
 
-        const auto& case_expression = case_.case_expression();
+        auto const& case_expression = case_.case_expression();
         EXPECT_EQ(case_expression.is_null(), !expect_case_expression);
         if (case_expression)
             EXPECT(!is<SQL::AST::ErrorExpression>(*case_expression));
 
-        const auto& when_then_clauses = case_.when_then_clauses();
+        auto const& when_then_clauses = case_.when_then_clauses();
         EXPECT_EQ(when_then_clauses.size(), expected_when_then_size);
-        for (const auto& when_then_clause : when_then_clauses) {
+        for (auto const& when_then_clause : when_then_clauses) {
             EXPECT(!is<SQL::AST::ErrorExpression>(*when_then_clause.when));
             EXPECT(!is<SQL::AST::ErrorExpression>(*when_then_clause.then));
         }
 
-        const auto& else_expression = case_.else_expression();
+        auto const& else_expression = case_.else_expression();
         EXPECT_EQ(else_expression.is_null(), !expect_else_expression);
         if (else_expression)
             EXPECT(!is<SQL::AST::ErrorExpression>(*else_expression));
@@ -372,7 +372,7 @@ TEST_CASE(exists_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::ExistsExpression>(*expression));
 
-        const auto& exists = static_cast<const SQL::AST::ExistsExpression&>(*expression);
+        auto const& exists = static_cast<const SQL::AST::ExistsExpression&>(*expression);
         EXPECT_EQ(exists.invert_expression(), expected_invert_expression);
     };
 
@@ -391,7 +391,7 @@ TEST_CASE(collate_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::CollateExpression>(*expression));
 
-        const auto& collate = static_cast<const SQL::AST::CollateExpression&>(*expression);
+        auto const& collate = static_cast<const SQL::AST::CollateExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*collate.expression()));
         EXPECT_EQ(collate.collation_name(), expected_collation_name);
     };
@@ -413,7 +413,7 @@ TEST_CASE(is_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::IsExpression>(*expression));
 
-        const auto& is_ = static_cast<const SQL::AST::IsExpression&>(*expression);
+        auto const& is_ = static_cast<const SQL::AST::IsExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*is_.lhs()));
         EXPECT(!is<SQL::AST::ErrorExpression>(*is_.rhs()));
         EXPECT_EQ(is_.invert_expression(), expected_invert_expression);
@@ -450,7 +450,7 @@ TEST_CASE(match_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::MatchExpression>(*expression));
 
-        const auto& match = static_cast<const SQL::AST::MatchExpression&>(*expression);
+        auto const& match = static_cast<const SQL::AST::MatchExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*match.lhs()));
         EXPECT(!is<SQL::AST::ErrorExpression>(*match.rhs()));
         EXPECT_EQ(match.type(), expected_operator);
@@ -489,7 +489,7 @@ TEST_CASE(null_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::NullExpression>(*expression));
 
-        const auto& null = static_cast<const SQL::AST::NullExpression&>(*expression);
+        auto const& null = static_cast<const SQL::AST::NullExpression&>(*expression);
         EXPECT_EQ(null.invert_expression(), expected_invert_expression);
     };
 
@@ -513,7 +513,7 @@ TEST_CASE(between_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::BetweenExpression>(*expression));
 
-        const auto& between = static_cast<const SQL::AST::BetweenExpression&>(*expression);
+        auto const& between = static_cast<const SQL::AST::BetweenExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*between.expression()));
         EXPECT(!is<SQL::AST::ErrorExpression>(*between.lhs()));
         EXPECT(!is<SQL::AST::ErrorExpression>(*between.rhs()));
@@ -535,7 +535,7 @@ TEST_CASE(in_table_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::InTableExpression>(*expression));
 
-        const auto& in = static_cast<const SQL::AST::InTableExpression&>(*expression);
+        auto const& in = static_cast<const SQL::AST::InTableExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*in.expression()));
         EXPECT_EQ(in.schema_name(), expected_schema);
         EXPECT_EQ(in.table_name(), expected_table);
@@ -558,12 +558,12 @@ TEST_CASE(in_chained_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::InChainedExpression>(*expression));
 
-        const auto& in = static_cast<const SQL::AST::InChainedExpression&>(*expression);
+        auto const& in = static_cast<const SQL::AST::InChainedExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*in.expression()));
         EXPECT_EQ(in.expression_chain()->expressions().size(), expected_chain_size);
         EXPECT_EQ(in.invert_expression(), expected_invert_expression);
 
-        for (const auto& chained_expression : in.expression_chain()->expressions())
+        for (auto const& chained_expression : in.expression_chain()->expressions())
             EXPECT(!is<SQL::AST::ErrorExpression>(chained_expression));
     };
 
@@ -587,7 +587,7 @@ TEST_CASE(in_selection_expression)
         auto expression = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::InSelectionExpression>(*expression));
 
-        const auto& in = static_cast<const SQL::AST::InSelectionExpression&>(*expression);
+        auto const& in = static_cast<const SQL::AST::InSelectionExpression&>(*expression);
         EXPECT(!is<SQL::AST::ErrorExpression>(*in.expression()));
         EXPECT_EQ(in.invert_expression(), expected_invert_expression);
     };

+ 59 - 59
Tests/LibSQL/TestSqlStatementParser.cpp

@@ -69,7 +69,7 @@ TEST_CASE(create_table)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::CreateTable>(*statement));
 
-        const auto& table = static_cast<const SQL::AST::CreateTable&>(*statement);
+        auto const& table = static_cast<const SQL::AST::CreateTable&>(*statement);
         EXPECT_EQ(table.schema_name(), expected_schema);
         EXPECT_EQ(table.table_name(), expected_table);
         EXPECT_EQ(table.is_temporary(), expected_is_temporary);
@@ -79,21 +79,21 @@ TEST_CASE(create_table)
         EXPECT_EQ(table.has_selection(), expect_select_statement);
         EXPECT_EQ(table.has_columns(), !expect_select_statement);
 
-        const auto& select_statement = table.select_statement();
+        auto const& select_statement = table.select_statement();
         EXPECT_EQ(select_statement.is_null(), !expect_select_statement);
 
-        const auto& columns = table.columns();
+        auto const& columns = table.columns();
         EXPECT_EQ(columns.size(), expected_columns.size());
 
         for (size_t i = 0; i < columns.size(); ++i) {
-            const auto& column = columns[i];
-            const auto& expected_column = expected_columns[i];
+            auto const& column = columns[i];
+            auto const& expected_column = expected_columns[i];
             EXPECT_EQ(column->name(), expected_column.name);
 
-            const auto& type_name = column->type_name();
+            auto const& type_name = column->type_name();
             EXPECT_EQ(type_name->name(), expected_column.type);
 
-            const auto& signed_numbers = type_name->signed_numbers();
+            auto const& signed_numbers = type_name->signed_numbers();
             EXPECT_EQ(signed_numbers.size(), expected_column.signed_numbers.size());
 
             for (size_t j = 0; j < signed_numbers.size(); ++j) {
@@ -145,7 +145,7 @@ TEST_CASE(alter_table_rename_table)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::RenameTable>(*statement));
 
-        const auto& alter = static_cast<const SQL::AST::RenameTable&>(*statement);
+        auto const& alter = static_cast<const SQL::AST::RenameTable&>(*statement);
         EXPECT_EQ(alter.schema_name(), expected_schema);
         EXPECT_EQ(alter.table_name(), expected_table);
         EXPECT_EQ(alter.new_table_name(), expected_new_table);
@@ -170,7 +170,7 @@ TEST_CASE(alter_table_rename_column)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::RenameColumn>(*statement));
 
-        const auto& alter = static_cast<const SQL::AST::RenameColumn&>(*statement);
+        auto const& alter = static_cast<const SQL::AST::RenameColumn&>(*statement);
         EXPECT_EQ(alter.schema_name(), expected_schema);
         EXPECT_EQ(alter.table_name(), expected_table);
         EXPECT_EQ(alter.column_name(), expected_column);
@@ -199,17 +199,17 @@ TEST_CASE(alter_table_add_column)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::AddColumn>(*statement));
 
-        const auto& alter = static_cast<const SQL::AST::AddColumn&>(*statement);
+        auto const& alter = static_cast<const SQL::AST::AddColumn&>(*statement);
         EXPECT_EQ(alter.schema_name(), expected_schema);
         EXPECT_EQ(alter.table_name(), expected_table);
 
-        const auto& column = alter.column();
+        auto const& column = alter.column();
         EXPECT_EQ(column->name(), expected_column.name);
 
-        const auto& type_name = column->type_name();
+        auto const& type_name = column->type_name();
         EXPECT_EQ(type_name->name(), expected_column.type);
 
-        const auto& signed_numbers = type_name->signed_numbers();
+        auto const& signed_numbers = type_name->signed_numbers();
         EXPECT_EQ(signed_numbers.size(), expected_column.signed_numbers.size());
 
         for (size_t j = 0; j < signed_numbers.size(); ++j) {
@@ -243,7 +243,7 @@ TEST_CASE(alter_table_drop_column)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::DropColumn>(*statement));
 
-        const auto& alter = static_cast<const SQL::AST::DropColumn&>(*statement);
+        auto const& alter = static_cast<const SQL::AST::DropColumn&>(*statement);
         EXPECT_EQ(alter.schema_name(), expected_schema);
         EXPECT_EQ(alter.table_name(), expected_table);
         EXPECT_EQ(alter.column_name(), expected_column);
@@ -266,7 +266,7 @@ TEST_CASE(drop_table)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::DropTable>(*statement));
 
-        const auto& table = static_cast<const SQL::AST::DropTable&>(*statement);
+        auto const& table = static_cast<const SQL::AST::DropTable&>(*statement);
         EXPECT_EQ(table.schema_name(), expected_schema);
         EXPECT_EQ(table.table_name(), expected_table);
         EXPECT_EQ(table.is_error_if_table_does_not_exist(), expected_is_error_if_table_does_not_exist);
@@ -304,28 +304,28 @@ TEST_CASE(insert)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::Insert>(*statement));
 
-        const auto& insert = static_cast<const SQL::AST::Insert&>(*statement);
+        auto const& insert = static_cast<const SQL::AST::Insert&>(*statement);
         EXPECT_EQ(insert.conflict_resolution(), expected_conflict_resolution);
         EXPECT_EQ(insert.schema_name(), expected_schema);
         EXPECT_EQ(insert.table_name(), expected_table);
         EXPECT_EQ(insert.alias(), expected_alias);
 
-        const auto& column_names = insert.column_names();
+        auto const& column_names = insert.column_names();
         EXPECT_EQ(column_names.size(), expected_column_names.size());
         for (size_t i = 0; i < column_names.size(); ++i)
             EXPECT_EQ(column_names[i], expected_column_names[i]);
 
         EXPECT_EQ(insert.has_expressions(), !expected_chain_sizes.is_empty());
         if (insert.has_expressions()) {
-            const auto& chained_expressions = insert.chained_expressions();
+            auto const& chained_expressions = insert.chained_expressions();
             EXPECT_EQ(chained_expressions.size(), expected_chain_sizes.size());
 
             for (size_t i = 0; i < chained_expressions.size(); ++i) {
-                const auto& chained_expression = chained_expressions[i];
-                const auto& expressions = chained_expression->expressions();
+                auto const& chained_expression = chained_expressions[i];
+                auto const& expressions = chained_expression->expressions();
                 EXPECT_EQ(expressions.size(), expected_chain_sizes[i]);
 
-                for (const auto& expression : expressions)
+                for (auto const& expression : expressions)
                     EXPECT(!is<SQL::AST::ErrorExpression>(expression));
             }
         }
@@ -397,19 +397,19 @@ TEST_CASE(update)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::Update>(*statement));
 
-        const auto& update = static_cast<const SQL::AST::Update&>(*statement);
+        auto const& update = static_cast<const SQL::AST::Update&>(*statement);
         EXPECT_EQ(update.conflict_resolution(), expected_conflict_resolution);
 
-        const auto& qualified_table_name = update.qualified_table_name();
+        auto const& qualified_table_name = update.qualified_table_name();
         EXPECT_EQ(qualified_table_name->schema_name(), expected_schema);
         EXPECT_EQ(qualified_table_name->table_name(), expected_table);
         EXPECT_EQ(qualified_table_name->alias(), expected_alias);
 
-        const auto& update_columns = update.update_columns();
+        auto const& update_columns = update.update_columns();
         EXPECT_EQ(update_columns.size(), expected_update_columns.size());
         for (size_t i = 0; i < update_columns.size(); ++i) {
-            const auto& update_column = update_columns[i];
-            const auto& expected_update_column = expected_update_columns[i];
+            auto const& update_column = update_columns[i];
+            auto const& expected_update_column = expected_update_columns[i];
             EXPECT_EQ(update_column.column_names.size(), expected_update_column.size());
             EXPECT(!is<SQL::AST::ErrorExpression>(*update_column.expression));
 
@@ -417,19 +417,19 @@ TEST_CASE(update)
                 EXPECT_EQ(update_column.column_names[j], expected_update_column[j]);
         }
 
-        const auto& where_clause = update.where_clause();
+        auto const& where_clause = update.where_clause();
         EXPECT_EQ(where_clause.is_null(), !expect_where_clause);
         if (where_clause)
             EXPECT(!is<SQL::AST::ErrorExpression>(*where_clause));
 
-        const auto& returning_clause = update.returning_clause();
+        auto const& returning_clause = update.returning_clause();
         EXPECT_EQ(returning_clause.is_null(), !expect_returning_clause);
         if (returning_clause) {
             EXPECT_EQ(returning_clause->columns().size(), expected_returned_column_aliases.size());
 
             for (size_t i = 0; i < returning_clause->columns().size(); ++i) {
-                const auto& column = returning_clause->columns()[i];
-                const auto& expected_column_alias = expected_returned_column_aliases[i];
+                auto const& column = returning_clause->columns()[i];
+                auto const& expected_column_alias = expected_returned_column_aliases[i];
 
                 EXPECT(!is<SQL::AST::ErrorExpression>(*column.expression));
                 EXPECT_EQ(column.column_alias, expected_column_alias);
@@ -491,26 +491,26 @@ TEST_CASE(delete_)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::Delete>(*statement));
 
-        const auto& delete_ = static_cast<const SQL::AST::Delete&>(*statement);
+        auto const& delete_ = static_cast<const SQL::AST::Delete&>(*statement);
 
-        const auto& qualified_table_name = delete_.qualified_table_name();
+        auto const& qualified_table_name = delete_.qualified_table_name();
         EXPECT_EQ(qualified_table_name->schema_name(), expected_schema);
         EXPECT_EQ(qualified_table_name->table_name(), expected_table);
         EXPECT_EQ(qualified_table_name->alias(), expected_alias);
 
-        const auto& where_clause = delete_.where_clause();
+        auto const& where_clause = delete_.where_clause();
         EXPECT_EQ(where_clause.is_null(), !expect_where_clause);
         if (where_clause)
             EXPECT(!is<SQL::AST::ErrorExpression>(*where_clause));
 
-        const auto& returning_clause = delete_.returning_clause();
+        auto const& returning_clause = delete_.returning_clause();
         EXPECT_EQ(returning_clause.is_null(), !expect_returning_clause);
         if (returning_clause) {
             EXPECT_EQ(returning_clause->columns().size(), expected_returned_column_aliases.size());
 
             for (size_t i = 0; i < returning_clause->columns().size(); ++i) {
-                const auto& column = returning_clause->columns()[i];
-                const auto& expected_column_alias = expected_returned_column_aliases[i];
+                auto const& column = returning_clause->columns()[i];
+                auto const& expected_column_alias = expected_returned_column_aliases[i];
 
                 EXPECT(!is<SQL::AST::ErrorExpression>(*column.expression));
                 EXPECT_EQ(column.column_alias, expected_column_alias);
@@ -587,13 +587,13 @@ TEST_CASE(select)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::Select>(*statement));
 
-        const auto& select = static_cast<const SQL::AST::Select&>(*statement);
+        auto const& select = static_cast<const SQL::AST::Select&>(*statement);
 
-        const auto& result_column_list = select.result_column_list();
+        auto const& result_column_list = select.result_column_list();
         EXPECT_EQ(result_column_list.size(), expected_columns.size());
         for (size_t i = 0; i < result_column_list.size(); ++i) {
-            const auto& result_column = result_column_list[i];
-            const auto& expected_column = expected_columns[i];
+            auto const& result_column = result_column_list[i];
+            auto const& expected_column = expected_columns[i];
             EXPECT_EQ(result_column->type(), expected_column.type);
 
             switch (result_column->type()) {
@@ -609,53 +609,53 @@ TEST_CASE(select)
             }
         }
 
-        const auto& table_or_subquery_list = select.table_or_subquery_list();
+        auto const& table_or_subquery_list = select.table_or_subquery_list();
         EXPECT_EQ(table_or_subquery_list.size(), expected_from_list.size());
         for (size_t i = 0; i < table_or_subquery_list.size(); ++i) {
-            const auto& result_from = table_or_subquery_list[i];
-            const auto& expected_from = expected_from_list[i];
+            auto const& result_from = table_or_subquery_list[i];
+            auto const& expected_from = expected_from_list[i];
             EXPECT_EQ(result_from->schema_name(), expected_from.schema_name);
             EXPECT_EQ(result_from->table_name(), expected_from.table_name);
             EXPECT_EQ(result_from->table_alias(), expected_from.table_alias);
         }
 
-        const auto& where_clause = select.where_clause();
+        auto const& where_clause = select.where_clause();
         EXPECT_EQ(where_clause.is_null(), !expect_where_clause);
         if (where_clause)
             EXPECT(!is<SQL::AST::ErrorExpression>(*where_clause));
 
-        const auto& group_by_clause = select.group_by_clause();
+        auto const& group_by_clause = select.group_by_clause();
         EXPECT_EQ(group_by_clause.is_null(), (expected_group_by_size == 0));
         if (group_by_clause) {
-            const auto& group_by_list = group_by_clause->group_by_list();
+            auto const& group_by_list = group_by_clause->group_by_list();
             EXPECT_EQ(group_by_list.size(), expected_group_by_size);
             for (size_t i = 0; i < group_by_list.size(); ++i)
                 EXPECT(!is<SQL::AST::ErrorExpression>(group_by_list[i]));
 
-            const auto& having_clause = group_by_clause->having_clause();
+            auto const& having_clause = group_by_clause->having_clause();
             EXPECT_EQ(having_clause.is_null(), !expect_having_clause);
             if (having_clause)
                 EXPECT(!is<SQL::AST::ErrorExpression>(*having_clause));
         }
 
-        const auto& ordering_term_list = select.ordering_term_list();
+        auto const& ordering_term_list = select.ordering_term_list();
         EXPECT_EQ(ordering_term_list.size(), expected_ordering.size());
         for (size_t i = 0; i < ordering_term_list.size(); ++i) {
-            const auto& result_order = ordering_term_list[i];
-            const auto& expected_order = expected_ordering[i];
+            auto const& result_order = ordering_term_list[i];
+            auto const& expected_order = expected_ordering[i];
             EXPECT(!is<SQL::AST::ErrorExpression>(*result_order->expression()));
             EXPECT_EQ(result_order->collation_name(), expected_order.collation_name);
             EXPECT_EQ(result_order->order(), expected_order.order);
             EXPECT_EQ(result_order->nulls(), expected_order.nulls);
         }
 
-        const auto& limit_clause = select.limit_clause();
+        auto const& limit_clause = select.limit_clause();
         EXPECT_EQ(limit_clause.is_null(), !expect_limit_clause);
         if (limit_clause) {
-            const auto& limit_expression = limit_clause->limit_expression();
+            auto const& limit_expression = limit_clause->limit_expression();
             EXPECT(!is<SQL::AST::ErrorExpression>(*limit_expression));
 
-            const auto& offset_expression = limit_clause->offset_expression();
+            auto const& offset_expression = limit_clause->offset_expression();
             EXPECT_EQ(offset_expression.is_null(), !expect_offset_clause);
             if (offset_expression)
                 EXPECT(!is<SQL::AST::ErrorExpression>(*offset_expression));
@@ -723,19 +723,19 @@ TEST_CASE(common_table_expression)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::Delete>(*statement));
 
-        const auto& delete_ = static_cast<const SQL::AST::Delete&>(*statement);
+        auto const& delete_ = static_cast<const SQL::AST::Delete&>(*statement);
 
-        const auto& common_table_expression_list = delete_.common_table_expression_list();
+        auto const& common_table_expression_list = delete_.common_table_expression_list();
         EXPECT(!common_table_expression_list.is_null());
 
         EXPECT_EQ(common_table_expression_list->recursive(), expected_selected_tables.recursive);
 
-        const auto& common_table_expressions = common_table_expression_list->common_table_expressions();
+        auto const& common_table_expressions = common_table_expression_list->common_table_expressions();
         EXPECT_EQ(common_table_expressions.size(), expected_selected_tables.selected_tables.size());
 
         for (size_t i = 0; i < common_table_expressions.size(); ++i) {
-            const auto& common_table_expression = common_table_expressions[i];
-            const auto& expected_common_table_expression = expected_selected_tables.selected_tables[i];
+            auto const& common_table_expression = common_table_expressions[i];
+            auto const& expected_common_table_expression = expected_selected_tables.selected_tables[i];
             EXPECT_EQ(common_table_expression->table_name(), expected_common_table_expression.table_name);
             EXPECT_EQ(common_table_expression->column_names().size(), expected_common_table_expression.column_names.size());
 
@@ -775,7 +775,7 @@ TEST_CASE(describe_table)
         auto statement = TRY_OR_FAIL(parse(sql));
         EXPECT(is<SQL::AST::DescribeTable>(*statement));
 
-        const auto& describe_table_statement = static_cast<const SQL::AST::DescribeTable&>(*statement);
+        auto const& describe_table_statement = static_cast<const SQL::AST::DescribeTable&>(*statement);
         EXPECT_EQ(describe_table_statement.qualified_table_name()->schema_name(), expected_schema);
         EXPECT_EQ(describe_table_statement.qualified_table_name()->table_name(), expected_table);
     };

+ 4 - 4
Tests/LibWasm/test-wasm.cpp

@@ -176,8 +176,8 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export)
                     [&](u128 value) -> JS::Value { return JS::BigInt::create(vm, Crypto::SignedBigInteger::import_data(bit_cast<u8 const*>(&value), sizeof(value))); },
                     [&](Wasm::Reference const& reference) -> JS::Value {
                         return reference.ref().visit(
-                            [&](const Wasm::Reference::Null&) -> JS::Value { return JS::js_null(); },
-                            [&](const auto& ref) -> JS::Value { return JS::Value(static_cast<double>(ref.address.value())); });
+                            [&](Wasm::Reference::Null const&) -> JS::Value { return JS::js_null(); },
+                            [&](auto const& ref) -> JS::Value { return JS::Value(static_cast<double>(ref.address.value())); });
                     });
             }
             return vm.throw_completion<JS::TypeError>(TRY_OR_THROW_OOM(vm, String::formatted("'{}' does not refer to a function or a global", name)));
@@ -277,8 +277,8 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
             },
             [](Wasm::Reference const& reference) {
                 return reference.ref().visit(
-                    [](const Wasm::Reference::Null&) { return JS::js_null(); },
-                    [](const auto& ref) { return JS::Value(static_cast<double>(ref.address.value())); });
+                    [](Wasm::Reference::Null const&) { return JS::js_null(); },
+                    [](auto const& ref) { return JS::Value(static_cast<double>(ref.address.value())); });
             });
     };
 

+ 1 - 1
Userland/Libraries/LibC/netinet/in.h

@@ -50,7 +50,7 @@ static inline uint32_t ntohl(uint32_t value)
 #define IN_CLASSA(addr) ((((uint32_t)(addr)) & (128 << 24)) == 0)
 #define IN_CLASSB(addr) ((((uint32_t)(addr)) & (192 << 24)) == (128 << 24))
 
-#define IN_MULTICAST(x) (((x)&0xf0000000) == 0xe0000000)
+#define IN_MULTICAST(x) (((x) & 0xf0000000) == 0xe0000000)
 
 // NOTE: The IPv6 Addressing Scheme that we detect are documented in RFC# 2373.
 //       See: https://datatracker.ietf.org/doc/html/rfc2373

+ 1 - 1
Userland/Libraries/LibC/sys/param.h

@@ -18,5 +18,5 @@
 #endif
 
 #ifndef howmany
-#    define howmany(x, y) (((x) + ((y)-1)) / (y))
+#    define howmany(x, y) (((x) + ((y) - 1)) / (y))
 #endif

+ 2 - 2
Userland/Libraries/LibC/syslog.h

@@ -30,7 +30,7 @@ struct syslog_data {
 
 /* Macros for masking out the priority of a combined priority */
 #define LOG_PRIMASK (7)
-#define LOG_PRI(priority) ((priority)&LOG_PRIMASK)
+#define LOG_PRI(priority) ((priority) & LOG_PRIMASK)
 
 /*
  * Many of these facilities don't really make sense anymore, but we keep them
@@ -62,7 +62,7 @@ struct syslog_data {
 
 /* Macros to get the facility from a combined priority. */
 #define LOG_FACMASK (~7)
-#define LOG_FAC(priority) (((priority)&LOG_FACMASK) >> 3)
+#define LOG_FAC(priority) (((priority) & LOG_FACMASK) >> 3)
 
 /* For masking logs, we use these macros with just the priority. */
 #define LOG_MASK(priority) (1 << (priority))

+ 5 - 5
Userland/Libraries/LibELF/ELFABI.h

@@ -373,11 +373,11 @@ typedef struct {
 /* Extract symbol info - st_info */
 #define ELF32_ST_BIND(x) ((x) >> 4)
 #define ELF32_ST_TYPE(x) (((unsigned int)x) & 0xf)
-#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t)&0xf))
+#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf))
 
 #define ELF64_ST_BIND(x) ((x) >> 4)
 #define ELF64_ST_TYPE(x) (((unsigned int)x) & 0xf)
-#define ELF64_ST_INFO(b, t) (((b) << 4) + ((t)&0xf))
+#define ELF64_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf))
 
 /* Symbol Binding - ELF32_ST_BIND - st_info */
 #define STB_LOCAL 0   /* Local symbol */
@@ -399,7 +399,7 @@ typedef struct {
 #define STT_HIPROC 15 /*  specific symbol types */
 
 /* Extract symbol visibility - st_other */
-#define ELF_ST_VISIBILITY(v) ((v)&0x3)
+#define ELF_ST_VISIBILITY(v) ((v) & 0x3)
 #define ELF32_ST_VISIBILITY ELF_ST_VISIBILITY
 #define ELF64_ST_VISIBILITY ELF_ST_VISIBILITY
 
@@ -438,7 +438,7 @@ typedef struct {
 } Elf64_Rela;
 
 #define ELF64_R_SYM(info) ((info) >> 32)
-#define ELF64_R_TYPE(info) ((info)&0xFFFFFFFF)
+#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
 #define ELF64_R_INFO(s, t) (((s) << 32) + (uint32_t)(t))
 
 #if defined(__mips64__) && defined(__MIPSEL__)
@@ -451,7 +451,7 @@ typedef struct {
 #    undef ELF64_R_TYPE
 #    undef ELF64_R_INFO
 #    define ELF64_R_TYPE(info) ((uint64_t)swap32((info) >> 32))
-#    define ELF64_R_SYM(info) ((info)&0xFFFFFFFF)
+#    define ELF64_R_SYM(info) ((info) & 0xFFFFFFFF)
 #    define ELF64_R_INFO(s, t) (((uint64_t)swap32(t) << 32) + (uint32_t)(s))
 #endif /* __mips64__ && __MIPSEL__ */
 

+ 4 - 4
Userland/Libraries/LibGUI/Model.cpp

@@ -437,13 +437,13 @@ void Model::handle_move(Operation const& operation)
     auto replace_handle = [&](ModelIndex const& current_index, int new_dimension, bool relative) {
         int new_row = is_row
             ? (relative
-                    ? current_index.row() + new_dimension
-                    : new_dimension)
+                      ? current_index.row() + new_dimension
+                      : new_dimension)
             : current_index.row();
         int new_column = !is_row
             ? (relative
-                    ? current_index.column() + new_dimension
-                    : new_dimension)
+                      ? current_index.column() + new_dimension
+                      : new_dimension)
             : current_index.column();
         auto new_index = index(new_row, new_column, operation.target_parent);
 

+ 3 - 1
Userland/Libraries/LibGUI/Widget.cpp

@@ -128,7 +128,9 @@ Widget::Widget()
         });
 
 #define __ENUMERATE_COLOR_ROLE(role) \
-    { Gfx::ColorRole::role, #role },
+    {                                \
+        Gfx::ColorRole::role, #role  \
+    },
     REGISTER_ENUM_PROPERTY("foreground_role", foreground_role, set_foreground_role, Gfx::ColorRole,
         { Gfx::ColorRole::NoRole, "NoRole" },
         ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE));

+ 2 - 1
Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp

@@ -426,7 +426,8 @@ bool OS2::use_typographic_metrics() const
 Optional<i16> OS2::x_height() const
 {
     return m_data.visit(
-        []<typename T> requires(requires { T::sx_height; })(T * data)->Optional<i16> {
+        []<typename T>
+        requires(requires { T::sx_height; })(T * data) -> Optional<i16> {
             return data->sx_height;
         },
         [](auto*) { return Optional<i16>(); });

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h

@@ -44,8 +44,8 @@ public:
 
     MathematicalValue(Value value)
         : m_value(value.is_number()
-                ? value_from_number(value.as_double())
-                : ValueType(value.as_bigint().big_integer()))
+                  ? value_from_number(value.as_double())
+                  : ValueType(value.as_bigint().big_integer()))
     {
     }
 

+ 2 - 2
Userland/Libraries/LibJS/Runtime/TypedArray.cpp

@@ -468,8 +468,8 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
                                                                                                                             \
     ClassName::ClassName(Object& prototype, u32 length, ArrayBuffer& array_buffer)                                          \
         : TypedArray(prototype,                                                                                             \
-            bit_cast<TypedArrayBase::IntrinsicConstructor>(&Intrinsics::snake_name##_constructor),                          \
-            length, array_buffer, Kind::ClassName)                                                                          \
+              bit_cast<TypedArrayBase::IntrinsicConstructor>(&Intrinsics::snake_name##_constructor),                        \
+              length, array_buffer, Kind::ClassName)                                                                        \
     {                                                                                                                       \
         if constexpr (#ClassName##sv.is_one_of("BigInt64Array", "BigUint64Array"))                                          \
             m_content_type = ContentType::BigInt;                                                                           \

+ 1 - 1
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -3947,7 +3947,7 @@ void Document::shared_declarative_refresh_steps(StringView input, JS::GCPtr<HTML
         // 7. Skip ASCII whitespace within input given position.
         lexer.ignore_while(Infra::is_ascii_whitespace);
 
-    skip_quotes : {
+    skip_quotes: {
         // 8. Skip quotes: If the code point in input pointed to by position is U+0027 (') or U+0022 ("), then let
         //    quote be that code point, and advance position to the next code point. Otherwise, let quote be the empty
         //    string.

+ 3 - 0
Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp

@@ -172,11 +172,14 @@ namespace Web::HTML {
 #define SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(new_state) \
     SWITCH_TO_AND_EMIT_CHARACTER(current_input_character.value(), new_state)
 
+// clang-format-18 handles the `state:` label rather badly.
+// clang-format off
 #define BEGIN_STATE(state) \
     state:                 \
     case State::state: {   \
         {                  \
             {
+// clang-format on
 
 #define END_STATE         \
     VERIFY_NOT_REACHED(); \

+ 1 - 1
Userland/Libraries/LibWebSocket/WebSocket.cpp

@@ -531,7 +531,7 @@ void WebSocket::send_frame(WebSocket::OpCode op_code, ReadonlyBytes payload, boo
 {
     VERIFY(m_impl);
     VERIFY(m_state == WebSocket::InternalState::Open);
-    u8 frame_head[1] = { (u8)((is_final ? 0x80 : 0x00) | ((u8)(op_code)&0xf)) };
+    u8 frame_head[1] = { (u8)((is_final ? 0x80 : 0x00) | ((u8)(op_code) & 0xf)) };
     m_impl->send(ReadonlyBytes(frame_head, 1));
     // Section 5.1 : a client MUST mask all frames that it sends to the server
     bool has_mask = true;