From 6b89b8cee79aa54ded4c34d3209c54ed674b1364 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 20 Jul 2017 02:20:29 +0530 Subject: crypt: fix evaluation of args to macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 7 warns about the following crypt.c:3685:31: warning: ?: using integer constants in boolean context, the expression will always evaluate to ‘true’ [-Wint-in-bool-context] local->op_ret < 0 ? -1 : 0, ../../../../libglusterfs/src/stack.h:342:36: note: in definition of macro ‘STACK_UNWIND_STRICT’ } else if (op_ret == 0) { \ ^~~~~~ } This is because args to pre-processor are lazily evaluated and operator precedence for == is higher than ?: Change-Id: I2c2ffb08bc3731ad0e17796047e01cb10771dbcf Updates: #259 Reported-by: Raghavendra Talur Signed-off-by: Niels de Vos Reviewed-on: https://review.gluster.org/17827 Reviewed-by: Prashanth Pai Smoke: Gluster Build System Reviewed-by: Raghavendra Talur CentOS-regression: Gluster Build System Reviewed-by: Amar Tumballi --- libglusterfs/src/stack.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index eb5848e92aa..249b6d2c54f 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -316,30 +316,30 @@ STACK_RESET (call_stack_t *stack) LG_MSG_FRAME_ERROR, "!frame"); \ break; \ } \ - if (op_ret < 0) { \ + if ((op_ret) < 0) { \ gf_msg_debug ("stack-trace", op_errno, \ "stack-address: %p, " \ "%s returned %d error: %s", \ frame->root, THIS->name, \ - (int32_t)op_ret, \ + (int32_t)(op_ret), \ strerror(op_errno)); \ } else { \ gf_msg_trace ("stack-trace", 0, \ "stack-address: %p, " \ "%s returned %d", \ frame->root, THIS->name, \ - (int32_t)op_ret); \ + (int32_t)(op_ret)); \ } \ fn = (fop_##op##_cbk_t )frame->ret; \ _parent = frame->parent; \ LOCK(&frame->root->stack_lock); \ { \ _parent->ref_count--; \ - if (op_ret < 0 && \ - op_errno != frame->root->error) { \ + if ((op_ret) < 0 && \ + (op_errno) != frame->root->error) { \ frame->root->err_xl = frame->this; \ - frame->root->error = op_errno; \ - } else if (op_ret == 0) { \ + frame->root->error = (op_errno); \ + } else if ((op_ret) == 0) { \ frame->root->err_xl = NULL; \ frame->root->error = 0; \ } \ -- cgit