miscellaneous: silence a whole bunch of clang warnings

[ but most definitely not all of them by a long shot ]

Reference(s):
proc/diskstat.c:186:17: warning: unused variable 'is_disk' [-Wunused-variable]
    int retval, is_disk;
                ^
proc/namespace.c:110:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
proc/readproc.c:1131:50: warning: address of array 'ent->d_name' will always evaluate to 'true' [-Wpointer-bo
    if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
                                           ~~~~~~^~~~~~
proc/readproc.c:1158:50: warning: address of array 'ent->d_name' will always evaluate to 'true' [-Wpointer-bo
    if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
                                           ~~~~~~^~~~~~
proc/sysinfo.c:45:12: warning: unused variable 'stat_fd' [-Wunused-variable]
static int stat_fd = -1;
           ^
proc/sysinfo.c:49:12: warning: unused variable 'meminfo_fd' [-Wunused-variable]
static int meminfo_fd = -1;
           ^
proc/sysinfo.c:51:12: warning: unused variable 'vminfo_fd' [-Wunused-variable]
static int vminfo_fd = -1;
           ^
proc/sysinfo.c:53:12: warning: unused variable 'vm_min_free_fd' [-Wunused-variable]
static int vm_min_free_fd = -1;
           ^
proc/uptime.c:157:12: warning: unused variable 'realseconds' [-Wunused-variable]
    time_t realseconds;
           ^
proc/uptime.c:158:16: warning: unused variable 'realtime' [-Wunused-variable]
    struct tm *realtime;
               ^
vmstat.c:574:20: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
                   DSTAT(PROCPS_DISKSTAT_READ_TIME),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vmstat.c:578:20: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
                   DSTAT(PROCPS_DISKSTAT_WRITE_TIME),
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
watch.c:230:7: warning: variable 'endptr' is uninitialized when used here [-Wuninitialized]
        if (*endptr == '\0') set_ansi_attribute(0); /* [m treated as [0m */
             ^~~~~~

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2015-09-07 00:00:00 -05:00
committed by Craig Small
parent a6b50e59ef
commit 88daa89883
7 changed files with 6 additions and 15 deletions

View File

@ -1128,7 +1128,7 @@ static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p)
char *restrict const path = PT->path;
for (;;) {
ent = readdir(PT->procfs);
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name[0]))) return 0;
if(likely(likely(*ent->d_name > '0') && likely(*ent->d_name <= '9'))) break;
}
p->tgid = strtoul(ent->d_name, NULL, 10);
@ -1155,7 +1155,7 @@ static int simple_nexttid(PROCTAB *restrict const PT, const proc_t *restrict con
}
for (;;) {
ent = readdir(PT->taskdir);
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name[0]))) return 0;
if(likely(likely(*ent->d_name > '0') && likely(*ent->d_name <= '9'))) break;
}
t->tid = strtoul(ent->d_name, NULL, 10);