diff options
| author | Niels de Vos <ndevos@redhat.com> | 2017-07-20 02:20:29 +0530 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2017-07-22 10:38:06 +0000 | 
| commit | 6b89b8cee79aa54ded4c34d3209c54ed674b1364 (patch) | |
| tree | b729dcbe3725ac725baf95195f04333e2f5bc0e8 /libglusterfs/src | |
| parent | 4a85a221c92f422dedde62832e6cd6e66cae2722 (diff) | |
crypt: fix evaluation of args to macro
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 <rtalur@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://review.gluster.org/17827
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src')
| -rw-r--r-- | libglusterfs/src/stack.h | 14 | 
1 files changed, 7 insertions, 7 deletions
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;                 \                          }                                               \  | 
