Merge pull request #3615 from dgquintas/gcc_520

Type conversion fixes to make GCC 5.2.0 happy
pull/3685/head
Vijay Pai 9 years ago
commit 1485683fcd
  1. 19
      src/core/surface/call.c
  2. 16
      src/core/transport/chttp2/bin_encoder.c
  3. 8
      src/core/tsi/fake_transport_security.c
  4. 13
      tools/codegen/core/gen_hpack_tables.c
  5. 7
      tools/codegen/core/gen_legal_metadata_characters.c

@ -425,7 +425,12 @@ static grpc_cq_completion *allocate_completion(grpc_call *call) {
if (call->allocated_completions & (1u << i)) { if (call->allocated_completions & (1u << i)) {
continue; 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); gpr_mu_unlock(&call->completion_mu);
return &call->completions[i]; return &call->completions[i];
} }
@ -736,7 +741,11 @@ static void finish_live_ioreq_op(grpc_call *call, grpc_ioreq_op op,
size_t i; size_t i;
/* ioreq is live: we need to do something */ /* ioreq is live: we need to do something */
master = &call->masters[master_set]; 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) { if (!success) {
master->success = 0; 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)); 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_data[op] = data;
call->request_flags[op] = reqs[i].flags; call->request_flags[op] = reqs[i].flags;

@ -185,8 +185,12 @@ gpr_slice grpc_chttp2_huffman_compress(gpr_slice input) {
} }
if (temp_length) { if (temp_length) {
*out++ = (gpr_uint8)(temp << (8u - temp_length)) | /* NB: the following integer arithmetic operation needs to be in its
(gpr_uint8)(0xffu >> temp_length); * 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 */
*out++ = (gpr_uint8)((gpr_uint8)(temp << (8u - temp_length)) |
(gpr_uint8)(0xffu >> temp_length));
} }
GPR_ASSERT(out == GPR_SLICE_END_PTR(output)); GPR_ASSERT(out == GPR_SLICE_END_PTR(output));
@ -265,8 +269,12 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input) {
} }
if (out.temp_length) { if (out.temp_length) {
*out.out++ = (gpr_uint8)(out.temp << (8u - out.temp_length)) | /* NB: the following integer arithmetic operation needs to be in its
(gpr_uint8)(0xffu >> out.temp_length); * 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 */
*out.out++ = (gpr_uint8)((gpr_uint8)(out.temp << (8u - out.temp_length)) |
(gpr_uint8)(0xffu >> out.temp_length));
} }
GPR_ASSERT(out.out <= GPR_SLICE_END_PTR(output)); GPR_ASSERT(out.out <= GPR_SLICE_END_PTR(output));

@ -118,10 +118,10 @@ static gpr_uint32 load32_little_endian(const unsigned char *buf) {
} }
static void store32_little_endian(gpr_uint32 value, unsigned char *buf) { static void store32_little_endian(gpr_uint32 value, unsigned char *buf) {
buf[3] = (unsigned char)(value >> 24) & 0xFF; buf[3] = (unsigned char)((value >> 24) & 0xFF);
buf[2] = (unsigned char)(value >> 16) & 0xFF; buf[2] = (unsigned char)((value >> 16) & 0xFF);
buf[1] = (unsigned char)(value >> 8) & 0xFF; buf[1] = (unsigned char)((value >> 8) & 0xFF);
buf[0] = (unsigned char)(value)&0xFF; buf[0] = (unsigned char)((value) & 0xFF);
} }
static void tsi_fake_frame_reset(tsi_fake_frame *frame, int needs_draining) { static void tsi_fake_frame_reset(tsi_fake_frame *frame, int needs_draining) {

@ -71,7 +71,11 @@ static unsigned char prefix_mask(unsigned char prefix_len) {
unsigned char i; unsigned char i;
unsigned char out = 0; unsigned char out = 0;
for (i = 0; i < prefix_len; i++) { for (i = 0; i < prefix_len; i++) {
out |= (unsigned char)(1 << (7 - 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 */
out = (unsigned char)(out | (unsigned char)(1 << (7 - i)));
} }
return out; return out;
} }
@ -92,7 +96,12 @@ static void generate_first_byte_lut(void) {
chrspec = NULL; chrspec = NULL;
for (j = 0; j < num_fields; j++) { for (j = 0; j < num_fields; j++) {
if ((prefix_mask(fields[j].prefix_length) & i) == fields[j].prefix) { if ((prefix_mask(fields[j].prefix_length) & i) == fields[j].prefix) {
suffix = suffix_mask(fields[j].prefix_length) & (unsigned char)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 */
suffix = (unsigned char)(suffix_mask(fields[j].prefix_length) &
(unsigned char)i);
if (suffix == suffix_mask(fields[j].prefix_length)) { if (suffix == suffix_mask(fields[j].prefix_length)) {
if (fields[j].index != 2) continue; if (fields[j].index != 2) continue;
} else if (suffix == 0) { } else if (suffix == 0) {

@ -41,7 +41,12 @@ static unsigned char legal_bits[256 / 8];
static void legal(int x) { static void legal(int x) {
int byte = x / 8; int byte = x / 8;
int bit = x % 8; int bit = x % 8;
legal_bits[byte] |= (unsigned char)(1 << bit); /* 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 */
legal_bits[byte] =
(unsigned char)((legal_bits[byte] | (unsigned char)(1 << bit)));
} }
static void dump(void) { static void dump(void) {

Loading…
Cancel
Save