diff options
author | Tim Schumacher <timschumi@gmx.de> | 2022-09-13 23:44:19 +0200 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-09-16 05:39:28 +0000 |
commit | 8763dbcccc48690fce6f01ce8166222bd8234a85 (patch) | |
tree | d5f6fa0d884b86d9b082e7e5d0c912ac5778391d | |
parent | 643d2a683b478424847e3e9103dbf5e7c22121f1 (diff) | |
download | serenity-8763dbcccc48690fce6f01ce8166222bd8234a85.zip |
Everywhere: Remove a bunch of dead write-only variables
LLVM 15 now warns (and thus errors) about this, and there is really no
point in keeping them.
-rw-r--r-- | Kernel/Storage/StorageManagement.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Cipher/AES.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibEDID/EDID.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibRegex/RegexMatcher.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibTLS/HandshakeCertificate.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibVT/Terminal.cpp | 2 | ||||
-rw-r--r-- | Userland/Services/AudioServer/Mixer.cpp | 2 |
8 files changed, 6 insertions, 18 deletions
diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp index d0ac325625..d1648a8b81 100644 --- a/Kernel/Storage/StorageManagement.cpp +++ b/Kernel/Storage/StorageManagement.cpp @@ -167,7 +167,6 @@ UNMAP_AFTER_INIT ErrorOr<NonnullOwnPtr<Partition::PartitionTable>> StorageManage UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() { VERIFY(!m_storage_devices.is_empty()); - size_t device_index = 0; for (auto& device : m_storage_devices) { auto partition_table_or_error = try_to_initialize_partition_table(device); if (partition_table_or_error.is_error()) @@ -180,7 +179,6 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() auto disk_partition = DiskPartition::create(device, generate_partition_minor_number(), partition_metadata.value()); device.add_partition(disk_partition); } - device_index++; } } diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp index a60199ae40..49c8263227 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp +++ b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp @@ -940,12 +940,10 @@ Vector<CodeComprehension::TokenInfo> CppComprehensionEngine::get_tokens_info(Str auto const& document = *document_ptr; Vector<CodeComprehension::TokenInfo> tokens_info; - size_t i = 0; for (auto const& token : document.preprocessor().unprocessed_tokens()) { tokens_info.append({ get_token_semantic_type(document, token), token.start().line, token.start().column, token.end().line, token.end().column }); - ++i; dbgln_if(CPP_LANGUAGE_SERVER_DEBUG, "{}: {}", token.text(), CodeComprehension::TokenInfo::type_to_string(tokens_info.last().type)); } return tokens_info; diff --git a/Userland/Libraries/LibCrypto/Cipher/AES.cpp b/Userland/Libraries/LibCrypto/Cipher/AES.cpp index b853599f88..0c9da1df8b 100644 --- a/Userland/Libraries/LibCrypto/Cipher/AES.cpp +++ b/Userland/Libraries/LibCrypto/Cipher/AES.cpp @@ -213,9 +213,7 @@ void AESCipher::encrypt_block(AESCipherBlock const& in, AESCipherBlock& out) r = dec_key.rounds() >> 1; // apply the first |r - 1| rounds - auto i { 0 }; for (;;) { - ++i; // clang-format off t0 = AESTables::Encode0[(s0 >> 24) ] ^ AESTables::Encode1[(s1 >> 16) & 0xff] ^ @@ -237,7 +235,6 @@ void AESCipher::encrypt_block(AESCipherBlock const& in, AESCipherBlock& out) round_keys += 8; --r; - ++i; if (r == 0) break; diff --git a/Userland/Libraries/LibEDID/EDID.cpp b/Userland/Libraries/LibEDID/EDID.cpp index 60cb9b786a..b5354e1c88 100644 --- a/Userland/Libraries/LibEDID/EDID.cpp +++ b/Userland/Libraries/LibEDID/EDID.cpp @@ -79,7 +79,6 @@ public: if (dtd_start > offsetof(Definitions::ExtensionBlock, checksum) - sizeof(Definitions::DetailedTiming)) return Error::from_string_literal("CEA 861 extension block has invalid DTD list"); - size_t dtd_index = 0; for (size_t offset = dtd_start; offset <= offsetof(Definitions::ExtensionBlock, checksum) - sizeof(Definitions::DetailedTiming); offset += sizeof(Definitions::DetailedTiming)) { auto& dtd = *(Definitions::DetailedTiming const*)((u8 const*)m_block + offset); if (m_edid.read_host(&dtd.pixel_clock) == 0) @@ -88,8 +87,6 @@ public: IterationDecision decision = callback(Parser::DetailedTiming(m_edid, &dtd)); if (decision != IterationDecision::Continue) return decision; - - dtd_index++; } return IterationDecision::Continue; } diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index aaf2f371b0..109a7324ef 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -415,7 +415,9 @@ template<class Parser> bool Matcher<Parser>::execute(MatchInput const& input, MatchState& state, size_t& operations) const { BumpAllocatedLinkedList<MatchState> states_to_try_next; +#if REGEX_DEBUG size_t recursion_level = 0; +#endif auto& bytecode = m_pattern->parser_result.bytecode; @@ -483,7 +485,9 @@ bool Matcher<Parser>::execute(MatchInput const& input, MatchState& state, size_t states_to_try_next.last().initiating_fork = state.instruction_position - opcode.size(); } state.instruction_position = state.fork_at_position; +#if REGEX_DEBUG ++recursion_level; +#endif continue; } case ExecutionResult::Continue: @@ -501,7 +505,9 @@ bool Matcher<Parser>::execute(MatchInput const& input, MatchState& state, size_t return false; } state = states_to_try_next.take_last(); +#if REGEX_DEBUG ++recursion_level; +#endif continue; } } diff --git a/Userland/Libraries/LibTLS/HandshakeCertificate.cpp b/Userland/Libraries/LibTLS/HandshakeCertificate.cpp index dd1bcfbad2..40bb4c6f1b 100644 --- a/Userland/Libraries/LibTLS/HandshakeCertificate.cpp +++ b/Userland/Libraries/LibTLS/HandshakeCertificate.cpp @@ -39,11 +39,9 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) } size_t size = certificate_total_length; - size_t index = 0; bool valid_certificate = false; while (size > 0) { - ++index; if (buffer.size() - res < 3) { dbgln_if(TLS_DEBUG, "not enough data for certificate length"); return (i8)Error::NeedMoreData; @@ -58,14 +56,12 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) auto res_cert = res; auto remaining = certificate_size; - size_t certificates_in_chain = 0; do { if (remaining <= 3) { dbgln("Ran out of data"); break; } - ++certificates_in_chain; if (buffer.size() < (size_t)res_cert + 3) { dbgln("not enough data to read cert size ({} < {})", buffer.size(), res_cert + 3); break; diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 084af53c1b..62bbfca311 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -1512,7 +1512,6 @@ void Terminal::set_size(u16 columns, u16 rows) if (buffer[i].length() != columns) lines_to_reevaluate.enqueue(i); } - size_t rows_inserted = 0; while (!lines_to_reevaluate.is_empty()) { auto index = lines_to_reevaluate.dequeue(); auto is_at_seam = index + 1 == buffer.size(); @@ -1524,7 +1523,6 @@ void Terminal::set_size(u16 columns, u16 rows) auto current_cursor = cursor_on_line(index); // Split the line into two (or more) ++index; - ++rows_inserted; buffer.insert(index, make<Line>(0)); VERIFY(buffer[index].length() == 0); line.rewrap(columns, &buffer[index], current_cursor, false); diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index 955d63cdb7..9e8cf14d8b 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -76,14 +76,12 @@ void Mixer::mix() m_main_volume.advance_time(); - int active_queues = 0; // Mix the buffers together into the output for (auto& queue : active_mix_queues) { if (!queue->client()) { queue->clear(); continue; } - ++active_queues; queue->volume().advance_time(); for (auto& mixed_sample : mixed_buffer) { |