From d7c1024b6b13c62a413e2beab2510570a81b906d Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 20 Aug 2022 20:11:32 +0200 Subject: [PATCH 1/6] ci: build with clang-15; drop clang-12 --- .github/workflows/build_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 8a19d5a937..9a0f8f9bd3 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -27,9 +27,9 @@ jobs: env: - { COMPILER: "gcc", COMPILER_VERSION: "11", LINKER: "bfd", CRYPTOLIB: "gcrypt" } - { COMPILER: "gcc", COMPILER_VERSION: "12", LINKER: "gold", CRYPTOLIB: "openssl" } - - { COMPILER: "clang", COMPILER_VERSION: "12", LINKER: "gold", CRYPTOLIB: "gcrypt" } - - { COMPILER: "clang", COMPILER_VERSION: "13", LINKER: "lld", CRYPTOLIB: "openssl" } - - { COMPILER: "clang", COMPILER_VERSION: "14", LINKER: "bfd", CRYPTOLIB: "auto" } + - { COMPILER: "clang", COMPILER_VERSION: "13", LINKER: "gold", CRYPTOLIB: "gcrypt" } + - { COMPILER: "clang", COMPILER_VERSION: "14", LINKER: "lld", CRYPTOLIB: "openssl" } + - { COMPILER: "clang", COMPILER_VERSION: "15", LINKER: "bfd", CRYPTOLIB: "auto" } env: ${{ matrix.env }} steps: - name: Repository checkout From 94510784e10fcf811bca87e9677291bd8cbeac32 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 20 Aug 2022 20:38:17 +0200 Subject: [PATCH 2/6] sd-journal: drop an unused variable --- src/libsystemd/sd-journal/journal-verify.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libsystemd/sd-journal/journal-verify.c b/src/libsystemd/sd-journal/journal-verify.c index 40aff67ee8..b9f6a161ed 100644 --- a/src/libsystemd/sd-journal/journal-verify.c +++ b/src/libsystemd/sd-journal/journal-verify.c @@ -822,7 +822,7 @@ int journal_file_verify( uint64_t entry_seqnum = 0, entry_monotonic = 0, entry_realtime = 0; sd_id128_t entry_boot_id = {}; /* Unnecessary initialization to appease gcc */ bool entry_seqnum_set = false, entry_monotonic_set = false, entry_realtime_set = false, found_main_entry_array = false; - uint64_t n_weird = 0, n_objects = 0, n_entries = 0, n_data = 0, n_fields = 0, n_data_hash_tables = 0, n_field_hash_tables = 0, n_entry_arrays = 0, n_tags = 0; + uint64_t n_objects = 0, n_entries = 0, n_data = 0, n_fields = 0, n_data_hash_tables = 0, n_field_hash_tables = 0, n_entry_arrays = 0, n_tags = 0; usec_t last_usec = 0; _cleanup_close_ int data_fd = -1, entry_fd = -1, entry_array_fd = -1; _cleanup_fclose_ FILE *data_fp = NULL, *entry_fp = NULL, *entry_array_fp = NULL; @@ -1205,9 +1205,6 @@ int journal_file_verify( n_tags++; break; - - default: - n_weird++; } if (p == le64toh(f->header->tail_object_offset)) { From f7c1808e69771c3b9179573bfdddac5218fd6fee Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 20 Aug 2022 20:45:27 +0200 Subject: [PATCH 3/6] machine: drop an unused variable --- src/machine/machine-dbus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 7a07d20e0b..bd203b37dd 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -206,15 +206,13 @@ int bus_machine_method_get_addresses(sd_bus_message *message, void *userdata, sd case MACHINE_HOST: { _cleanup_free_ struct local_address *addresses = NULL; - struct local_address *a; - int n, i; + int n; n = local_addresses(NULL, 0, AF_UNSPEC, &addresses); if (n < 0) return n; - for (a = addresses, i = 0; i < n; a++, i++) { - + for (int i = 0; i < n; i++) { r = sd_bus_message_open_container(reply, 'r', "iay"); if (r < 0) return r; From f8769631e13914b2fad45fe746df79c92e3a131a Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 20 Aug 2022 21:00:14 +0200 Subject: [PATCH 4/6] network: drop an unused variable --- src/network/networkd-dhcp-server.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c index 076779dc0e..e36627cd57 100644 --- a/src/network/networkd-dhcp-server.c +++ b/src/network/networkd-dhcp-server.c @@ -320,7 +320,7 @@ static int dhcp4_server_set_dns_from_resolve_conf(Link *link) { _cleanup_free_ struct in_addr *addresses = NULL; _cleanup_fclose_ FILE *f = NULL; size_t n_addresses = 0; - int n = 0, r; + int r; f = fopen(PRIVATE_UPLINK_RESOLV_CONF, "re"); if (!f) { @@ -341,8 +341,6 @@ static int dhcp4_server_set_dns_from_resolve_conf(Link *link) { if (r == 0) break; - n++; - l = strstrip(line); if (IN_SET(*l, '#', ';', 0)) continue; From 9abe4cfc39579037937c63602ce8fe4f51746d38 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 20 Aug 2022 21:04:24 +0200 Subject: [PATCH 5/6] coredump: drop an unused variable --- src/coredump/coredump.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 3ec41a32c3..98e7492811 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -931,7 +931,6 @@ log: } static int save_context(Context *context, const struct iovec_wrapper *iovw) { - unsigned count = 0; const char *unit; int r; @@ -955,7 +954,6 @@ static int save_context(Context *context, const struct iovec_wrapper *iovw) { p = startswith(iovec->iov_base, meta_field_names[i]); if (p) { context->meta[i] = p; - count++; break; } } From 3b2b3d298541fbf20a05553cc3a1b1bf173ccf3f Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 20 Aug 2022 21:57:18 +0200 Subject: [PATCH 6/6] hashmap: use assert_se() to make clang happy Otherwise it complains about a set but unused variable: ``` ../src/basic/hashmap.c:1070:48: error: variable 'n_rehashed' set but not used [-Werror,-Wunused-but-set-variable] unsigned old_n_buckets, new_n_buckets, n_rehashed, new_n_entries; ^ 1 error generated. ``` --- src/basic/hashmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 1fadaad996..ddd329c874 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -1190,7 +1190,7 @@ static int resize_buckets(HashmapBase *h, unsigned entries_add) { } while (rehash_next); } - assert(n_rehashed == n_entries(h)); + assert_se(n_rehashed == n_entries(h)); return 1; }