From b9d3596cb1cf9406ea6b1c67eda04a497857f6b4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 11 Sep 2015 13:31:16 -0700 Subject: [PATCH 1/3] Enable -Wshadow --- Makefile | 2 +- src/core/channel/client_channel.c | 14 +++--- src/core/channel/http_client_filter.c | 16 +++---- src/core/channel/http_server_filter.c | 6 +-- src/core/iomgr/resolve_address_posix.c | 4 +- src/core/security/credentials.c | 10 ++-- src/core/support/cmdline.c | 60 ++++++++++++------------ src/core/surface/call.c | 22 ++++----- src/core/surface/secure_channel_create.c | 12 ++--- src/core/surface/server.c | 52 ++++++++++---------- templates/Makefile.template | 2 +- 11 files changed, 100 insertions(+), 100 deletions(-) diff --git a/Makefile b/Makefile index 87a014586eb..d9382bab59c 100644 --- a/Makefile +++ b/Makefile @@ -245,7 +245,7 @@ ifdef EXTRA_DEFINES DEFINES += $(EXTRA_DEFINES) endif -CFLAGS += -std=c89 -pedantic -Wsign-conversion -Wconversion +CFLAGS += -std=c89 -pedantic -Wsign-conversion -Wconversion -Wshadow ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 else diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index 2e250338138..7f6b71e5ebc 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -380,18 +380,18 @@ static void perform_transport_stream_op(grpc_call_element *elem, gpr_mu_lock(&chand->mu_config); lb_policy = chand->lb_policy; if (lb_policy) { - grpc_transport_stream_op *op = &calld->waiting_op; - grpc_pollset *bind_pollset = op->bind_pollset; + grpc_transport_stream_op *waiting_op = &calld->waiting_op; + grpc_pollset *bind_pollset = waiting_op->bind_pollset; grpc_metadata_batch *initial_metadata = - &op->send_ops->ops[0].data.metadata; + &waiting_op->send_ops->ops[0].data.metadata; GRPC_LB_POLICY_REF(lb_policy, "pick"); gpr_mu_unlock(&chand->mu_config); calld->state = CALL_WAITING_FOR_PICK; - GPR_ASSERT(op->bind_pollset); - GPR_ASSERT(op->send_ops); - GPR_ASSERT(op->send_ops->nops >= 1); - GPR_ASSERT(op->send_ops->ops[0].type == GRPC_OP_METADATA); + GPR_ASSERT(waiting_op->bind_pollset); + GPR_ASSERT(waiting_op->send_ops); + GPR_ASSERT(waiting_op->send_ops->nops >= 1); + GPR_ASSERT(waiting_op->send_ops->ops[0].type == GRPC_OP_METADATA); gpr_mu_unlock(&calld->mu_state); grpc_iomgr_closure_init(&calld->async_setup_task, picked_target, diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index ec832a03672..136292bfceb 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -119,21 +119,21 @@ static void hc_mutate_op(grpc_call_element *elem, size_t nops = op->send_ops->nops; grpc_stream_op *ops = op->send_ops->ops; for (i = 0; i < nops; i++) { - grpc_stream_op *op = &ops[i]; - if (op->type != GRPC_OP_METADATA) continue; + grpc_stream_op *stream_op = &ops[i]; + if (stream_op->type != GRPC_OP_METADATA) continue; calld->sent_initial_metadata = 1; - grpc_metadata_batch_filter(&op->data.metadata, client_strip_filter, elem); + grpc_metadata_batch_filter(&stream_op->data.metadata, client_strip_filter, elem); /* Send : prefixed headers, which have to be before any application layer headers. */ - grpc_metadata_batch_add_head(&op->data.metadata, &calld->method, + grpc_metadata_batch_add_head(&stream_op->data.metadata, &calld->method, GRPC_MDELEM_REF(channeld->method)); - grpc_metadata_batch_add_head(&op->data.metadata, &calld->scheme, + grpc_metadata_batch_add_head(&stream_op->data.metadata, &calld->scheme, GRPC_MDELEM_REF(channeld->scheme)); - grpc_metadata_batch_add_tail(&op->data.metadata, &calld->te_trailers, + grpc_metadata_batch_add_tail(&stream_op->data.metadata, &calld->te_trailers, GRPC_MDELEM_REF(channeld->te_trailers)); - grpc_metadata_batch_add_tail(&op->data.metadata, &calld->content_type, + grpc_metadata_batch_add_tail(&stream_op->data.metadata, &calld->content_type, GRPC_MDELEM_REF(channeld->content_type)); - grpc_metadata_batch_add_tail(&op->data.metadata, &calld->user_agent, + grpc_metadata_batch_add_tail(&stream_op->data.metadata, &calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent)); break; } diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 0955ae319aa..0ed9fa9e364 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -197,10 +197,10 @@ static void hs_mutate_op(grpc_call_element *elem, size_t nops = op->send_ops->nops; grpc_stream_op *ops = op->send_ops->ops; for (i = 0; i < nops; i++) { - grpc_stream_op *op = &ops[i]; - if (op->type != GRPC_OP_METADATA) continue; + grpc_stream_op *stream_op = &ops[i]; + if (stream_op->type != GRPC_OP_METADATA) continue; calld->sent_status = 1; - grpc_metadata_batch_add_head(&op->data.metadata, &calld->status, + grpc_metadata_batch_add_head(&stream_op->data.metadata, &calld->status, GRPC_MDELEM_REF(channeld->status_ok)); break; } diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c index ce6972b797c..91754ebaaaf 100644 --- a/src/core/iomgr/resolve_address_posix.c +++ b/src/core/iomgr/resolve_address_posix.c @@ -50,6 +50,7 @@ #include #include #include +#include typedef struct { char *name; @@ -106,8 +107,7 @@ grpc_resolved_addresses *grpc_blocking_resolve_address( if (s != 0) { /* Retry if well-known service name is recognized */ char *svc[][2] = {{"http", "80"}, {"https", "443"}}; - int i; - for (i = 0; i < (int)(sizeof(svc) / sizeof(svc[0])); i++) { + for (i = 0; i < GPR_ARRAY_SIZE(svc); i++) { if (strcmp(port, svc[i][0]) == 0) { s = getaddrinfo(host, svc[i][1], &hints, &result); break; diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index a764413300f..87669b9e681 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -223,7 +223,7 @@ static grpc_security_status ssl_create_security_connector( grpc_security_status status = GRPC_SECURITY_OK; size_t i = 0; const char *overridden_target_name = NULL; - grpc_arg arg; + grpc_arg new_arg; for (i = 0; args && i < args->num_args; i++) { grpc_arg *arg = &args->args[i]; @@ -238,10 +238,10 @@ static grpc_security_status ssl_create_security_connector( if (status != GRPC_SECURITY_OK) { return status; } - arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_HTTP2_SCHEME; - arg.value.string = "https"; - *new_args = grpc_channel_args_copy_and_add(args, &arg, 1); + new_arg.type = GRPC_ARG_STRING; + new_arg.key = GRPC_ARG_HTTP2_SCHEME; + new_arg.value.string = "https"; + *new_args = grpc_channel_args_copy_and_add(args, &new_arg, 1); return status; } diff --git a/src/core/support/cmdline.c b/src/core/support/cmdline.c index 45a3182f73a..87f60bca2ee 100644 --- a/src/core/support/cmdline.c +++ b/src/core/support/cmdline.c @@ -192,9 +192,9 @@ static void print_usage_and_die(gpr_cmdline *cl) { exit(1); } -static void extra_state(gpr_cmdline *cl, char *arg) { +static void extra_state(gpr_cmdline *cl, char *str) { if (!cl->extra_arg) print_usage_and_die(cl); - cl->extra_arg(cl->extra_arg_user_data, arg); + cl->extra_arg(cl->extra_arg_user_data, str); } static arg *find_arg(gpr_cmdline *cl, char *name) { @@ -214,7 +214,7 @@ static arg *find_arg(gpr_cmdline *cl, char *name) { return a; } -static void value_state(gpr_cmdline *cl, char *arg) { +static void value_state(gpr_cmdline *cl, char *str) { long intval; char *end; @@ -222,80 +222,80 @@ static void value_state(gpr_cmdline *cl, char *arg) { switch (cl->cur_arg->type) { case ARGTYPE_INT: - intval = strtol(arg, &end, 0); + intval = strtol(str, &end, 0); if (*end || intval < INT_MIN || intval > INT_MAX) { - fprintf(stderr, "expected integer, got '%s' for %s\n", arg, + fprintf(stderr, "expected integer, got '%s' for %s\n", str, cl->cur_arg->name); print_usage_and_die(cl); } *(int *)cl->cur_arg->value = (int)intval; break; case ARGTYPE_BOOL: - if (0 == strcmp(arg, "1") || 0 == strcmp(arg, "true")) { + if (0 == strcmp(str, "1") || 0 == strcmp(str, "true")) { *(int *)cl->cur_arg->value = 1; - } else if (0 == strcmp(arg, "0") || 0 == strcmp(arg, "false")) { + } else if (0 == strcmp(str, "0") || 0 == strcmp(str, "false")) { *(int *)cl->cur_arg->value = 0; } else { - fprintf(stderr, "expected boolean, got '%s' for %s\n", arg, + fprintf(stderr, "expected boolean, got '%s' for %s\n", str, cl->cur_arg->name); print_usage_and_die(cl); } break; case ARGTYPE_STRING: - *(char **)cl->cur_arg->value = arg; + *(char **)cl->cur_arg->value = str; break; } cl->state = normal_state; } -static void normal_state(gpr_cmdline *cl, char *arg) { +static void normal_state(gpr_cmdline *cl, char *str) { char *eq = NULL; char *tmp = NULL; char *arg_name = NULL; - if (0 == strcmp(arg, "-help") || 0 == strcmp(arg, "--help") || - 0 == strcmp(arg, "-h")) { + if (0 == strcmp(str, "-help") || 0 == strcmp(str, "--help") || + 0 == strcmp(str, "-h")) { print_usage_and_die(cl); } cl->cur_arg = NULL; - if (arg[0] == '-') { - if (arg[1] == '-') { - if (arg[2] == 0) { + if (str[0] == '-') { + if (str[1] == '-') { + if (str[2] == 0) { /* handle '--' to move to just extra args */ cl->state = extra_state; return; } - arg += 2; + str += 2; } else { - arg += 1; + str += 1; } - /* first byte of arg is now past the leading '-' or '--' */ - if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-') { - /* arg is of the form '--no-foo' - it's a flag disable */ - arg += 3; - cl->cur_arg = find_arg(cl, arg); + /* first byte of str is now past the leading '-' or '--' */ + if (str[0] == 'n' && str[1] == 'o' && str[2] == '-') { + /* str is of the form '--no-foo' - it's a flag disable */ + str += 3; + cl->cur_arg = find_arg(cl, str); if (cl->cur_arg->type != ARGTYPE_BOOL) { - fprintf(stderr, "%s is not a flag argument\n", arg); + fprintf(stderr, "%s is not a flag argument\n", str); print_usage_and_die(cl); } *(int *)cl->cur_arg->value = 0; return; /* early out */ } - eq = strchr(arg, '='); + eq = strchr(str, '='); if (eq != NULL) { /* copy the string into a temp buffer and extract the name */ - tmp = arg_name = gpr_malloc((size_t)(eq - arg + 1)); - memcpy(arg_name, arg, (size_t)(eq - arg)); - arg_name[eq - arg] = 0; + tmp = arg_name = gpr_malloc((size_t)(eq - str + 1)); + memcpy(arg_name, str, (size_t)(eq - str)); + arg_name[eq - str] = 0; } else { - arg_name = arg; + arg_name = str; } cl->cur_arg = find_arg(cl, arg_name); if (eq != NULL) { - /* arg was of the type --foo=value, parse the value */ + /* str was of the type --foo=value, parse the value */ value_state(cl, eq + 1); } else if (cl->cur_arg->type != ARGTYPE_BOOL) { /* flag types don't have a '--foo value' variant, other types do */ @@ -305,7 +305,7 @@ static void normal_state(gpr_cmdline *cl, char *arg) { *(int *)cl->cur_arg->value = 1; } } else { - extra_state(cl, arg); + extra_state(cl, str); } gpr_free(tmp); diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 4168c2ef0cc..21911ab403f 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -1473,18 +1473,18 @@ static void recv_metadata(grpc_call *call, grpc_metadata_batch *md) { is_trailing = call->read_state >= READ_STATE_GOT_INITIAL_METADATA; for (l = md->list.head; l != NULL; l = l->next) { - grpc_mdelem *md = l->md; - grpc_mdstr *key = md->key; + grpc_mdelem *mdel = l->md; + grpc_mdstr *key = mdel->key; if (key == grpc_channel_get_status_string(call->channel)) { - set_status_code(call, STATUS_FROM_WIRE, decode_status(md)); + set_status_code(call, STATUS_FROM_WIRE, decode_status(mdel)); } else if (key == grpc_channel_get_message_string(call->channel)) { - set_status_details(call, STATUS_FROM_WIRE, GRPC_MDSTR_REF(md->value)); + set_status_details(call, STATUS_FROM_WIRE, GRPC_MDSTR_REF(mdel->value)); } else if (key == grpc_channel_get_compression_algorithm_string(call->channel)) { - set_compression_algorithm(call, decode_compression(md)); + set_compression_algorithm(call, decode_compression(mdel)); } else if (key == grpc_channel_get_encodings_accepted_by_peer_string( call->channel)) { - set_encodings_accepted_by_peer(call, md->value->slice); + set_encodings_accepted_by_peer(call, mdel->value->slice); } else { dest = &call->buffered_metadata[is_trailing]; if (dest->count == dest->capacity) { @@ -1493,9 +1493,9 @@ static void recv_metadata(grpc_call *call, grpc_metadata_batch *md) { gpr_realloc(dest->metadata, sizeof(grpc_metadata) * dest->capacity); } mdusr = &dest->metadata[dest->count++]; - mdusr->key = grpc_mdstr_as_c_string(md->key); - mdusr->value = grpc_mdstr_as_c_string(md->value); - mdusr->value_length = GPR_SLICE_LENGTH(md->value->slice); + mdusr->key = grpc_mdstr_as_c_string(mdel->key); + mdusr->value = grpc_mdstr_as_c_string(mdel->value); + mdusr->value_length = GPR_SLICE_LENGTH(mdel->value->slice); if (call->owned_metadata_count == call->owned_metadata_capacity) { call->owned_metadata_capacity = GPR_MAX(call->owned_metadata_capacity + 8, @@ -1504,8 +1504,8 @@ static void recv_metadata(grpc_call *call, grpc_metadata_batch *md) { gpr_realloc(call->owned_metadata, sizeof(grpc_mdelem *) * call->owned_metadata_capacity); } - call->owned_metadata[call->owned_metadata_count++] = md; - l->md = 0; + call->owned_metadata[call->owned_metadata_count++] = mdel; + l->md = NULL; } } if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) != diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index 9b554eeb701..6eb31ad63f5 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -191,7 +191,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, grpc_arg connector_arg; grpc_channel_args *args_copy; grpc_channel_args *new_args_from_connector; - grpc_channel_security_connector *connector; + grpc_channel_security_connector *security_connector; grpc_mdctx *mdctx; grpc_resolver *resolver; subchannel_factory *f; @@ -208,7 +208,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, } if (grpc_credentials_create_security_connector( - creds, target, args, NULL, &connector, &new_args_from_connector) != + creds, target, args, NULL, &security_connector, &new_args_from_connector) != GRPC_SECURITY_OK) { return grpc_lame_client_channel_create( target, GRPC_STATUS_INVALID_ARGUMENT, @@ -216,7 +216,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, } mdctx = grpc_mdctx_create(); - connector_arg = grpc_security_connector_to_arg(&connector->base); + connector_arg = grpc_security_connector_to_arg(&security_connector->base); args_copy = grpc_channel_args_copy_and_add( new_args_from_connector != NULL ? new_args_from_connector : args, &connector_arg, 1); @@ -235,8 +235,8 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, gpr_ref_init(&f->refs, 1); grpc_mdctx_ref(mdctx); f->mdctx = mdctx; - GRPC_SECURITY_CONNECTOR_REF(&connector->base, "subchannel_factory"); - f->security_connector = connector; + GRPC_SECURITY_CONNECTOR_REF(&security_connector->base, "subchannel_factory"); + f->security_connector = security_connector; f->merge_args = grpc_channel_args_copy(args_copy); f->master = channel; GRPC_CHANNEL_INTERNAL_REF(channel, "subchannel_factory"); @@ -249,7 +249,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, resolver); GRPC_RESOLVER_UNREF(resolver, "create"); grpc_subchannel_factory_unref(&f->base); - GRPC_SECURITY_CONNECTOR_UNREF(&connector->base, "channel_create"); + GRPC_SECURITY_CONNECTOR_UNREF(&security_connector->base, "channel_create"); grpc_channel_args_destroy(args_copy); if (new_args_from_connector != NULL) { diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 3d404f78a4f..126349b29ff 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -298,15 +298,15 @@ static void channel_broadcaster_shutdown(channel_broadcaster *cb, * request_matcher */ -static void request_matcher_init(request_matcher *request_matcher, +static void request_matcher_init(request_matcher *rm, size_t entries) { - memset(request_matcher, 0, sizeof(*request_matcher)); - request_matcher->requests = gpr_stack_lockfree_create(entries); + memset(rm, 0, sizeof(*rm)); + rm->requests = gpr_stack_lockfree_create(entries); } -static void request_matcher_destroy(request_matcher *request_matcher) { - GPR_ASSERT(gpr_stack_lockfree_pop(request_matcher->requests) == -1); - gpr_stack_lockfree_destroy(request_matcher->requests); +static void request_matcher_destroy(request_matcher *rm) { + GPR_ASSERT(gpr_stack_lockfree_pop(rm->requests) == -1); + gpr_stack_lockfree_destroy(rm->requests); } static void kill_zombie(void *elem, int success) { @@ -314,10 +314,10 @@ static void kill_zombie(void *elem, int success) { } static void request_matcher_zombify_all_pending_calls( - request_matcher *request_matcher) { - while (request_matcher->pending_head) { - call_data *calld = request_matcher->pending_head; - request_matcher->pending_head = calld->pending_next; + request_matcher *rm) { + while (rm->pending_head) { + call_data *calld = rm->pending_head; + rm->pending_head = calld->pending_next; gpr_mu_lock(&calld->mu_state); calld->state = ZOMBIED; gpr_mu_unlock(&calld->mu_state); @@ -405,7 +405,7 @@ static void destroy_channel(channel_data *chand) { } static void finish_start_new_rpc(grpc_server *server, grpc_call_element *elem, - request_matcher *request_matcher) { + request_matcher *rm) { call_data *calld = elem->call_data; int request_id; @@ -418,17 +418,17 @@ static void finish_start_new_rpc(grpc_server *server, grpc_call_element *elem, return; } - request_id = gpr_stack_lockfree_pop(request_matcher->requests); + request_id = gpr_stack_lockfree_pop(rm->requests); if (request_id == -1) { gpr_mu_lock(&server->mu_call); gpr_mu_lock(&calld->mu_state); calld->state = PENDING; gpr_mu_unlock(&calld->mu_state); - if (request_matcher->pending_head == NULL) { - request_matcher->pending_tail = request_matcher->pending_head = calld; + if (rm->pending_head == NULL) { + rm->pending_tail = rm->pending_head = calld; } else { - request_matcher->pending_tail->pending_next = calld; - request_matcher->pending_tail = calld; + rm->pending_tail->pending_next = calld; + rm->pending_tail = calld; } calld->pending_next = NULL; gpr_mu_unlock(&server->mu_call); @@ -1082,7 +1082,7 @@ void grpc_server_add_listener(grpc_server *server, void *arg, static grpc_call_error queue_call_request(grpc_server *server, requested_call *rc) { call_data *calld = NULL; - request_matcher *request_matcher = NULL; + request_matcher *rm = NULL; int request_id; if (gpr_atm_acq_load(&server->shutdown_flag)) { fail_call(server, rc); @@ -1096,22 +1096,22 @@ static grpc_call_error queue_call_request(grpc_server *server, } switch (rc->type) { case BATCH_CALL: - request_matcher = &server->unregistered_request_matcher; + rm = &server->unregistered_request_matcher; break; case REGISTERED_CALL: - request_matcher = &rc->data.registered.registered_method->request_matcher; + rm = &rc->data.registered.registered_method->request_matcher; break; } server->requested_calls[request_id] = *rc; gpr_free(rc); - if (gpr_stack_lockfree_push(request_matcher->requests, request_id)) { + if (gpr_stack_lockfree_push(rm->requests, request_id)) { /* this was the first queued request: we need to lock and start matching calls */ gpr_mu_lock(&server->mu_call); - while ((calld = request_matcher->pending_head) != NULL) { - request_id = gpr_stack_lockfree_pop(request_matcher->requests); + while ((calld = rm->pending_head) != NULL) { + request_id = gpr_stack_lockfree_pop(rm->requests); if (request_id == -1) break; - request_matcher->pending_head = calld->pending_next; + rm->pending_head = calld->pending_next; gpr_mu_unlock(&server->mu_call); gpr_mu_lock(&calld->mu_state); if (calld->state == ZOMBIED) { @@ -1160,12 +1160,12 @@ grpc_call_error grpc_server_request_call( } grpc_call_error grpc_server_request_registered_call( - grpc_server *server, void *rm, grpc_call **call, gpr_timespec *deadline, + grpc_server *server, void *rmp, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *initial_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag) { requested_call *rc = gpr_malloc(sizeof(*rc)); - registered_method *registered_method = rm; + registered_method *rm = rmp; if (!grpc_cq_is_server_cq(cq_for_notification)) { gpr_free(rc); return GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE; @@ -1177,7 +1177,7 @@ grpc_call_error grpc_server_request_registered_call( rc->cq_bound_to_call = cq_bound_to_call; rc->cq_for_notification = cq_for_notification; rc->call = call; - rc->data.registered.registered_method = registered_method; + rc->data.registered.registered_method = rm; rc->data.registered.deadline = deadline; rc->data.registered.initial_metadata = initial_metadata; rc->data.registered.optional_payload = optional_payload; diff --git a/templates/Makefile.template b/templates/Makefile.template index d8370ce2689..f10b5cc508c 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -261,7 +261,7 @@ DEFINES += $(EXTRA_DEFINES) endif - CFLAGS += -std=c89 -pedantic -Wsign-conversion -Wconversion + CFLAGS += -std=c89 -pedantic -Wsign-conversion -Wconversion -Wshadow ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 else From a2f38b0563beba703922c7aaa0a61a975d8b830e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 24 Sep 2015 11:19:17 -0700 Subject: [PATCH 2/3] Dump portlog.txt on port server error, detect crashes earlier --- tools/run_tests/run_tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index e971aaf9c37..d271137ca12 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -727,7 +727,10 @@ def _start_port_server(port_server_port): while True: if waits > 10: port_server.kill() + if port_server.poll() is not None: print "port_server failed to start" + port_log = open('portlog.txt', 'r').read() + print port_log sys.exit(1) try: urllib2.urlopen('http://localhost:%d/get' % port_server_port, From 5cf7013c4b736c23ab0ad0d1337ff4b0e78d5748 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 24 Sep 2015 11:34:23 -0700 Subject: [PATCH 3/3] Merge --- src/core/channel/http_server_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index d3c6012d881..7a6a89e050b 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -202,7 +202,7 @@ static void hs_mutate_op(grpc_call_element *elem, calld->sent_status = 1; grpc_metadata_batch_add_head(&stream_op->data.metadata, &calld->status, GRPC_MDELEM_REF(channeld->status_ok)); - grpc_metadata_batch_add_tail(&op->data.metadata, &calld->content_type, + grpc_metadata_batch_add_tail(&stream_op->data.metadata, &calld->content_type, GRPC_MDELEM_REF(channeld->content_type)); break; }