diff options
-rw-r--r-- | meson.build | 9 | ||||
-rw-r--r-- | src/core/load-fragment.c | 2 | ||||
-rw-r--r-- | src/import/import-fs.c | 4 | ||||
-rw-r--r-- | src/journal/fsprg.c | 2 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 8 | ||||
-rw-r--r-- | src/machine/machined-dbus.c | 4 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 4 | ||||
-rw-r--r-- | src/partition/repart.c | 2 | ||||
-rw-r--r-- | src/shared/resize-fs.c | 4 | ||||
-rw-r--r-- | src/test/test-alloc-util.c | 14 | ||||
-rw-r--r-- | src/test/test-fd-util.c | 8 | ||||
-rw-r--r-- | src/test/test-time-util.c | 2 |
12 files changed, 26 insertions, 37 deletions
diff --git a/meson.build b/meson.build index bf353cd1f7..a922f9a2f1 100644 --- a/meson.build +++ b/meson.build @@ -335,15 +335,6 @@ basic_disabled_warnings = [ '-Wno-unused-result', '-Wno-format-signedness', ] -if get_option('b_ndebug') == 'true' - # With asserts disabled with get a bunch of warnings about variables which - # are used only in the asserts. This is not useful at all, so let's just silence - # those warnings. - basic_disabled_warnings += [ - '-Wno-unused-variable', - '-Wno-unused-but-set-variable', - ] -endif possible_cc_flags = [ '-Werror=undef', diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index b16c62a5c7..9c24bb780a 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2889,7 +2889,7 @@ int config_parse_syscall_filter( void *userdata) { ExecContext *c = data; - const Unit *u = userdata; + _unused_ const Unit *u = userdata; bool invert = false; const char *p; int r; diff --git a/src/import/import-fs.c b/src/import/import-fs.c index 468303a6dc..5e61049ced 100644 --- a/src/import/import-fs.c +++ b/src/import/import-fs.c @@ -172,8 +172,8 @@ static int import_fs(int argc, char *argv[], void *userdata) { progress.limit = (RateLimit) { 200*USEC_PER_MSEC, 1 }; /* Hook into SIGINT/SIGTERM, so that we can cancel things then */ - assert(sigaction(SIGINT, &sa, &old_sigint_sa) >= 0); - assert(sigaction(SIGTERM, &sa, &old_sigterm_sa) >= 0); + assert_se(sigaction(SIGINT, &sa, &old_sigint_sa) >= 0); + assert_se(sigaction(SIGTERM, &sa, &old_sigterm_sa) >= 0); r = btrfs_subvol_snapshot_fd_full( fd, diff --git a/src/journal/fsprg.c b/src/journal/fsprg.c index 1dda2149d4..0ef3df89df 100644 --- a/src/journal/fsprg.c +++ b/src/journal/fsprg.c @@ -60,7 +60,7 @@ static void mpi_export(void *buf, size_t buflen, const gcry_mpi_t x) { static gcry_mpi_t mpi_import(const void *buf, size_t buflen) { gcry_mpi_t h; - unsigned len; + _unused_ unsigned len; assert_se(gcry_mpi_scan(&h, GCRYMPI_FMT_USG, buf, buflen, NULL) == 0); len = (gcry_mpi_get_nbits(h) + 7) / 8; diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 47fc53167e..20794451f5 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2567,7 +2567,7 @@ static int method_can_reboot_parameter( void *userdata, sd_bus_error *error) { - Manager *m = userdata; + _unused_ Manager *m = userdata; int r; assert(message); @@ -2699,7 +2699,7 @@ static int method_can_reboot_to_firmware_setup( void *userdata, sd_bus_error *error) { - Manager *m = userdata; + _unused_ Manager *m = userdata; int r; assert(message); @@ -2888,7 +2888,7 @@ static int method_can_reboot_to_boot_loader_menu( void *userdata, sd_bus_error *error) { - Manager *m = userdata; + _unused_ Manager *m = userdata; int r; assert(message); @@ -3079,7 +3079,7 @@ static int method_can_reboot_to_boot_loader_entry( void *userdata, sd_bus_error *error) { - Manager *m = userdata; + _unused_ Manager *m = userdata; int r; assert(message); diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index ceb3afadbd..865ce7baad 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -112,7 +112,7 @@ static int method_get_machine(sd_bus_message *message, void *userdata, sd_bus_er static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_free_ char *p = NULL; - Manager *m = userdata; + _unused_ Manager *m = userdata; const char *name; int r; @@ -471,7 +471,7 @@ static int method_get_machine_os_release(sd_bus_message *message, void *userdata static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_hashmap_free_ Hashmap *images = NULL; - Manager *m = userdata; + _unused_ Manager *m = userdata; Image *image; Iterator i; int r; diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 3e9fb8c217..f9b611e419 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -2233,7 +2233,7 @@ void manager_dirty(Manager *manager) { } static int set_hostname_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { - Manager *manager = userdata; + _unused_ Manager *manager = userdata; const sd_bus_error *e; assert(m); @@ -2279,7 +2279,7 @@ int manager_set_hostname(Manager *m, const char *hostname) { } static int set_timezone_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { - Manager *manager = userdata; + _unused_ Manager *manager = userdata; const sd_bus_error *e; assert(m); diff --git a/src/partition/repart.c b/src/partition/repart.c index bc9b12f167..82d60cd42b 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -1722,7 +1722,7 @@ static int context_dump_partition_bar(Context *context, const char *node) { bool z = false; size_t c, j = 0; - assert((c = columns()) >= 2); + assert_se((c = columns()) >= 2); c -= 2; /* We do not use the leftmost and rightmost character cell */ bar = new0(Partition*, c); diff --git a/src/shared/resize-fs.c b/src/shared/resize-fs.c index 5ed26a6c92..24a17a2ffe 100644 --- a/src/shared/resize-fs.c +++ b/src/shared/resize-fs.c @@ -15,7 +15,6 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) { struct statfs sfs; - int r; assert(fd >= 0); @@ -54,8 +53,7 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) { sz -= sz % sfs.f_bsize; - r = snprintf(args.name, sizeof(args.name), "%" PRIu64, sz); - assert((size_t) r < sizeof(args.name)); + xsprintf(args.name, "%" PRIu64, sz); if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0) return -errno; diff --git a/src/test/test-alloc-util.c b/src/test/test-alloc-util.c index 758b753237..d85f705504 100644 --- a/src/test/test-alloc-util.c +++ b/src/test/test-alloc-util.c @@ -99,13 +99,13 @@ static void test_bool_assign(void) { g = cp; /* cast from pointer */ h = NULL; /* cast from pointer */ - assert(b); - assert(c); - assert(d); - assert(e); - assert(!f); - assert(g); - assert(!h); + assert_se(b); + assert_se(c); + assert_se(d); + assert_se(e); + assert_se(!f); + assert_se(g); + assert_se(!h); } static int cleanup_counter = 0; diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c index 713795814d..44c74987c5 100644 --- a/src/test/test-fd-util.c +++ b/src/test/test-fd-util.c @@ -233,17 +233,17 @@ static void assert_equal_fd(int fd1, int fd2) { ssize_t x, y; x = read(fd1, a, sizeof(a)); - assert(x >= 0); + assert_se(x >= 0); y = read(fd2, b, sizeof(b)); - assert(y >= 0); + assert_se(y >= 0); - assert(x == y); + assert_se(x == y); if (x == 0) break; - assert(memcmp(a, b, x) == 0); + assert_se(memcmp(a, b, x) == 0); } } diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c index a422cc8ddc..e3b1f6f8ca 100644 --- a/src/test/test-time-util.c +++ b/src/test/test-time-util.c @@ -433,7 +433,7 @@ static void assert_similar(usec_t a, usec_t b) { else d = b - a; - assert(d < 10*USEC_PER_SEC); + assert_se(d < 10*USEC_PER_SEC); } static void test_usec_shift_clock(void) { |