diff options
author | 2015-10-06 13:31:55 -0700 | |
---|---|---|
committer | 2015-10-06 13:31:55 -0700 | |
commit | 1485683fcd725169a9b8d9cd3f1dbf1706da6045 (patch) | |
tree | 6a8712d2ee5e0ba0247bbd8039c28eb930a03ffd /src/core/surface/call.c | |
parent | fbfd3d42d2f4fcbc627b713f5ba7f0540bc0a8d0 (diff) | |
parent | 35284f0c8442ae31dc9057583d2064c5257fae4f (diff) |
Merge pull request #3615 from dgquintas/gcc_520
Type conversion fixes to make GCC 5.2.0 happy
Diffstat (limited to 'src/core/surface/call.c')
-rw-r--r-- | src/core/surface/call.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c index d15a3bcbad..6b0395ab00 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -425,7 +425,12 @@ static grpc_cq_completion *allocate_completion(grpc_call *call) { if (call->allocated_completions & (1u << i)) { continue; } - call->allocated_completions |= (gpr_uint8)(1u << i); + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard). A cast to the smaller container type + * is then required to avoid the compiler warning */ + call->allocated_completions = + (gpr_uint8)(call->allocated_completions | (1u << i)); gpr_mu_unlock(&call->completion_mu); return &call->completions[i]; } @@ -736,7 +741,11 @@ static void finish_live_ioreq_op(grpc_call *call, grpc_ioreq_op op, size_t i; /* ioreq is live: we need to do something */ master = &call->masters[master_set]; - master->complete_mask |= (gpr_uint16)(1u << op); + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard). A cast to the smaller container type + * is then required to avoid the compiler warning */ + master->complete_mask = (gpr_uint16)(master->complete_mask | (1u << op)); if (!success) { master->success = 0; } @@ -1246,7 +1255,11 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs, GRPC_MDSTR_REF(reqs[i].data.send_status.details)); } } - have_ops |= (gpr_uint16)(1u << op); + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard). A cast to the smaller container type + * is then required to avoid the compiler warning */ + have_ops = (gpr_uint16)(have_ops | (1u << op)); call->request_data[op] = data; call->request_flags[op] = reqs[i].flags; |