From 6ecf685b1d392c28b450037fe7b090fc15467bcc Mon Sep 17 00:00:00 2001
From: Felip Moll <felip.moll@schedmd.com>
Date: Tue, 3 Oct 2017 13:11:03 +0200
Subject: [PATCH] gcc 7.2.1 warning error parentheses

GCC now suggest parentheses around assignment used as truth value.
Changed affected assignments.
---
 src/common/eio.c                    |  4 ++--
 src/common/hostlist.c               |  8 ++++----
 src/common/list.c                   | 10 +++++-----
 src/common/slurm_cred.c             |  8 ++++----
 src/plugins/auth/munge/auth_munge.c |  4 ++--
 src/slurmctld/reservation.c         |  4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/common/eio.c b/src/common/eio.c
index ef3061e3e9b..79393041f66 100644
--- a/src/common/eio.c
+++ b/src/common/eio.c
@@ -115,7 +115,7 @@ eio_handle_t *eio_handle_create(uint16_t shutdown_wait)
 	fd_set_close_on_exec(eio->fds[0]);
 	fd_set_close_on_exec(eio->fds[1]);
 
-	xassert(eio->magic = EIO_MAGIC);
+	xassert((eio->magic = EIO_MAGIC));
 
 	eio->obj_list = list_create(eio_obj_destroy);
 	eio->new_objs = list_create(eio_obj_destroy);
@@ -138,7 +138,7 @@ void eio_handle_destroy(eio_handle_t *eio)
 	FREE_NULL_LIST(eio->new_objs);
 	slurm_mutex_destroy(&eio->shutdown_mutex);
 
-	xassert(eio->magic = ~EIO_MAGIC);
+	xassert((eio->magic = ~EIO_MAGIC));
 	xfree(eio);
 }
 
diff --git a/src/common/hostlist.c b/src/common/hostlist.c
index dbe2a291609..0d640e5522d 100644
--- a/src/common/hostlist.c
+++ b/src/common/hostlist.c
@@ -1261,7 +1261,7 @@ static hostlist_t hostlist_new(void)
 	if (!new)
 		goto fail1;
 
-	assert(new->magic = HOSTLIST_MAGIC);
+	assert((new->magic = HOSTLIST_MAGIC));
 	slurm_mutex_init(&new->mutex);
 
 	new->hr = (hostrange_t *) malloc(HOSTLIST_CHUNK * sizeof(hostrange_t));
@@ -1984,7 +1984,7 @@ void hostlist_destroy(hostlist_t hl)
 	for (i = 0; i < hl->nranges; i++)
 		hostrange_destroy(hl->hr[i]);
 	free(hl->hr);
-	assert(hl->magic = 0x1);
+	assert((hl->magic = 0x1));
 	UNLOCK_HOSTLIST(hl);
 	slurm_mutex_destroy(&hl->mutex);
 	free(hl);
@@ -3311,7 +3311,7 @@ static hostlist_iterator_t hostlist_iterator_new(void)
 	i->idx = 0;
 	i->depth = -1;
 	i->next = i;
-	assert(i->magic = HOSTLIST_MAGIC);
+	assert((i->magic = HOSTLIST_MAGIC));
 	return i;
 }
 
@@ -3362,7 +3362,7 @@ void hostlist_iterator_destroy(hostlist_iterator_t i)
 		}
 	}
 	UNLOCK_HOSTLIST(i->hl);
-	assert(i->magic = 0x1);
+	assert((i->magic = 0x1));
 	free(i);
 }
 
diff --git a/src/common/list.c b/src/common/list.c
index 209a01acd84..abe7e21f214 100644
--- a/src/common/list.c
+++ b/src/common/list.c
@@ -191,7 +191,7 @@ list_create (ListDelF f)
 	l->fDel = f;
 	l->count = 0;
 	slurm_mutex_init(&l->mutex);
-	assert(l->magic = LIST_MAGIC);      /* set magic via assert abuse */
+	assert((l->magic = LIST_MAGIC));      /* set magic via assert abuse */
 
 	return l;
 }
@@ -212,7 +212,7 @@ list_destroy (List l)
 	while (i) {
 		assert(i->magic == LIST_MAGIC);
 		iTmp = i->iNext;
-		assert(i->magic = ~LIST_MAGIC); /* clear magic via assert abuse */
+		assert((i->magic = ~LIST_MAGIC)); /* clear magic via assert abuse */
 		list_iterator_free(i);
 		i = iTmp;
 	}
@@ -224,7 +224,7 @@ list_destroy (List l)
 		list_node_free(p);
 		p = pTmp;
 	}
-	assert(l->magic = ~LIST_MAGIC);     /* clear magic via assert abuse */
+	assert((l->magic = ~LIST_MAGIC));     /* clear magic via assert abuse */
 	slurm_mutex_unlock(&l->mutex);
 	slurm_mutex_destroy(&l->mutex);
 	list_free(l);
@@ -611,7 +611,7 @@ list_iterator_create (List l)
 	i->prev = &l->head;
 	i->iNext = l->iNext;
 	l->iNext = i;
