]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
treewide: explicitly mark unused arguments
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 19 Nov 2023 16:27:40 +0000 (17:27 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 20 Nov 2023 16:45:22 +0000 (17:45 +0100)
The autotools build used -Wno-unused-parameter to silence these warnings
for a few files. On meson however this configuration was not duplicated
leading to persistent warnings, preventing the usage of -Werror.

Instead of having to maintain the exceptions in two buildsystems, mark
the exceptions directly in the source code.

Afterward clean up autotools to not use -Wno-unused-parameter anymore.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
29 files changed:
configure.ac
libfdisk/samples/Makemodule.am
libfdisk/samples/mkpart-fullspec.c
libfdisk/samples/mkpart.c
libfdisk/src/Makemodule.am
libfdisk/src/ask.c
libfdisk/src/gpt.c
libfdisk/src/item.c
libfdisk/src/script.c
libfdisk/src/utils.c
libfdisk/src/version.c
libmount/samples/Makemodule.am
libmount/src/Makemodule.am
libmount/src/cache.c
libmount/src/context.c
libmount/src/context_mount.c
libmount/src/lock.c
libmount/src/monitor.c
libmount/src/optlist.c
libmount/src/optstr.c
libmount/src/tab.c
libmount/src/tab_diff.c
libmount/src/tab_update.c
libmount/src/utils.c
libmount/src/version.c
libsmartcols/samples/Makemodule.am
libsmartcols/samples/continuous.c
libsmartcols/samples/maxout.c
meson.build

index d7c5155c9c09c07fbc56dd975ba875bcdcf74253..9c6895b53d1810047ec990d8a14cfd83b1666628 100644 (file)
@@ -178,9 +178,6 @@ AC_SUBST([BSD_WARN_CFLAGS])
 UL_WARN_ADD([-Wno-cast-function-type], [PYTHON_WARN_CFLAGS])
 AC_SUBST([PYTHON_WARN_CFLAGS])
 
-UL_WARN_ADD([-Wno-unused-parameter], [NO_UNUSED_WARN_CFLAGS])
-AC_SUBST([NO_UNUSED_WARN_CFLAGS])
-
 
 AC_ARG_ENABLE([asan],
   AS_HELP_STRING([--enable-asan], [compile with Address Sanitizer]),
index b67b12183ad00c11dcc011e3300b7bd692f1a039..0c3443638341ed38200160ffc66ab93d728ea81a 100644 (file)
@@ -3,8 +3,7 @@ check_PROGRAMS += \
        sample-fdisk-mkpart \
        sample-fdisk-mkpart-fullspec
 
-sample_fdisk_cflags = $(AM_CFLAGS) $(NO_UNUSED_WARN_CFLAGS) \
-                      -I$(ul_libfdisk_incdir)
+sample_fdisk_cflags = $(AM_CFLAGS) -I$(ul_libfdisk_incdir)
 sample_fdisk_ldadd = $(LDADD) libfdisk.la
 
 sample_fdisk_mkpart_SOURCES = libfdisk/samples/mkpart.c
index 821a68898848d215f3652e7b2279c86ed22f42b7..0dca3f1dfda38e262ac262bb952dfc9e610fa680 100644 (file)
@@ -27,7 +27,7 @@
 
 static int ask_callback(struct fdisk_context *cxt __attribute__((__unused__)),
                        struct fdisk_ask *ask,
-                       void *data)
+                       void *data __attribute__((unused)))
 {
        switch(fdisk_ask_get_type(ask)) {
        case FDISK_ASKTYPE_INFO:
index 1e5fd99e551ba488ee3c740ec44938e252705409..766e7517e43b924ada01376eaed9402c5468ab3f 100644 (file)
@@ -39,7 +39,7 @@
 
 static int ask_callback(struct fdisk_context *cxt __attribute__((__unused__)),
                        struct fdisk_ask *ask,
-                       void *data)
+                       void *data __attribute__((unused)))
 {
        switch(fdisk_ask_get_type(ask)) {
        case FDISK_ASKTYPE_INFO:
index 9bd64c11a47df28c29a79bb978c44fbea809a8a3..073d57158dd3a73ae5db9f9ed3740a991abd38a8 100644 (file)
@@ -67,7 +67,7 @@ check_PROGRAMS += \
        test_fdisk_version \
        test_fdisk_item
 
-libfdisk_tests_cflags  = -DTEST_PROGRAM $(libfdisk_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
+libfdisk_tests_cflags  = -DTEST_PROGRAM $(libfdisk_la_CFLAGS)
 libfdisk_tests_ldflags = libuuid.la -static
 libfdisk_tests_ldadd   = libfdisk.la $(LDADD)
 
@@ -102,7 +102,7 @@ check_PROGRAMS += test_fdisk_script_fuzz
 nodist_EXTRA_test_fdisk_script_fuzz_SOURCES = dummy.cxx
 
 test_fdisk_script_fuzz_SOURCES = libfdisk/src/script.c
-test_fdisk_script_fuzz_CFLAGS = -DFUZZ_TARGET $(libfdisk_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
+test_fdisk_script_fuzz_CFLAGS = -DFUZZ_TARGET $(libfdisk_la_CFLAGS)
 test_fdisk_script_fuzz_LDFLAGS = $(libfdisk_tests_ldflags) -lpthread
 test_fdisk_script_fuzz_LDADD = $(libfdisk_tests_ldadd) $(LIB_FUZZING_ENGINE)
 endif
index 274f6ba7b1f5870747603dca3e2a37a3157dc141..299f65b43480d3db18bfd7e7dc854be9bc91722d 100644 (file)
@@ -1035,7 +1035,9 @@ int fdisk_info_new_partition(
 }
 
 #ifdef TEST_PROGRAM
-static int test_ranges(struct fdisk_test *ts, int argc, char *argv[])
+static int test_ranges(struct fdisk_test *ts __attribute__((unused)),
+                      int argc __attribute__((unused)),
+                      char *argv[] __attribute__((unused)))
 {
        /*                1  -  3,       6,    8, 9,   11    13 */
        size_t nums[] = { 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1 };
index c3c0347cb8de0c7b999eacce54b2d5f9270fc971..e4e67294be48a5f0776c5cb8d0af90130c440fe8 100644 (file)
@@ -3322,8 +3322,12 @@ void fdisk_gpt_enable_minimize(struct fdisk_label *lb, int enable)
 }
 
 #ifdef TEST_PROGRAM
-static int test_getattr(struct fdisk_test *ts, int argc, char *argv[])
+static int test_getattr(struct fdisk_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
+       if (argc != 3)
+               return -1;
+
        const char *disk = argv[1];
        size_t part = strtoul(argv[2], NULL, 0) - 1;
        struct fdisk_context *cxt;
@@ -3344,8 +3348,12 @@ static int test_getattr(struct fdisk_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_setattr(struct fdisk_test *ts, int argc, char *argv[])
+static int test_setattr(struct fdisk_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
+       if (argc != 4)
+               return -1;
+
        const char *disk = argv[1];
        size_t part = strtoul(argv[2], NULL, 0) - 1;
        uint64_t atters = strtoull(argv[3], NULL, 0);
index 671f9ad38988361a0ad825971347d1715b2b8862..f46e646f560c9f01c8e55610afb09efaa4e54b4a 100644 (file)
@@ -199,8 +199,12 @@ int fdisk_labelitem_is_number(struct fdisk_labelitem *li)
 }
 
 #ifdef TEST_PROGRAM
-static int test_listitems(struct fdisk_test *ts, int argc, char *argv[])
+static int test_listitems(struct fdisk_test *ts __attribute__((unused)),
+                         int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        const char *disk = argv[1];
        struct fdisk_context *cxt;
        struct fdisk_labelitem *item;
index efa743f91d5e3c44dba725a2e4719cba11c56363..e357fad9a4a1f3dd9956bf3893542bd44c256cbc 100644 (file)
@@ -1669,8 +1669,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 #endif
 
 #ifdef TEST_PROGRAM
-static int test_dump(struct fdisk_test *ts, int argc, char *argv[])
+static int test_dump(struct fdisk_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *devname = argv[1];
        struct fdisk_context *cxt;
        struct fdisk_script *dp;
@@ -1688,8 +1692,12 @@ static int test_dump(struct fdisk_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_read(struct fdisk_test *ts, int argc, char *argv[])
+static int test_read(struct fdisk_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *filename = argv[1];
        struct fdisk_script *dp;
        struct fdisk_context *cxt;
@@ -1711,8 +1719,12 @@ static int test_read(struct fdisk_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_stdin(struct fdisk_test *ts, int argc, char *argv[])
+static int test_stdin(struct fdisk_test *ts __attribute__((unused)),
+                     int argc, char *argv[] __attribute__((unused)))
 {
+       if (argc != 1)
+               return -1;
+
        char buf[BUFSIZ] = { '\0' };
        struct fdisk_script *dp;
        struct fdisk_context *cxt;
@@ -1746,8 +1758,12 @@ static int test_stdin(struct fdisk_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_apply(struct fdisk_test *ts, int argc, char *argv[])
+static int test_apply(struct fdisk_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
+       if (argc != 3)
+               return -1;
+
        char *devname = argv[1], *scriptname = argv[2];
        struct fdisk_context *cxt;
        struct fdisk_script *dp;
@@ -1788,8 +1804,12 @@ done:
        return 0;
 }
 
-static int test_tokens(struct fdisk_test *ts, int argc, char *argv[])
+static int test_tokens(struct fdisk_test *ts __attribute__((unused)),
+                      int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *p, *str = argc == 2 ? strdup(argv[1]) : NULL;
        int i;
 
index 6b6167d478681545d5b406d9b4240709508aed4e..a7c8bfa2e51e161ca94228096b7e3e304031f934 100644 (file)
@@ -183,11 +183,15 @@ done:
 }
 
 #ifdef TEST_PROGRAM
-struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt) { return NULL; }
+struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt __attribute__((unused))) { return NULL; }
+struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt __attribute__((unused))) { return NULL; }
 
-static int test_partnames(struct fdisk_test *ts, int argc, char *argv[])
+static int test_partnames(struct fdisk_test *ts __attribute__((unused)),
+                         int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        size_t i;
        const char *disk = argv[1];
 
index 9d84b4c96821ead8431391310c6cfe0205d07e00..b0661e229b4fe9dd69ff027a261ef825789731d4 100644 (file)
@@ -91,7 +91,9 @@ int fdisk_get_library_features(const char ***features)
 }
 
 #ifdef TEST_PROGRAM
-static int test_version(struct fdisk_test *ts, int argc, char *argv[])
+static int test_version(struct fdisk_test *ts __attribute__((unused)),
+                       int argc __attribute__((unused)),
+                       char *argv[] __attribute__((unused)))
 {
        const char *ver;
        const char **features;
index 9081ed784ee7cbe401d3abd317a43bebfdbd5b8f..e223ea6cc3892f4b39d7c543cbe11ef885a948e1 100644 (file)
@@ -2,8 +2,7 @@
 check_PROGRAMS += \
        sample-mount-overwrite
 
-sample_mount_cflags = $(AM_CFLAGS) $(NO_UNUSED_WARN_CFLAGS) \
-                      -I$(ul_libmount_incdir)
+sample_mount_cflags = $(AM_CFLAGS) -I$(ul_libmount_incdir)
 sample_mount_ldadd = libmount.la $(LDADD)
 
 
index 367bc4673c41d5820658b4fab80154d8df41e664..f8cedbd280db38bd74a874892b346e7a47cae33f 100644 (file)
@@ -101,7 +101,7 @@ check_PROGRAMS += test_mount_context test_mount_context_mount
 check_PROGRAMS += test_mount_monitor
 endif
 
-libmount_tests_cflags  = -DTEST_PROGRAM $(libmount_la_CFLAGS) $(NO_UNUSED_WARN_CFLAGS)
+libmount_tests_cflags  = -DTEST_PROGRAM $(libmount_la_CFLAGS)
 libmount_tests_ldflags = -static
 libmount_tests_ldadd   = libmount.la libblkid.la $(LDADD) $(REALTIME_LIBS)
 
index 55e1d15a38eb6ef52e13ee4d963c3771f2531546..b7956346f8b157bdad5546d9f0e2f02c821fa2a6 100644 (file)
@@ -748,7 +748,9 @@ char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache)
 
 #ifdef TEST_PROGRAM
 
-static int test_resolve_path(struct libmnt_test *ts, int argc, char *argv[])
+static int test_resolve_path(struct libmnt_test *ts __attribute__((unused)),
+                            int argc __attribute__((unused)),
+                            char *argv[] __attribute__((unused)))
 {
        char line[BUFSIZ];
        struct libmnt_cache *cache;
@@ -771,7 +773,9 @@ static int test_resolve_path(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_resolve_spec(struct libmnt_test *ts, int argc, char *argv[])
+static int test_resolve_spec(struct libmnt_test *ts __attribute__((unused)),
+                            int argc __attribute__((unused)),
+                            char *argv[] __attribute__((unused)))
 {
        char line[BUFSIZ];
        struct libmnt_cache *cache;
@@ -794,7 +798,9 @@ static int test_resolve_spec(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_read_tags(struct libmnt_test *ts, int argc, char *argv[])
+static int test_read_tags(struct libmnt_test *ts __attribute__((unused)),
+                         int argc __attribute__((unused)),
+                         char *argv[] __attribute__((unused)))
 {
        char line[BUFSIZ];
        struct libmnt_cache *cache;
index 7efbd6193d5ea44ee60826f85171e72b9cb3e616..be216708f988f2620e234faf3d1a63c3fd44afc0 100644 (file)
@@ -3166,7 +3166,8 @@ struct libmnt_ns *mnt_context_switch_target_ns(struct libmnt_context *cxt)
 
 #ifdef TEST_PROGRAM
 
-static int test_search_helper(struct libmnt_test *ts, int argc, char *argv[])
+static int test_search_helper(struct libmnt_test *ts __attribute__((unused)),
+                             int argc, char *argv[])
 {
        struct libmnt_context *cxt;
        const char *type;
@@ -3200,7 +3201,8 @@ static void lock_fallback(void)
                mnt_unlock_file(lock);
 }
 
-static int test_mount(struct libmnt_test *ts, int argc, char *argv[])
+static int test_mount(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        int idx = 1, rc = 0;
        struct libmnt_context *cxt;
@@ -3250,7 +3252,8 @@ static int test_mount(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_umount(struct libmnt_test *ts, int argc, char *argv[])
+static int test_umount(struct libmnt_test *ts __attribute__((unused)),
+                      int argc, char *argv[])
 {
        int idx = 1, rc = 0;
        struct libmnt_context *cxt;
@@ -3305,7 +3308,8 @@ err:
        return rc;
 }
 
-static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
+static int test_flags(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        int idx = 1, rc = 0;
        struct libmnt_context *cxt;
@@ -3343,7 +3347,8 @@ static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_cxtsync(struct libmnt_test *ts, int argc, char *argv[])
+static int test_cxtsync(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_context *cxt;
        struct libmnt_fs *fs;
@@ -3387,7 +3392,8 @@ static int test_cxtsync(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_mountall(struct libmnt_test *ts, int argc, char *argv[])
+static int test_mountall(struct libmnt_test *ts __attribute__((unused)),
+                        int argc, char *argv[])
 {
        struct libmnt_context *cxt;
        struct libmnt_iter *itr;
index dcc5eb97fbbf808284e2df881118a513a4bfe2ed..9beac17c01be21b9918fefd26d72a79d7c042dd1 100644 (file)
@@ -1751,7 +1751,8 @@ int mnt_context_get_mount_excode(
 
 #ifdef TEST_PROGRAM
 
-static int test_perms(struct libmnt_test *ts, int argc, char *argv[])
+static int test_perms(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        struct libmnt_context *cxt;
        struct libmnt_optlist *ls;
@@ -1794,7 +1795,8 @@ static int test_perms(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_fixopts(struct libmnt_test *ts, int argc, char *argv[])
+static int test_fixopts(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_context *cxt;
        struct libmnt_optlist *ls;
index 48354064720933782a399de1ea742bc83419e47c..708e6a575429081ce366823d2476cab1a9743b59 100644 (file)
@@ -295,7 +295,8 @@ static void __attribute__((__noreturn__)) sig_handler(int sig)
        errx(EXIT_FAILURE, "\n%d: catch signal: %s\n", getpid(), strsignal(sig));
 }
 
-static int test_lock(struct libmnt_test *ts, int argc, char *argv[])
+static int test_lock(struct libmnt_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
        time_t synctime = 0;
        unsigned int usecs;
index f99751e71e36ddc0bcbfa032baff0e99bce35b65..f21cf7486e5f779be5f8b936068bf770554033a4 100644 (file)
@@ -870,7 +870,8 @@ err:
 /*
  * create a monitor and add the monitor fd to epoll
  */
-static int __test_epoll(struct libmnt_test *ts, int argc, char *argv[], int cleanup)
+static int __test_epoll(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[], int cleanup)
 {
        int fd, efd = -1, rc = -1;
        struct epoll_event ev;
@@ -947,7 +948,8 @@ static int test_epoll_cleanup(struct libmnt_test *ts, int argc, char *argv[])
 /*
  * create a monitor and wait for a change
  */
-static int test_wait(struct libmnt_test *ts, int argc, char *argv[])
+static int test_wait(struct libmnt_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
        const char *filename;
        struct libmnt_monitor *mn = create_test_monitor(argc, argv);
index d0afc94f72aa12e38c5c2e39bcbb8fe9c8b0262b..101c908aeff3b7a002daf34e446acfd4c9333042 100644 (file)
@@ -1241,7 +1241,8 @@ static inline unsigned long str2flg(const char *str)
        return (unsigned long) strtox64_or_err(str, "connt convert string to flags");
 }
 
-static int test_append_str(struct libmnt_test *ts, int argc, char *argv[])
+static int test_append_str(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        int rc;
@@ -1257,7 +1258,8 @@ static int test_append_str(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_prepend_str(struct libmnt_test *ts, int argc, char *argv[])
+static int test_prepend_str(struct libmnt_test *ts __attribute__((unused)),
+                           int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        int rc;
@@ -1273,7 +1275,8 @@ static int test_prepend_str(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_set_str(struct libmnt_test *ts, int argc, char *argv[])
+static int test_set_str(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        int rc;
@@ -1289,7 +1292,8 @@ static int test_set_str(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_append_flg(struct libmnt_test *ts, int argc, char *argv[])
+static int test_append_flg(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        int rc;
@@ -1305,7 +1309,8 @@ static int test_append_flg(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_set_flg(struct libmnt_test *ts, int argc, char *argv[])
+static int test_set_flg(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        int rc;
@@ -1321,7 +1326,8 @@ static int test_set_flg(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_get_str(struct libmnt_test *ts, int argc, char *argv[])
+static int test_get_str(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        const struct libmnt_optmap *map;
@@ -1380,7 +1386,8 @@ done:
        return rc;
 }
 
-static int test_get_flg(struct libmnt_test *ts, int argc, char *argv[])
+static int test_get_flg(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        unsigned long flags = 0;
@@ -1397,7 +1404,8 @@ static int test_get_flg(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_split(struct libmnt_test *ts, int argc, char *argv[])
+static int test_split(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        struct libmnt_optlist *ol;
        int rc;
index e86b962b44dbe7608c098c5fe3a29f70e5649fe8..55888bde35bb2cbc38d8056ec126efc6f4b7cabf 100644 (file)
@@ -910,7 +910,8 @@ int mnt_match_options(const char *optstr, const char *pattern)
 }
 
 #ifdef TEST_PROGRAM
-static int test_append(struct libmnt_test *ts, int argc, char *argv[])
+static int test_append(struct libmnt_test *ts __attribute__((unused)),
+                      int argc, char *argv[])
 {
        const char *value = NULL, *name;
        char *optstr;
@@ -933,7 +934,8 @@ static int test_append(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_prepend(struct libmnt_test *ts, int argc, char *argv[])
+static int test_prepend(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        const char *value = NULL, *name;
        char *optstr;
@@ -956,7 +958,8 @@ static int test_prepend(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_split(struct libmnt_test *ts, int argc, char *argv[])
+static int test_split(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        char *optstr, *user = NULL, *fs = NULL, *vfs = NULL;
        int rc;
@@ -982,7 +985,8 @@ static int test_split(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
+static int test_flags(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        char *optstr;
        int rc;
@@ -1010,7 +1014,8 @@ static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_apply(struct libmnt_test *ts, int argc, char *argv[])
+static int test_apply(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        char *optstr;
        int rc, map;
@@ -1042,7 +1047,8 @@ static int test_apply(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_set(struct libmnt_test *ts, int argc, char *argv[])
+static int test_set(struct libmnt_test *ts __attribute__((unused)),
+                   int argc, char *argv[])
 {
        const char *value = NULL, *name;
        char *optstr;
@@ -1065,7 +1071,8 @@ static int test_set(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_get(struct libmnt_test *ts, int argc, char *argv[])
+static int test_get(struct libmnt_test *ts __attribute__((unused)),
+                   int argc, char *argv[])
 {
        char *optstr;
        const char *name;
@@ -1094,7 +1101,8 @@ static int test_get(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_remove(struct libmnt_test *ts, int argc, char *argv[])
+static int test_remove(struct libmnt_test *ts __attribute__((unused)),
+                      int argc, char *argv[])
 {
        const char *name;
        char *optstr;
@@ -1114,7 +1122,8 @@ static int test_remove(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_dedup(struct libmnt_test *ts, int argc, char *argv[])
+static int test_dedup(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        const char *name;
        char *optstr;
@@ -1134,7 +1143,8 @@ static int test_dedup(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_match(struct libmnt_test *ts, int argc, char *argv[])
+static int test_match(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        char *optstr, *pattern;
 
index 972566467bd82d2e28acb067a3c57a52863bd5ad..526edcee6cca9b33947e09f5d308a3aff537b6e5 100644 (file)
@@ -1925,7 +1925,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
 #ifdef TEST_PROGRAM
 #include "pathnames.h"
 
-static int parser_errcb(struct libmnt_table *tb, const char *filename, int line)
+static int parser_errcb(struct libmnt_table *tb __attribute__((unused)),
+                       const char *filename, int line)
 {
        fprintf(stderr, "%s:%d: parse error\n", filename, line);
 
@@ -1954,12 +1955,16 @@ err:
        return NULL;
 }
 
-static int test_copy_fs(struct libmnt_test *ts, int argc, char *argv[])
+static int test_copy_fs(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_table *tb;
        struct libmnt_fs *fs;
        int rc = -1;
 
+       if (argc != 2)
+               return -1;
+
        tb = create_table(argv[1], FALSE);
        if (!tb)
                return -1;
@@ -1984,7 +1989,8 @@ done:
        return rc;
 }
 
-static int test_parse(struct libmnt_test *ts, int argc, char *argv[])
+static int test_parse(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        struct libmnt_table *tb = NULL;
        struct libmnt_iter *itr = NULL;
@@ -2020,7 +2026,8 @@ done:
        return rc;
 }
 
-static int test_find_idx(struct libmnt_test *ts, int argc, char *argv[])
+static int test_find_idx(struct libmnt_test *ts __attribute__((unused)),
+                        int argc, char *argv[])
 {
        struct libmnt_table *tb;
        struct libmnt_fs *fs = NULL;
@@ -2065,7 +2072,8 @@ done:
        return rc;
 }
 
-static int test_find(struct libmnt_test *ts, int argc, char *argv[], int dr)
+static int test_find(struct libmnt_test *ts __attribute__((unused)),
+                    int argc, char *argv[], int dr)
 {
        struct libmnt_table *tb;
        struct libmnt_fs *fs = NULL;
@@ -2107,23 +2115,29 @@ done:
        return rc;
 }
 
-static int test_find_bw(struct libmnt_test *ts, int argc, char *argv[])
+static int test_find_bw(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        return test_find(ts, argc, argv, MNT_ITER_BACKWARD);
 }
 
-static int test_find_fw(struct libmnt_test *ts, int argc, char *argv[])
+static int test_find_fw(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        return test_find(ts, argc, argv, MNT_ITER_FORWARD);
 }
 
-static int test_find_pair(struct libmnt_test *ts, int argc, char *argv[])
+static int test_find_pair(struct libmnt_test *ts __attribute__((unused)),
+                         int argc, char *argv[])
 {
        struct libmnt_table *tb;
        struct libmnt_fs *fs;
        struct libmnt_cache *mpc = NULL;
        int rc = -1;
 
+       if (argc != 4)
+               return -1;
+
        tb = create_table(argv[1], FALSE);
        if (!tb)
                return -1;
@@ -2144,13 +2158,17 @@ done:
        return rc;
 }
 
-static int test_find_mountpoint(struct libmnt_test *ts, int argc, char *argv[])
+static int test_find_mountpoint(struct libmnt_test *ts __attribute__((unused)),
+                               int argc, char *argv[])
 {
        struct libmnt_table *tb;
        struct libmnt_fs *fs;
        struct libmnt_cache *mpc = NULL;
        int rc = -1;
 
+       if (argc != 2)
+               return -1;
+
        tb = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
        if (!tb)
                return -1;
@@ -2171,13 +2189,17 @@ done:
        return rc;
 }
 
-static int test_is_mounted(struct libmnt_test *ts, int argc, char *argv[])
+static int test_is_mounted(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
        struct libmnt_table *tb = NULL, *fstab = NULL;
        struct libmnt_fs *fs;
        struct libmnt_iter *itr = NULL;
        struct libmnt_cache *mpc = NULL;
 
+       if (argc != 2)
+               return -1;
+
        tb = mnt_new_table_from_file("/proc/self/mountinfo");
        if (!tb) {
                fprintf(stderr, "failed to parse mountinfo\n");
@@ -2227,7 +2249,8 @@ static int test_uniq_cmp(struct libmnt_table *tb __attribute__((__unused__)),
        return mnt_fs_streq_target(a, mnt_fs_get_target(b)) ? 0 : 1;
 }
 
-static int test_uniq(struct libmnt_test *ts, int argc, char *argv[])
+static int test_uniq(struct libmnt_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
        struct libmnt_table *tb;
        int rc = -1;
index d5fbc4d49c8d9839650e100bfbf1d63d06a76641..2765caf7111acd8cd7ba602348388b0b7324d421 100644 (file)
@@ -309,7 +309,8 @@ done:
 
 #ifdef TEST_PROGRAM
 
-static int test_diff(struct libmnt_test *ts, int argc, char *argv[])
+static int test_diff(struct libmnt_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
        struct libmnt_table *tb_old, *tb_new;
        struct libmnt_tabdiff *diff;
@@ -317,6 +318,9 @@ static int test_diff(struct libmnt_test *ts, int argc, char *argv[])
        struct libmnt_fs *old, *new;
        int rc = -1, change;
 
+       if (argc != 3)
+               return -1;
+
        tb_old = mnt_new_table_from_file(argv[1]);
        tb_new = mnt_new_table_from_file(argv[2]);
        diff = mnt_new_tabdiff();
index f5e5d3045cf8c540c7bfb708e7dc849ba8c19dc1..e938ea4647e88395572257bbb846e7e73cfa0031 100644 (file)
@@ -970,7 +970,8 @@ done:
        return rc;
 }
 
-static int test_add(struct libmnt_test *ts, int argc, char *argv[])
+static int test_add(struct libmnt_test *ts __attribute__((unused)),
+                   int argc, char *argv[])
 {
        struct libmnt_fs *fs = mnt_new_fs();
        int rc;
@@ -987,14 +988,16 @@ static int test_add(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_remove(struct libmnt_test *ts, int argc, char *argv[])
+static int test_remove(struct libmnt_test *ts __attribute__((unused)),
+                      int argc, char *argv[])
 {
        if (argc < 2)
                return -1;
        return update(argv[1], NULL, 0);
 }
 
-static int test_move(struct libmnt_test *ts, int argc, char *argv[])
+static int test_move(struct libmnt_test *ts __attribute__((unused)),
+                    int argc, char *argv[])
 {
        struct libmnt_fs *fs = mnt_new_fs();
        int rc;
@@ -1010,7 +1013,8 @@ static int test_move(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_remount(struct libmnt_test *ts, int argc, char *argv[])
+static int test_remount(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_fs *fs = mnt_new_fs();
        int rc;
@@ -1025,7 +1029,8 @@ static int test_remount(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_replace(struct libmnt_test *ts, int argc, char *argv[])
+static int test_replace(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        struct libmnt_fs *fs = mnt_new_fs();
        struct libmnt_table *tb = mnt_new_table();
index c20c949a8443f234f0ff08b4e8f77da89840037b..2677b18dc01f54822a185c62ebc0dc16c5e1cf84 100644 (file)
@@ -1287,8 +1287,12 @@ done:
 }
 
 #ifdef TEST_PROGRAM
-static int test_match_fstype(struct libmnt_test *ts, int argc, char *argv[])
+static int test_match_fstype(struct libmnt_test *ts __attribute__((unused)),
+                            int argc, char *argv[])
 {
+       if (argc != 3)
+               return -1;
+
        char *type = argv[1];
        char *pattern = argv[2];
 
@@ -1296,8 +1300,12 @@ static int test_match_fstype(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_match_options(struct libmnt_test *ts, int argc, char *argv[])
+static int test_match_options(struct libmnt_test *ts __attribute__((unused)),
+                             int argc, char *argv[])
 {
+       if (argc != 3)
+               return -1;
+
        char *optstr = argv[1];
        char *pattern = argv[2];
 
@@ -1305,8 +1313,12 @@ static int test_match_options(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_startswith(struct libmnt_test *ts, int argc, char *argv[])
+static int test_startswith(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
+       if (argc != 3)
+               return -1;
+
        char *optstr = argv[1];
        char *pattern = argv[2];
 
@@ -1314,8 +1326,12 @@ static int test_startswith(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_endswith(struct libmnt_test *ts, int argc, char *argv[])
+static int test_endswith(struct libmnt_test *ts __attribute__((unused)),
+                        int argc, char *argv[])
 {
+       if (argc != 3)
+               return -1;
+
        char *optstr = argv[1];
        char *pattern = argv[2];
 
@@ -1323,8 +1339,12 @@ static int test_endswith(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_mountpoint(struct libmnt_test *ts, int argc, char *argv[])
+static int test_mountpoint(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *path = canonicalize_path(argv[1]),
             *mnt = path ? mnt_get_mountpoint(path) :  NULL;
 
@@ -1334,11 +1354,16 @@ static int test_mountpoint(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_filesystems(struct libmnt_test *ts, int argc, char *argv[])
+static int test_filesystems(struct libmnt_test *ts __attribute__((unused)),
+                           int argc, char *argv[])
 {
        char **filesystems = NULL;
        int rc;
 
+       if (argc != 2)
+               return -1;
+
+
        rc = mnt_get_filesystems(&filesystems, argc ? argv[1] : NULL);
        if (!rc) {
                char **p;
@@ -1349,8 +1374,12 @@ static int test_filesystems(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_chdir(struct libmnt_test *ts, int argc, char *argv[])
+static int test_chdir(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        int rc;
        char *path = canonicalize_path(argv[1]),
             *last = NULL;
@@ -1368,8 +1397,12 @@ static int test_chdir(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_kernel_cmdline(struct libmnt_test *ts, int argc, char *argv[])
+static int test_kernel_cmdline(struct libmnt_test *ts __attribute__((unused)),
+                              int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *name = argv[1];
        char *res;
 
@@ -1387,7 +1420,8 @@ static int test_kernel_cmdline(struct libmnt_test *ts, int argc, char *argv[])
 }
 
 
-static int test_guess_root(struct libmnt_test *ts, int argc, char *argv[])
+static int test_guess_root(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
        int rc;
        char *real;
@@ -1413,10 +1447,14 @@ static int test_guess_root(struct libmnt_test *ts, int argc, char *argv[])
        return 0;
 }
 
-static int test_mkdir(struct libmnt_test *ts, int argc, char *argv[])
+static int test_mkdir(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
        int rc;
 
+       if (argc != 2)
+               return -1;
+
        rc = ul_mkdir_p(argv[1], S_IRWXU |
                         S_IRGRP | S_IXGRP |
                         S_IROTH | S_IXOTH);
@@ -1425,11 +1463,15 @@ static int test_mkdir(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int test_statfs_type(struct libmnt_test *ts, int argc, char *argv[])
+static int test_statfs_type(struct libmnt_test *ts __attribute__((unused)),
+                           int argc, char *argv[])
 {
        struct statfs vfs;
        int rc;
 
+       if (argc != 2)
+               return -1;
+
        rc = statfs(argv[1], &vfs);
        if (rc)
                printf("%s: statfs failed: %m\n", argv[1]);
@@ -1440,8 +1482,12 @@ static int test_statfs_type(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int tests_parse_uid(struct libmnt_test *ts, int argc, char *argv[])
+static int tests_parse_uid(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *str = argv[1];
        uid_t uid = (uid_t) -1;
        int rc;
@@ -1455,8 +1501,12 @@ static int tests_parse_uid(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int tests_parse_gid(struct libmnt_test *ts, int argc, char *argv[])
+static int tests_parse_gid(struct libmnt_test *ts __attribute__((unused)),
+                          int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *str = argv[1];
        gid_t gid = (gid_t) -1;
        int rc;
@@ -1470,8 +1520,12 @@ static int tests_parse_gid(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int tests_parse_mode(struct libmnt_test *ts, int argc, char *argv[])
+static int tests_parse_mode(struct libmnt_test *ts __attribute__((unused)),
+                           int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *str = argv[1];
        mode_t mod = (mode_t) -1;
        int rc;
@@ -1488,8 +1542,12 @@ static int tests_parse_mode(struct libmnt_test *ts, int argc, char *argv[])
        return rc;
 }
 
-static int tests_stat(struct libmnt_test *ts, int argc, char *argv[])
+static int tests_stat(struct libmnt_test *ts __attribute__((unused)),
+                     int argc, char *argv[])
 {
+       if (argc != 2)
+               return -1;
+
        char *path = argv[1];
        struct stat st;
        int rc;
index 894c20c5cb88726d7165b35af6b715905b1dc048..b1e34327e89f62598bb07c29b97bc3c4a9a364a0 100644 (file)
@@ -121,7 +121,8 @@ int mnt_get_library_features(const char ***features)
 }
 
 #ifdef TEST_PROGRAM
-static int test_version(struct libmnt_test *ts, int argc, char *argv[])
+static int test_version(struct libmnt_test *ts __attribute__((unused)),
+                       int argc, char *argv[])
 {
        const char *ver;
        const char **features;
index c0130b9e0a0fab8591390ead275649638c3ea3d6..fbdf6fd3d429c289200f8bb89c835458c0626228 100644 (file)
@@ -9,8 +9,7 @@ check_PROGRAMS += \
        sample-scols-grouping-overlay \
        sample-scols-maxout
 
-sample_scols_cflags = $(AM_CFLAGS) $(NO_UNUSED_WARN_CFLAGS) \
-                      -I$(ul_libsmartcols_incdir)
+sample_scols_cflags = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
 sample_scols_ldadd = libsmartcols.la $(LDADD)
 
 if HAVE_OPENAT
index 6bdba6e824003a5553b89a009ba1f1c27d86bb78..90afb8299919ed1d3987c84fa1d73548e27f0812 100644 (file)
@@ -65,7 +65,7 @@ fail:
        err(EXIT_FAILURE, "failed to create output line");
 }
 
-int main(int argc, char *argv[])
+int main(void)
 {
        struct libscols_table *tb;
        size_t i;
index 20c6424e404e0f4ad5d738c5f966d0856a916f8f..a86769707faf9d71409d1fad1490be0fd89cc521 100644 (file)
@@ -19,7 +19,7 @@
 
 enum { COL_LEFT, COL_FOO, COL_RIGHT };
 
-int main(int argc, char *argv[])
+int main(void)
 {
        struct libscols_table *tb;
        int rc = -1, nlines = 3;
index 55ad30d6ac7b91b9f898a20ee5b15a6c8d90a634..eb7837a7c38c7b67a67018a3c780341bf2d3fc64 100644 (file)
@@ -3220,8 +3220,7 @@ endif
 
 ############################################################
 
-libfdisk_tests_cflags = ['-DTEST_PROGRAM',
-                         '-Wno-unused']
+libfdisk_tests_cflags = ['-DTEST_PROGRAM']
 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
 
 exe = executable(
@@ -3290,13 +3289,11 @@ if not is_disabler(exe)
   exes += exe
 endif
 
-sample_fdisk_cflags = ['-Wno-unused']
 sample_fdisk_ldadd = [lib_common, lib_fdisk]
 
 exe = executable(
   'sample-fdisk-mkpart',
   'libfdisk/samples/mkpart.c',
-  c_args : sample_fdisk_cflags,
   include_directories : lib_fdisk_includes,
   link_with : sample_fdisk_ldadd)
 if not is_disabler(exe)
@@ -3306,7 +3303,6 @@ endif
 exe = executable(
   'sample-fdisk-mkpart-fullspec',
   'libfdisk/samples/mkpart-fullspec.c',
-  c_args : sample_fdisk_cflags,
   include_directories : lib_fdisk_includes,
   link_with : sample_fdisk_ldadd)
 if not is_disabler(exe)