]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: fix icc/clang compiler warnings
authorRuediger Meier <ruediger.meier@ga-group.nl>
Sat, 12 Mar 2016 22:55:48 +0000 (23:55 +0100)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Sun, 13 Mar 2016 20:47:27 +0000 (21:47 +0100)
clang warning:
libmount/src/tab.c:1833:6: warning: variable 'rc' is used uninitialized whenever
      'if' condition is true [-Wsometimes-uninitialized]
        if (!mpc)
            ^~~~

icc printf warnings:
    libmount/src/monitor.c(348): warning #2279: printf/scanf format not a string literal and no format arguments
            DBG(MONITOR, ul_debugobj(mn, status == 1 ? " success" : " nothing"));
            ^
    login-utils/vipw.c(348): warning #2279: printf/scanf format not a string literal and no format arguments
                           : _("You are using shadow passwords on this system.\n"));
                                                                                  ^

icc enum warnings:
    disk-utils/fdisk-menu.c(150): warning #188: enumerated type mixed with another type
            .exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD,
                       ^
    libsmartcols/src/table_print.c(750): warning #188: enumerated type mixed with another type
                            &width, align,
                                    ^

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
disk-utils/fdisk-menu.c
libmount/src/monitor.c
libmount/src/tab.c
libsmartcols/src/table_print.c
login-utils/vipw.c

index 84b8fb733572ca137245e3f9ae1deaef8282b8fd..71958442fe3c7fe3f026a99740874ac9aac2d238 100644 (file)
@@ -19,7 +19,7 @@ struct menu_entry {
                                                   but don't print it in help */
 
        enum fdisk_labeltype    label;          /* only for this label */
-       enum fdisk_labeltype    exclude;        /* all labels except this */
+       int                     exclude;    /* all labels except these */
        enum fdisk_labeltype    parent;         /* for nested PT */
 };
 
@@ -28,7 +28,7 @@ struct menu_entry {
 
 struct menu {
        enum fdisk_labeltype    label;          /* only for this label */
-       enum fdisk_labeltype    exclude;        /* all labels except this */
+       int                     exclude;    /* all labels except these */
 
        unsigned int            nonested : 1;   /* don't make this menu active in nested PT */
 
index a71f2f503101d329c9e80983ad66b5ef314298a9..9f9e2ba81d538486ec297f9dc966e4acaedf30f4 100644 (file)
@@ -345,7 +345,7 @@ static int userspace_event_verify(struct libmnt_monitor *mn,
                }
        } while (1);
 
-       DBG(MONITOR, ul_debugobj(mn, status == 1 ? " success" : " nothing"));
+       DBG(MONITOR, ul_debugobj(mn, "%s", status == 1 ? " success" : " nothing"));
        return status;
 }
 
index 0570044364af61631c0c5750138f668932ababe9..a7a1b6b1ef6a5e05fb61f83c2832db0e5d1585af 100644 (file)
@@ -1808,7 +1808,7 @@ static int test_is_mounted(struct libmnt_test *ts, int argc, char *argv[])
        struct libmnt_fs *fs;
        struct libmnt_iter *itr = NULL;
        struct libmnt_cache *mpc = NULL;
-       int rc, writable = 0;
+       int writable = 0;
        const char *path = NULL;
 
        if (mnt_has_regular_mtab(&path, &writable) == 1 && writable == 0)
@@ -1846,12 +1846,11 @@ static int test_is_mounted(struct libmnt_test *ts, int argc, char *argv[])
                                        mnt_fs_get_target(fs));
        }
 
-       rc = 0;
 done:
        mnt_unref_table(tb);
        mnt_unref_table(fstab);
        mnt_free_iter(itr);
-       return rc;
+       return 0;
 }
 
 /* returns 0 if @a and @b targets are the same */
index 510386ec8b27e7255bceae26b39b894631c1f7ba..d86b0684133aa2acd1cd970de07b3223b4968d84 100644 (file)
@@ -702,7 +702,8 @@ static int print_line(struct libscols_table *tb,
 
 static int print_title(struct libscols_table *tb)
 {
-       int rc, align;
+       int rc;
+       mbs_align_t align;
        size_t len = 0, width;
        char *title = NULL, *buf = NULL;
 
index bb4a8baac1623dac81b249b40c1da655f28fb36b..066fee00529894220b5c7a1d83ccf2483cd5f7ce 100644 (file)
@@ -343,7 +343,7 @@ int main(int argc, char *argv[])
        if (access(orig_file, F_OK) == 0) {
                char response[80];
 
-               printf((program == VIGR)
+               printf("%s", (program == VIGR)
                       ? _("You are using shadow groups on this system.\n")
                       : _("You are using shadow passwords on this system.\n"));
                /* TRANSLATORS: this program uses for y and n rpmatch(3),