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]),
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
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:
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:
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)
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
}
#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 };
}
#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;
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);
}
#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;
#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;
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;
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;
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;
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;
}
#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];
}
#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;
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)
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)
#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;
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;
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;
#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;
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;
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;
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;
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;
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;
#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;
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;
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;
/*
* 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;
/*
* 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);
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;
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;
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;
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;
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;
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;
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;
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;
}
#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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
#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);
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;
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;
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;
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;
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;
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;
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");
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;
#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;
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();
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;
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;
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;
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();
}
#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];
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];
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];
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];
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;
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;
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;
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;
}
-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;
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);
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]);
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;
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;
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;
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;
}
#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;
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
err(EXIT_FAILURE, "failed to create output line");
}
-int main(int argc, char *argv[])
+int main(void)
{
struct libscols_table *tb;
size_t i;
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;
############################################################
-libfdisk_tests_cflags = ['-DTEST_PROGRAM',
- '-Wno-unused']
+libfdisk_tests_cflags = ['-DTEST_PROGRAM']
libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
exe = executable(
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)
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)