From 0d18a8ad8faeb70ab8481a310319c4fdae1edd63 Mon Sep 17 00:00:00 2001 From: Tim Wickberg <tim@schedmd.com> Date: Wed, 9 Dec 2015 23:34:22 -0800 Subject: [PATCH] Various CLANG fixes. The error messages associated with these are: /home/tim/slurm/src/common/callerid.c:337:21: warning: address of array 'entryp->d_name' will always evaluate to 'true' [-Wpointer-bool-conversion] else if (!entryp->d_name) ~~~~~~~~~^~~~~~ 1 warning generated. /home/tim/slurm/src/common/gres.c:831:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] if ((tmp_uint64 < 0) || (tmp_uint64 >= NO_VAL)) { ~~~~~~~~~~ ^ ~ 1 warning generated. /home/tim/slurm/src/slurmctld/node_mgr.c:1684:26: warning: if statement has empty body [-Wempty-body] if (first_new == NULL); ^ /home/tim/slurm/src/slurmctld/node_mgr.c:1684:26: note: put the semicolon on a separate line to silence this warning /home/tim/slurm/src/slurmctld/node_mgr.c:1756:26: warning: if statement has empty body [-Wempty-body] if (first_new == NULL); ^ /home/tim/slurm/src/slurmctld/node_mgr.c:1756:26: note: put the semicolon on a separate line to silence this warning /home/tim/slurm/src/slurmctld/node_mgr.c:1830:26: warning: if statement has empty body [-Wempty-body] if (first_new == NULL); ^ /home/tim/slurm/src/slurmctld/node_mgr.c:1830:26: note: put the semicolon on a separate line to silence this warning /home/tim/slurm/src/plugins/switch/generic/switch_generic.c:837:27: warning: address of array 'if_rec->ifa_addr->sa_data' will always evaluate to 'true' [-Wpointer-bool-conversion] if (!if_rec->ifa_addr->sa_data) ~~~~~~~~~~~~~~~~~~~^~~~~~~ --- src/common/callerid.c | 4 ---- src/common/gres.c | 2 +- src/plugins/switch/generic/switch_generic.c | 2 -- src/slurmctld/node_mgr.c | 6 +++--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/common/callerid.c b/src/common/callerid.c index 770db50797c..d9e13aa4cb7 100644 --- a/src/common/callerid.c +++ b/src/common/callerid.c @@ -332,10 +332,6 @@ extern int find_pid_by_inode (pid_t *pid_result, ino_t inode) readdir_r(dirp, entryp, &result); if (!result) break; - /* This check is probably unnecessary due to the !result check - * but better safe than sorry */ - else if (!entryp->d_name) - continue; /* We're only looking for /proc/[0-9]* */ else if (!isdigit(entryp->d_name[0])) continue; diff --git a/src/common/gres.c b/src/common/gres.c index 0f5d9158911..590090aca5d 100644 --- a/src/common/gres.c +++ b/src/common/gres.c @@ -828,7 +828,7 @@ static int _parse_gres_config(void **dest, slurm_parser_enum_t type, fatal("Invalid gres data for %s, Count does not match " "File value", p->name); } - if ((tmp_uint64 < 0) || (tmp_uint64 >= NO_VAL)) { + if (tmp_uint64 >= NO_VAL64) { fatal("Gres %s has invalid count value %"PRIu64, p->name, tmp_uint64); } diff --git a/src/plugins/switch/generic/switch_generic.c b/src/plugins/switch/generic/switch_generic.c index c7b472c3be1..26211607a49 100644 --- a/src/plugins/switch/generic/switch_generic.c +++ b/src/plugins/switch/generic/switch_generic.c @@ -834,8 +834,6 @@ extern int switch_p_build_node_info(switch_node_info_t *switch_node) gen_node_info->node_name = xstrdup(hostname); if (getifaddrs(&if_array) == 0) { for (if_rec = if_array; if_rec; if_rec = if_rec->ifa_next) { - if (!if_rec->ifa_addr->sa_data) - continue; #if !defined(__FreeBSD__) if (if_rec->ifa_flags & IFF_LOOPBACK) continue; diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c index e2dc5df35b4..63f6ec8a50a 100644 --- a/src/slurmctld/node_mgr.c +++ b/src/slurmctld/node_mgr.c @@ -1647,7 +1647,7 @@ static int _update_node_weight(char *node_names, uint32_t weight) } else { /* partial update, split config_record */ new_config_ptr = _dup_config(config_ptr); - if (first_new == NULL); + if (first_new == NULL) first_new = new_config_ptr; /* Change weight for the given node */ new_config_ptr->weight = weight; @@ -1719,7 +1719,7 @@ static int _update_node_features(char *node_names, char *features) } else { /* partial update, split config_record */ new_config_ptr = _dup_config(config_ptr); - if (first_new == NULL); + if (first_new == NULL) first_new = new_config_ptr; xfree(new_config_ptr->feature); if (features && features[0]) @@ -1793,7 +1793,7 @@ static int _update_node_gres(char *node_names, char *gres) } else { /* partial update, split config_record */ new_config_ptr = _dup_config(config_ptr); - if (first_new == NULL); + if (first_new == NULL) first_new = new_config_ptr; xfree(new_config_ptr->gres); if (gres && gres[0]) -- GitLab