-	assert(i->magic = LIST_MAGIC);      /* set magic via assert abuse */
+	assert((i->magic = LIST_MAGIC));      /* set magic via assert abuse */
 
 	slurm_mutex_unlock(&l->mutex);
 
@@ -655,7 +655,7 @@ list_iterator_destroy (ListIterator i)
 	}
 	slurm_mutex_unlock(&i->list->mutex);
 
-	assert(i->magic = ~LIST_MAGIC);     /* clear magic via assert abuse */
+	assert((i->magic = ~LIST_MAGIC));     /* clear magic via assert abuse */
 	list_iterator_free(i);
 }
 
diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c
index 0a0d7c10ec8..b3c075ed996 100644
--- a/src/common/slurm_cred.c
+++ b/src/common/slurm_cred.c
@@ -441,7 +441,7 @@ slurm_cred_ctx_destroy(slurm_cred_ctx_t ctx)
 	FREE_NULL_LIST(ctx->job_list);
 	FREE_NULL_LIST(ctx->state_list);
 
-	xassert(ctx->magic = ~CRED_CTX_MAGIC);
+	xassert((ctx->magic = ~CRED_CTX_MAGIC));
 
 	slurm_mutex_unlock(&ctx->mutex);
 	slurm_mutex_destroy(&ctx->mutex);
@@ -918,7 +918,7 @@ slurm_cred_destroy(slurm_cred_t *cred)
 	FREE_NULL_LIST(cred->step_gres_list);
 	xfree(cred->step_hostlist);
 	xfree(cred->signature);
-	xassert(cred->magic = ~CRED_MAGIC);
+	xassert((cred->magic = ~CRED_MAGIC));
 
 	slurm_mutex_unlock(&cred->mutex);
 	slurm_mutex_destroy(&cred->mutex);
@@ -1629,7 +1629,7 @@ _slurm_cred_ctx_alloc(void)
 	ctx->expiry_window = cred_expire;
 	ctx->exkey_exp     = (time_t) -1;
 
-	xassert(ctx->magic = CRED_CTX_MAGIC);
+	xassert((ctx->magic = CRED_CTX_MAGIC));
 
 	slurm_mutex_unlock(&ctx->mutex);
 	return ctx;
@@ -1644,7 +1644,7 @@ _slurm_cred_alloc(void)
 	slurm_mutex_init(&cred->mutex);
 	cred->uid = (uid_t) -1;
 
-	xassert(cred->magic = CRED_MAGIC);
+	xassert((cred->magic = CRED_MAGIC));
 
 	return cred;
 }
diff --git a/src/plugins/auth/munge/auth_munge.c b/src/plugins/auth/munge/auth_munge.c
index 1bed010e680..3f98a3343a2 100644
--- a/src/plugins/auth/munge/auth_munge.c
+++ b/src/plugins/auth/munge/auth_munge.c
@@ -202,7 +202,7 @@ slurm_auth_credential_t *slurm_auth_create(char *opts)
 	cred->len      = 0;
 	cred->cr_errno = SLURM_SUCCESS;
 
-	xassert(cred->magic = MUNGE_MAGIC);
+	xassert((cred->magic = MUNGE_MAGIC));
 
 	/*
 	 *  Temporarily block SIGALARM to avoid misleading
@@ -422,7 +422,7 @@ slurm_auth_unpack( Buf buf )
 	cred->len      = 0;
 	cred->cr_errno = SLURM_SUCCESS;
 
-	xassert(cred->magic = MUNGE_MAGIC);
+	xassert((cred->magic = MUNGE_MAGIC));
 
 	safe_unpackstr_malloc(&cred->m_str, &size, buf);
 	return cred;
diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c
index 8ecf8463761..1ee28cb049a 100644
--- a/src/slurmctld/reservation.c
+++ b/src/slurmctld/reservation.c
@@ -1633,7 +1633,7 @@ slurmctld_resv_t *_load_reservation_state(Buf buffer,
 	char *core_inx_str = NULL;
 
 	resv_ptr = xmalloc(sizeof(slurmctld_resv_t));
-	xassert(resv_ptr->magic = RESV_MAGIC);	/* Sets value */
+	xassert((resv_ptr->magic = RESV_MAGIC));	/* Sets value */
 	if (protocol_version >= SLURM_16_05_PROTOCOL_VERSION) {
 		safe_unpackstr_xmalloc(&resv_ptr->accounts,
 				       &uint32_tmp,	buffer);
@@ -2411,7 +2411,7 @@ extern int create_resv(resv_desc_msg_t *resv_desc_ptr)
 	resv_ptr->license_list	= license_list;
 	license_list = NULL;
 	resv_ptr->resv_id       = top_suffix;
-	xassert(resv_ptr->magic = RESV_MAGIC);	/* Sets value */
+	xassert((resv_ptr->magic = RESV_MAGIC));	/* Sets value */
 	resv_ptr->name		= xstrdup(resv_desc_ptr->name);
 	resv_ptr->node_cnt	= total_node_cnt;
 	resv_ptr->node_list	= resv_desc_ptr->node_list;
-- 
GitLab