diff --git a/AK/StdLibExtraDetails.h b/AK/StdLibExtraDetails.h index 47680425be4..922ba807302 100644 --- a/AK/StdLibExtraDetails.h +++ b/AK/StdLibExtraDetails.h @@ -126,9 +126,9 @@ inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template -inline constexpr bool IsFunction = true; +inline constexpr bool IsFunction = true; template -inline constexpr bool IsFunction = true; +inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template diff --git a/AK/Utf16View.h b/AK/Utf16View.h index 5d10b9a7b88..678d55e5d9f 100644 --- a/AK/Utf16View.h +++ b/AK/Utf16View.h @@ -74,8 +74,8 @@ public: template Utf16View(char16_t const (&code_units)[Size]) : m_code_units( - reinterpret_cast(&code_units[0]), - code_units[Size - 1] == u'\0' ? Size - 1 : Size) + reinterpret_cast(&code_units[0]), + code_units[Size - 1] == u'\0' ? Size - 1 : Size) { } diff --git a/Kernel/API/POSIX/futex.h b/Kernel/API/POSIX/futex.h index fd90aafee95..0b42e4584c3 100644 --- a/Kernel/API/POSIX/futex.h +++ b/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) diff --git a/Kernel/API/POSIX/netinet/in.h b/Kernel/API/POSIX/netinet/in.h index 0fe0e63a71f..fc96d5bba25 100644 --- a/Kernel/API/POSIX/netinet/in.h +++ b/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 diff --git a/Kernel/API/POSIX/signal.h b/Kernel/API/POSIX/signal.h index 72ec996f246..10c6b4a20ef 100644 --- a/Kernel/API/POSIX/signal.h +++ b/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 diff --git a/Kernel/API/POSIX/sys/stat.h b/Kernel/API/POSIX/sys/stat.h index 5c3a0b52f48..93919991653 100644 --- a/Kernel/API/POSIX/sys/stat.h +++ b/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 */ diff --git a/Kernel/API/POSIX/sys/wait.h b/Kernel/API/POSIX/sys/wait.h index 74d3ec0c074..f6b3eb2f7e4 100644 --- a/Kernel/API/POSIX/sys/wait.h +++ b/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 diff --git a/Kernel/Arch/CPU.h b/Kernel/Arch/CPU.h index efe6c5925b4..f8fce98148a 100644 --- a/Kernel/Arch/CPU.h +++ b/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) diff --git a/Kernel/Arch/x86_64/Interrupts/APIC.cpp b/Kernel/Arch/x86_64/Interrupts/APIC.cpp index b746fd1bf2c..720850898e7 100644 --- a/Kernel/Arch/x86_64/Interrupts/APIC.cpp +++ b/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; diff --git a/Kernel/Bus/PCI/Definitions.h b/Kernel/Bus/PCI/Definitions.h index ede6010fd3c..46525ccccc7 100644 --- a/Kernel/Bus/PCI/Definitions.h +++ b/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()) { } diff --git a/Kernel/Bus/VirtIO/Device.cpp b/Kernel/Bus/VirtIO/Device.cpp index beb6e90ed3c..34a7219fed8 100644 --- a/Kernel/Bus/VirtIO/Device.cpp +++ b/Kernel/Bus/VirtIO/Device.cpp @@ -27,7 +27,7 @@ UNMAP_AFTER_INIT ErrorOr Device::initialize_virtio_resources() } UNMAP_AFTER_INIT VirtIO::Device::Device(NonnullOwnPtr 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)) { } diff --git a/Kernel/Devices/GPU/Console/VGATextModeConsole.cpp b/Kernel/Devices/GPU/Console/VGATextModeConsole.cpp index 969b5d764b8..4d164bb125d 100644 --- a/Kernel/Devices/GPU/Console/VGATextModeConsole.cpp +++ b/Kernel/Devices/GPU/Console/VGATextModeConsole.cpp @@ -20,7 +20,7 @@ UNMAP_AFTER_INIT NonnullLockRefPtr VGATextModeConsole::initi UNMAP_AFTER_INIT VGATextModeConsole::VGATextModeConsole(NonnullOwnPtr 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); diff --git a/Kernel/Devices/Storage/SD/SDMemoryCard.cpp b/Kernel/Devices/Storage/SD/SDMemoryCard.cpp index 8e4a76a8d50..db960cdac99 100644 --- a/Kernel/Devices/Storage/SD/SDMemoryCard.cpp +++ b/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) diff --git a/Kernel/Net/Intel/E1000ENetworkAdapter.cpp b/Kernel/Net/Intel/E1000ENetworkAdapter.cpp index f94351af88e..ca3b1287472 100644 --- a/Kernel/Net/Intel/E1000ENetworkAdapter.cpp +++ b/Kernel/Net/Intel/E1000ENetworkAdapter.cpp @@ -240,10 +240,10 @@ UNMAP_AFTER_INIT E1000ENetworkAdapter::E1000ENetworkAdapter(StringView interface NonnullOwnPtr tx_buffer_region, NonnullOwnPtr rx_descriptors_region, NonnullOwnPtr 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)) { } diff --git a/Ladybird/Qt/Tab.cpp b/Ladybird/Qt/Tab.cpp index accdc33e4b5..9d4bc00d231 100644 --- a/Ladybird/Qt/Tab.cpp +++ b/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); }); diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Compiler/Passes/IfBranchMergingPass.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Compiler/Passes/IfBranchMergingPass.cpp index 61e57c8fc54..aa94daf4642 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Compiler/Passes/IfBranchMergingPass.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Compiler/Passes/IfBranchMergingPass.cpp @@ -44,7 +44,7 @@ RecursionDecision IfBranchMergingPass::on_entry(Tree tree) Tree IfBranchMergingPass::merge_branches(Vector const& unmerged_branches) { - static const Tree error = make_ref_counted("Cannot make sense of if-elseif-else chain"sv); + static Tree const error = make_ref_counted("Cannot make sense of if-elseif-else chain"sv); VERIFY(unmerged_branches.size() >= 1); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp index 990091f222c..03b9540f068 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp @@ -69,8 +69,8 @@ void replace_logical_aliases(JsonObject& properties) AK::HashMap 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()) { diff --git a/Tests/AK/TestChecked.cpp b/Tests/AK/TestChecked.cpp index 6da6b0ab8f9..3342d8e4566 100644 --- a/Tests/AK/TestChecked.cpp +++ b/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 old_value { 42 }; + Checked const old_value { 42 }; Checked 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 old_value { 42 }; + Checked const old_value { 42 }; Checked value {}; value = old_value; return value; diff --git a/Tests/AK/TestIPv4Address.cpp b/Tests/AK/TestIPv4Address.cpp index e352db12b17..564ac68b052 100644 --- a/Tests/AK/TestIPv4Address.cpp +++ b/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 a = 0x11'22'33'44; + NetworkOrdered const a = 0x11'22'33'44; return IPv4Address(a); }(); diff --git a/Tests/AK/TestJSON.cpp b/Tests/AK/TestJSON.cpp index 286535c6133..64281061dd4 100644 --- a/Tests/AK/TestJSON.cpp +++ b/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) { }); }); } diff --git a/Tests/AK/TestSpan.cpp b/Tests/AK/TestSpan.cpp index cfb14fb86aa..f9518d7706e 100644 --- a/Tests/AK/TestSpan.cpp +++ b/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)); } diff --git a/Tests/AK/TestVariant.cpp b/Tests/AK/TestVariant.cpp index d965a85c7d3..44806a43101 100644 --- a/Tests/AK/TestVariant.cpp +++ b/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" }; }, diff --git a/Tests/JSSpecCompiler/test-runner.cpp b/Tests/JSSpecCompiler/test-runner.cpp index 603f0f48407..1f641a9fa23 100644 --- a/Tests/JSSpecCompiler/test-runner.cpp +++ b/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 build_command_line_arguments(LexicalPath const& test_source, TestDescription const& description) { diff --git a/Tests/Kernel/crash.cpp b/Tests/Kernel/crash.cpp index 0c128f437ab..5466ab16599 100644 --- a/Tests/Kernel/crash.cpp +++ b/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; diff --git a/Tests/Kernel/elf-execve-mmap-race.cpp b/Tests/Kernel/elf-execve-mmap-race.cpp index cbea9da5ac8..9e257056d5f 100644 --- a/Tests/Kernel/elf-execve-mmap-race.cpp +++ b/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; diff --git a/Tests/Kernel/fuzz-syscalls.cpp b/Tests/Kernel/fuzz-syscalls.cpp index aefa2ef6b3a..a7cbea19d6b 100644 --- a/Tests/Kernel/fuzz-syscalls.cpp +++ b/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: diff --git a/Tests/Kernel/kill-pidtid-confusion.cpp b/Tests/Kernel/kill-pidtid-confusion.cpp index 5d31929d402..ef5375de21d 100644 --- a/Tests/Kernel/kill-pidtid-confusion.cpp +++ b/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); diff --git a/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp b/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp index 1a1a2ce8469..07d2b91e736 100644 --- a/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp +++ b/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, diff --git a/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp b/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp index a86da201301..d55c9712bc2 100644 --- a/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp +++ b/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. diff --git a/Tests/Kernel/setpgid-across-sessions-without-leader.cpp b/Tests/Kernel/setpgid-across-sessions-without-leader.cpp index 0626c4b458c..e8c08985b86 100644 --- a/Tests/Kernel/setpgid-across-sessions-without-leader.cpp +++ b/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); diff --git a/Tests/Kernel/siginfo-example.cpp b/Tests/Kernel/siginfo-example.cpp index 9a96e64a8d6..c0de957fc66 100644 --- a/Tests/Kernel/siginfo-example.cpp +++ b/Tests/Kernel/siginfo-example.cpp @@ -11,9 +11,9 @@ #include // 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; diff --git a/Tests/LibC/TestMemmem.cpp b/Tests/LibC/TestMemmem.cpp index 3ba65dfe949..4419ded3904 100644 --- a/Tests/LibC/TestMemmem.cpp +++ b/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) diff --git a/Tests/LibC/TestQsort.cpp b/Tests/LibC/TestQsort.cpp index 587451ec878..fe0e28acbdb 100644 --- a/Tests/LibC/TestQsort.cpp +++ b/Tests/LibC/TestQsort.cpp @@ -12,7 +12,7 @@ #include #include -const size_t NUM_RUNS = 10; +size_t const NUM_RUNS = 10; struct SortableObject { int m_key; diff --git a/Tests/LibC/TestScanf.cpp b/Tests/LibC/TestScanf.cpp index 4905d940e7a..32148d0cc7d 100644 --- a/Tests/LibC/TestScanf.cpp +++ b/Tests/LibC/TestScanf.cpp @@ -147,7 +147,7 @@ struct TestSuite { Array 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) } }, diff --git a/Tests/LibC/TestSnprintf.cpp b/Tests/LibC/TestSnprintf.cpp index 91a8ac2c780..663a274da33 100644 --- a/Tests/LibC/TestSnprintf.cpp +++ b/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 diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp index 37876c0c63e..fdd9e2f2e82 100644 --- a/Tests/LibC/TestWchar.cpp +++ b/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(0x1111F41E), L'\0' }; + wchar_t const good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' }; + wchar_t const bad_chars[] = { L'\U0001F41E', static_cast(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; diff --git a/Tests/LibC/TestWctype.cpp b/Tests/LibC/TestWctype.cpp index f7d88b83134..06b7d82647e 100644 --- a/Tests/LibC/TestWctype.cpp +++ b/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++) { diff --git a/Tests/LibCompress/TestDeflate.cpp b/Tests/LibCompress/TestDeflate.cpp index cbf64464315..eb9899f6bc2 100644 --- a/Tests/LibCompress/TestDeflate.cpp +++ b/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 })); diff --git a/Tests/LibCompress/TestGzip.cpp b/Tests/LibCompress/TestGzip.cpp index 294679d42c5..dd787dc4540 100644 --- a/Tests/LibCompress/TestGzip.cpp +++ b/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 })); diff --git a/Tests/LibCompress/TestZlib.cpp b/Tests/LibCompress/TestZlib.cpp index d1cd37a211f..a98aaf57bae 100644 --- a/Tests/LibCompress/TestZlib.cpp +++ b/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(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()); diff --git a/Tests/LibCrypto/TestBigInteger.cpp b/Tests/LibCrypto/TestBigInteger.cpp index 25ff9ad0ece..615c78f3d67 100644 --- a/Tests/LibCrypto/TestBigInteger.cpp +++ b/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 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); + { + 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); -} + 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); -} + { + 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); + } -{ - double double_max_value = NumericLimits::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_max_value = NumericLimits::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 }); - auto below_max_value_in_bigint = TRY_OR_FAIL(Crypto::SignedBigInteger::from_base(16, "fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"sv)); + auto below_max_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(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_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_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_min_value = NumericLimits::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 }); + { + double double_min_value = NumericLimits::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)); + 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_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); -} + 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(0x406fe00000000001ULL); - double just_below_255 = bit_cast(0x406fdfffffffffffULL); - double double_255 = 255.0; - Crypto::SignedBigInteger bigint_255 { 255 }; + { + double just_above_255 = bit_cast(0x406fe00000000001ULL); + double just_below_255 = bit_cast(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 diff --git a/Tests/LibEDID/TestEDID.cpp b/Tests/LibEDID/TestEDID.cpp index ed16597b003..8654fe33992 100644 --- a/Tests/LibEDID/TestEDID.cpp +++ b/Tests/LibEDID/TestEDID.cpp @@ -8,7 +8,7 @@ #include #include -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, diff --git a/Tests/LibSQL/TestSqlExpressionParser.cpp b/Tests/LibSQL/TestSqlExpressionParser.cpp index 39957487b70..41fb46849b6 100644 --- a/Tests/LibSQL/TestSqlExpressionParser.cpp +++ b/Tests/LibSQL/TestSqlExpressionParser.cpp @@ -61,7 +61,7 @@ TEST_CASE(numeric_literal) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& literal = static_cast(*expression); + auto const& literal = static_cast(*expression); EXPECT_EQ(literal.value(), expected_value); }; @@ -82,7 +82,7 @@ TEST_CASE(string_literal) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& literal = static_cast(*expression); + auto const& literal = static_cast(*expression); EXPECT_EQ(literal.value(), expected_value); }; @@ -101,7 +101,7 @@ TEST_CASE(blob_literal) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& literal = static_cast(*expression); + auto const& literal = static_cast(*expression); EXPECT_EQ(literal.value(), expected_value); }; @@ -154,7 +154,7 @@ TEST_CASE(column_name) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& column = static_cast(*expression); + auto const& column = static_cast(*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(*expression)); - const auto& unary = static_cast(*expression); + auto const& unary = static_cast(*expression); EXPECT_EQ(unary.type(), expected_operator); - const auto& secondary_expression = unary.expression(); + auto const& secondary_expression = unary.expression(); EXPECT(!is(*secondary_expression)); }; @@ -240,7 +240,7 @@ TEST_CASE(binary_operator) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& binary = static_cast(*expression); + auto const& binary = static_cast(*expression); EXPECT(!is(*binary.lhs())); EXPECT(!is(*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(*expression)); - const auto& chain = static_cast(*expression).expressions(); + auto const& chain = static_cast(*expression).expressions(); EXPECT_EQ(chain.size(), expected_chain_size); - for (const auto& chained_expression : chain) + for (auto const& chained_expression : chain) EXPECT(!is(chained_expression)); }; @@ -291,10 +291,10 @@ TEST_CASE(cast_expression) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& cast = static_cast(*expression); + auto const& cast = static_cast(*expression); EXPECT(!is(*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(*expression)); - const auto& case_ = static_cast(*expression); + auto const& case_ = static_cast(*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(*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(*when_then_clause.when)); EXPECT(!is(*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(*else_expression)); @@ -372,7 +372,7 @@ TEST_CASE(exists_expression) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& exists = static_cast(*expression); + auto const& exists = static_cast(*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(*expression)); - const auto& collate = static_cast(*expression); + auto const& collate = static_cast(*expression); EXPECT(!is(*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(*expression)); - const auto& is_ = static_cast(*expression); + auto const& is_ = static_cast(*expression); EXPECT(!is(*is_.lhs())); EXPECT(!is(*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(*expression)); - const auto& match = static_cast(*expression); + auto const& match = static_cast(*expression); EXPECT(!is(*match.lhs())); EXPECT(!is(*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(*expression)); - const auto& null = static_cast(*expression); + auto const& null = static_cast(*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(*expression)); - const auto& between = static_cast(*expression); + auto const& between = static_cast(*expression); EXPECT(!is(*between.expression())); EXPECT(!is(*between.lhs())); EXPECT(!is(*between.rhs())); @@ -535,7 +535,7 @@ TEST_CASE(in_table_expression) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& in = static_cast(*expression); + auto const& in = static_cast(*expression); EXPECT(!is(*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(*expression)); - const auto& in = static_cast(*expression); + auto const& in = static_cast(*expression); EXPECT(!is(*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(chained_expression)); }; @@ -587,7 +587,7 @@ TEST_CASE(in_selection_expression) auto expression = TRY_OR_FAIL(parse(sql)); EXPECT(is(*expression)); - const auto& in = static_cast(*expression); + auto const& in = static_cast(*expression); EXPECT(!is(*in.expression())); EXPECT_EQ(in.invert_expression(), expected_invert_expression); }; diff --git a/Tests/LibSQL/TestSqlStatementParser.cpp b/Tests/LibSQL/TestSqlStatementParser.cpp index 9092c7f4c52..8e03c00bf2d 100644 --- a/Tests/LibSQL/TestSqlStatementParser.cpp +++ b/Tests/LibSQL/TestSqlStatementParser.cpp @@ -69,7 +69,7 @@ TEST_CASE(create_table) auto statement = TRY_OR_FAIL(parse(sql)); EXPECT(is(*statement)); - const auto& table = static_cast(*statement); + auto const& table = static_cast(*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(*statement)); - const auto& alter = static_cast(*statement); + auto const& alter = static_cast(*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(*statement)); - const auto& alter = static_cast(*statement); + auto const& alter = static_cast(*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(*statement)); - const auto& alter = static_cast(*statement); + auto const& alter = static_cast(*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(*statement)); - const auto& alter = static_cast(*statement); + auto const& alter = static_cast(*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(*statement)); - const auto& table = static_cast(*statement); + auto const& table = static_cast(*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(*statement)); - const auto& insert = static_cast(*statement); + auto const& insert = static_cast(*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(expression)); } } @@ -397,19 +397,19 @@ TEST_CASE(update) auto statement = TRY_OR_FAIL(parse(sql)); EXPECT(is(*statement)); - const auto& update = static_cast(*statement); + auto const& update = static_cast(*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(*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(*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(*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(*statement)); - const auto& delete_ = static_cast(*statement); + auto const& delete_ = static_cast(*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(*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(*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(*statement)); - const auto& select = static_cast(*statement); + auto const& select = static_cast(*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(*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(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(*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(*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(*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(*offset_expression)); @@ -723,19 +723,19 @@ TEST_CASE(common_table_expression) auto statement = TRY_OR_FAIL(parse(sql)); EXPECT(is(*statement)); - const auto& delete_ = static_cast(*statement); + auto const& delete_ = static_cast(*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(*statement)); - const auto& describe_table_statement = static_cast(*statement); + auto const& describe_table_statement = static_cast(*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); }; diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index f9ee31c46e0..fc3d67821b5 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/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(&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(ref.address.value())); }); + [&](Wasm::Reference::Null const&) -> JS::Value { return JS::js_null(); }, + [&](auto const& ref) -> JS::Value { return JS::Value(static_cast(ref.address.value())); }); }); } return vm.throw_completion(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(ref.address.value())); }); + [](Wasm::Reference::Null const&) { return JS::js_null(); }, + [](auto const& ref) { return JS::Value(static_cast(ref.address.value())); }); }); }; diff --git a/Userland/Libraries/LibC/netinet/in.h b/Userland/Libraries/LibC/netinet/in.h index 074c0cda515..1dc1da98ae5 100644 --- a/Userland/Libraries/LibC/netinet/in.h +++ b/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 diff --git a/Userland/Libraries/LibC/sys/param.h b/Userland/Libraries/LibC/sys/param.h index 319b7f0f767..d86a6e8f396 100644 --- a/Userland/Libraries/LibC/sys/param.h +++ b/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 diff --git a/Userland/Libraries/LibC/syslog.h b/Userland/Libraries/LibC/syslog.h index 92d97aae40c..5e822b14875 100644 --- a/Userland/Libraries/LibC/syslog.h +++ b/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)) diff --git a/Userland/Libraries/LibELF/ELFABI.h b/Userland/Libraries/LibELF/ELFABI.h index 93b75db12eb..fa6a8a91dee 100644 --- a/Userland/Libraries/LibELF/ELFABI.h +++ b/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__ */ diff --git a/Userland/Libraries/LibGUI/Model.cpp b/Userland/Libraries/LibGUI/Model.cpp index 9db04ac838a..e0671a7a73d 100644 --- a/Userland/Libraries/LibGUI/Model.cpp +++ b/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); diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 2a079cd3e11..e2ebc4b556e 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/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)); diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp index 3dc111295dd..a117d73f2e9 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp @@ -426,7 +426,8 @@ bool OS2::use_typographic_metrics() const Optional OS2::x_height() const { return m_data.visit( - [] requires(requires { T::sx_height; })(T * data)->Optional { + [] + requires(requires { T::sx_height; })(T * data) -> Optional { return data->sx_height; }, [](auto*) { return Optional(); }); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h index 56afef540c6..8547c82272d 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h +++ b/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())) { } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp index 03c88cedad4..af5c6232d20 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/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(&Intrinsics::snake_name##_constructor), \ - length, array_buffer, Kind::ClassName) \ + bit_cast(&Intrinsics::snake_name##_constructor), \ + length, array_buffer, Kind::ClassName) \ { \ if constexpr (#ClassName##sv.is_one_of("BigInt64Array", "BigUint64Array")) \ m_content_type = ContentType::BigInt; \ diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 39789f7a3bd..98d63f9ac95 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -3947,7 +3947,7 @@ void Document::shared_declarative_refresh_steps(StringView input, JS::GCPtrsend(ReadonlyBytes(frame_head, 1)); // Section 5.1 : a client MUST mask all frames that it sends to the server bool has_mask = true;