diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc index 2358415fc2e..5690545cbb7 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.cc +++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc @@ -54,7 +54,7 @@ void grpc_client_channel_init(void) { grpc_core::GlobalSubchannelPool::Init(); grpc_channel_init_register_stage( GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, - (void*)&grpc_client_channel_filter); + const_cast(&grpc_client_channel_filter)); grpc_http_connect_register_handshaker_factory(); grpc_client_channel_global_init_backup_polling(); } diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index b489e519b00..646fe199076 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -1358,7 +1358,7 @@ GrpcLb::GrpcLb(Args args) } GrpcLb::~GrpcLb() { - gpr_free((void*)server_name_); + gpr_free(const_cast(server_name_)); grpc_channel_args_destroy(args_); } @@ -1782,10 +1782,10 @@ void grpc_lb_policy_grpclb_init() { grpc_core::LoadBalancingPolicyRegistry::Builder:: RegisterLoadBalancingPolicyFactory( absl::make_unique()); - grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, - GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_client_load_reporting_filter, - (void*)&grpc_client_load_reporting_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_client_load_reporting_filter, + const_cast(&grpc_client_load_reporting_filter)); } void grpc_lb_policy_grpclb_shutdown() {} diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc index bd168444f8a..837e337b64b 100644 --- a/src/core/ext/filters/deadline/deadline_filter.cc +++ b/src/core/ext/filters/deadline/deadline_filter.cc @@ -383,10 +383,12 @@ static bool maybe_add_deadline_filter(grpc_channel_stack_builder* builder, void grpc_deadline_filter_init(void) { grpc_channel_init_register_stage( GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_deadline_filter, (void*)&grpc_client_deadline_filter); + maybe_add_deadline_filter, + const_cast(&grpc_client_deadline_filter)); grpc_channel_init_register_stage( GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_deadline_filter, (void*)&grpc_server_deadline_filter); + maybe_add_deadline_filter, + const_cast(&grpc_server_deadline_filter)); } void grpc_deadline_filter_shutdown(void) {} diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 2c3cae6adbc..9511d2591a3 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -148,12 +148,12 @@ static bool add_client_authority_filter(grpc_channel_stack_builder* builder, } void grpc_client_authority_filter_init(void) { - grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, - add_client_authority_filter, - (void*)&grpc_client_authority_filter); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, - add_client_authority_filter, - (void*)&grpc_client_authority_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_SUBCHANNEL, INT_MAX, add_client_authority_filter, + const_cast(&grpc_client_authority_filter)); + grpc_channel_init_register_stage( + GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, add_client_authority_filter, + const_cast(&grpc_client_authority_filter)); } void grpc_client_authority_filter_shutdown(void) {} diff --git a/src/core/ext/filters/http/http_filters_plugin.cc b/src/core/ext/filters/http/http_filters_plugin.cc index 637dc3030f2..d5577d56145 100644 --- a/src/core/ext/filters/http/http_filters_plugin.cc +++ b/src/core/ext/filters/http/http_filters_plugin.cc @@ -93,13 +93,16 @@ void grpc_http_filters_init(void) { maybe_add_optional_filter, &decompress_filter); grpc_channel_init_register_stage( GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_required_filter, (void*)&grpc_http_client_filter); + maybe_add_required_filter, + const_cast(&grpc_http_client_filter)); grpc_channel_init_register_stage( GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_required_filter, (void*)&grpc_http_client_filter); + maybe_add_required_filter, + const_cast(&grpc_http_client_filter)); grpc_channel_init_register_stage( GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_required_filter, (void*)&grpc_http_server_filter); + maybe_add_required_filter, + const_cast(&grpc_http_server_filter)); } void grpc_http_filters_shutdown(void) {} diff --git a/src/core/ext/filters/workarounds/workaround_utils.cc b/src/core/ext/filters/workarounds/workaround_utils.cc index 4dabe896d3b..2a184ba895f 100644 --- a/src/core/ext/filters/workarounds/workaround_utils.cc +++ b/src/core/ext/filters/workarounds/workaround_utils.cc @@ -42,7 +42,7 @@ grpc_workaround_user_agent_md* grpc_parse_user_agent(grpc_mdelem md) { user_agent_md->workaround_active[i] = ua_parser[i](md); } } - grpc_mdelem_set_user_data(md, destroy_user_agent_md, (void*)user_agent_md); + grpc_mdelem_set_user_data(md, destroy_user_agent_md, user_agent_md); return user_agent_md; } diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 1b5ce21bc52..4c992026f7b 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -749,7 +749,7 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, GPR_ASSERT(t->accepting_stream == nullptr); t->accepting_stream = &accepting; t->accept_stream_cb(t->accept_stream_cb_user_data, &t->base, - (void*)static_cast(id)); + reinterpret_cast(id)); t->accepting_stream = nullptr; return accepting; } diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index 6711996683e..22d01f1957f 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -1059,8 +1059,8 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) { unsigned int header_index; for (header_index = 0; header_index < s->header_array.count; header_index++) { - gpr_free((void*)s->header_array.headers[header_index].key); - gpr_free((void*)s->header_array.headers[header_index].value); + gpr_free(s->header_array.headers[header_index].key); + gpr_free(s->header_array.headers[header_index].value); } stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; if (t->use_packet_coalescing) { diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index 92afeca69dd..dbab879b1d0 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -153,7 +153,7 @@ struct inproc_stream { // side to avoid destruction INPROC_LOG(GPR_INFO, "calling accept stream cb %p %p", st->accept_stream_cb, st->accept_stream_data); - (*st->accept_stream_cb)(st->accept_stream_data, &st->base, (void*)this); + (*st->accept_stream_cb)(st->accept_stream_data, &st->base, this); } else { // This is the server-side and is being called through accept_stream_cb inproc_stream* cs = (inproc_stream*)server_data; diff --git a/src/core/lib/gpr/alloc.cc b/src/core/lib/gpr/alloc.cc index 8c7345b7db5..c316ea20cc5 100644 --- a/src/core/lib/gpr/alloc.cc +++ b/src/core/lib/gpr/alloc.cc @@ -68,7 +68,7 @@ void* gpr_malloc_aligned(size_t size, size_t alignment) { void* p = gpr_malloc(size + extra); void** ret = (void**)(((uintptr_t)p + extra) & ~(alignment - 1)); ret[-1] = p; - return (void*)ret; + return ret; } void gpr_free_aligned(void* ptr) { gpr_free((static_cast(ptr))[-1]); } diff --git a/src/core/lib/gpr/sync.cc b/src/core/lib/gpr/sync.cc index 2f18fc5ecb4..18c0c3ac9a0 100644 --- a/src/core/lib/gpr/sync.cc +++ b/src/core/lib/gpr/sync.cc @@ -67,16 +67,16 @@ void gpr_event_set(gpr_event* ev, void* value) { } void* gpr_event_get(gpr_event* ev) { - return (void*)gpr_atm_acq_load(&ev->state); + return reinterpret_cast(gpr_atm_acq_load(&ev->state)); } void* gpr_event_wait(gpr_event* ev, gpr_timespec abs_deadline) { - void* result = (void*)gpr_atm_acq_load(&ev->state); + void* result = reinterpret_cast(gpr_atm_acq_load(&ev->state)); if (result == nullptr) { struct sync_array_s* s = hash(ev); gpr_mu_lock(&s->mu); do { - result = (void*)gpr_atm_acq_load(&ev->state); + result = reinterpret_cast(gpr_atm_acq_load(&ev->state)); } while (result == nullptr && !gpr_cv_wait(&s->cv, &s->mu, abs_deadline)); gpr_mu_unlock(&s->mu); } diff --git a/src/core/lib/http/parser.cc b/src/core/lib/http/parser.cc index b95a942f706..3a0b2be4a85 100644 --- a/src/core/lib/http/parser.cc +++ b/src/core/lib/http/parser.cc @@ -281,8 +281,7 @@ static grpc_error* addbyte_body(grpc_http_parser* parser, uint8_t byte) { if (*body_length == parser->body_capacity) { parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2); - *body = - static_cast(gpr_realloc((void*)*body, parser->body_capacity)); + *body = static_cast(gpr_realloc(*body, parser->body_capacity)); } (*body)[*body_length] = static_cast(byte); (*body_length)++; diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index a00d8b76218..4cf153c2efa 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -166,7 +166,8 @@ static void error_destroy(grpc_error* err) { GPR_ASSERT(!grpc_error_is_special(err)); unref_errs(err); unref_strs(err); - gpr_free((void*)gpr_atm_acq_load(&err->atomics.error_string)); + gpr_free( + reinterpret_cast(gpr_atm_acq_load(&err->atomics.error_string))); gpr_free(err); } @@ -237,10 +238,10 @@ static void internal_set_str(grpc_error** err, grpc_error_strs which, if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); if (slot == UINT8_MAX) { - const char* str = grpc_slice_to_c_string(value); + char* str = grpc_slice_to_c_string(value); gpr_log(GPR_ERROR, "Error %p is full, dropping string {\"%s\":\"%s\"}", *err, error_str_name(which), str); - gpr_free((void*)str); + gpr_free(str); return; } } else { @@ -258,10 +259,10 @@ static void internal_set_time(grpc_error** err, grpc_error_times which, if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); if (slot == UINT8_MAX) { - const char* time_str = fmt_time(value); + char* time_str = fmt_time(value); gpr_log(GPR_ERROR, "Error %p is full, dropping \"%s\":\"%s\"}", *err, error_time_name(which), time_str); - gpr_free((void*)time_str); + gpr_free(time_str); return; } } @@ -426,7 +427,8 @@ static grpc_error* copy_error_and_unref(grpc_error* in) { // bulk memcpy of the rest of the struct. // NOLINTNEXTLINE(bugprone-sizeof-expression) size_t skip = sizeof(&out->atomics); - memcpy((void*)((uintptr_t)out + skip), (void*)((uintptr_t)in + skip), + memcpy(reinterpret_cast((uintptr_t)out + skip), + (void*)((uintptr_t)in + skip), sizeof(*in) + (in->arena_size * sizeof(intptr_t)) - skip); // manually set the atomics and the new capacity gpr_atm_no_barrier_store(&out->atomics.error_string, 0); @@ -744,7 +746,8 @@ const char* grpc_error_string(grpc_error* err) { if (err == GRPC_ERROR_OOM) return oom_error_string; if (err == GRPC_ERROR_CANCELLED) return cancelled_error_string; - void* p = (void*)gpr_atm_acq_load(&err->atomics.error_string); + void* p = + reinterpret_cast(gpr_atm_acq_load(&err->atomics.error_string)); if (p != nullptr) { return static_cast(p); } diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 7a257bca308..e75bb4a1d25 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -1071,8 +1071,9 @@ static grpc_error* pollset_kick(grpc_pollset* pollset, std::vector log; log.push_back(absl::StrFormat( "PS:%p KICK:%p curps=%p curworker=%p root=%p", pollset, specific_worker, - (void*)gpr_tls_get(&g_current_thread_pollset), - (void*)gpr_tls_get(&g_current_thread_worker), pollset->root_worker)); + reinterpret_cast(gpr_tls_get(&g_current_thread_pollset)), + reinterpret_cast(gpr_tls_get(&g_current_thread_worker)), + pollset->root_worker)); if (pollset->root_worker != nullptr) { log.push_back(absl::StrFormat( " {kick_state=%s next=%p {kick_state=%s}}", diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index d3392f34c12..98dbcd39569 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -577,7 +577,7 @@ static grpc_error* pollable_create(pollable_type type, pollable** p) { } struct epoll_event ev; ev.events = static_cast(EPOLLIN | EPOLLET); - ev.data.ptr = (void*)(1 | (intptr_t) & (*p)->wakeup); + ev.data.ptr = reinterpret_cast(1 | (intptr_t) & (*p)->wakeup); if (epoll_ctl(epfd, EPOLL_CTL_ADD, (*p)->wakeup.read_fd, &ev) != 0) { err = GRPC_OS_ERROR(errno, "epoll_ctl"); GRPC_FD_TRACE( @@ -730,9 +730,9 @@ static grpc_error* pollset_kick(grpc_pollset* pollset, if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_INFO, "PS:%p kick %p tls_pollset=%p tls_worker=%p pollset.root_worker=%p", - pollset, specific_worker, - (void*)gpr_tls_get(&g_current_thread_pollset), - (void*)gpr_tls_get(&g_current_thread_worker), pollset->root_worker); + static_cast(pollset), specific_worker, + gpr_tls_get(&g_current_thread_pollset), + gpr_tls_get(&g_current_thread_worker), pollset->root_worker); } if (specific_worker == nullptr) { if (gpr_tls_get(&g_current_thread_pollset) != (intptr_t)pollset) { diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 7d40c801e13..f54a37cdfbc 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -987,7 +987,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, void* buf = gpr_malloc(pfd_size + watch_size); pfds = static_cast(buf); watchers = static_cast( - (void*)(static_cast(buf) + pfd_size)); + static_cast((static_cast(buf) + pfd_size))); } fd_count = 0; diff --git a/src/core/lib/iomgr/lockfree_event.cc b/src/core/lib/iomgr/lockfree_event.cc index 82a2c52ad21..de9ef776644 100644 --- a/src/core/lib/iomgr/lockfree_event.cc +++ b/src/core/lib/iomgr/lockfree_event.cc @@ -97,7 +97,7 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) { gpr_atm curr = gpr_atm_acq_load(&state_); if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_DEBUG, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this, - (void*)curr, closure); + reinterpret_cast(curr), closure); } switch (curr) { case kClosureNotReady: { @@ -163,7 +163,8 @@ bool LockfreeEvent::SetShutdown(grpc_error* shutdown_error) { gpr_atm curr = gpr_atm_no_barrier_load(&state_); if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_DEBUG, "LockfreeEvent::SetShutdown: %p curr=%p err=%s", - &state_, (void*)curr, grpc_error_string(shutdown_error)); + &state_, reinterpret_cast(curr), + grpc_error_string(shutdown_err)); } switch (curr) { case kClosureReady: @@ -212,7 +213,7 @@ void LockfreeEvent::SetReady() { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%p", &state_, - (void*)curr); + reinterpret_cast(curr)); } switch (curr) { diff --git a/src/core/lib/iomgr/tcp_server_custom.cc b/src/core/lib/iomgr/tcp_server_custom.cc index 4fbf4b3e558..18d74945be5 100644 --- a/src/core/lib/iomgr/tcp_server_custom.cc +++ b/src/core/lib/iomgr/tcp_server_custom.cc @@ -293,7 +293,8 @@ static grpc_error* add_socket_to_server(grpc_tcp_server* s, } error = grpc_custom_socket_vtable->bind( - socket, reinterpret_cast(addr->addr), addr->len, flags); + socket, reinterpret_cast(const_cast(addr->addr)), + addr->len, flags); if (error != GRPC_ERROR_NONE) { return error; } diff --git a/src/core/lib/iomgr/timer_custom.cc b/src/core/lib/iomgr/timer_custom.cc index f2987006567..867359a28db 100644 --- a/src/core/lib/iomgr/timer_custom.cc +++ b/src/core/lib/iomgr/timer_custom.cc @@ -59,7 +59,7 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline, grpc_custom_timer* timer_wrapper = static_cast(gpr_malloc(sizeof(grpc_custom_timer))); timer_wrapper->timeout_ms = timeout; - timer->custom_timer = (void*)timer_wrapper; + timer->custom_timer = timer_wrapper; timer_wrapper->original = timer; custom_timer_impl->start(timer_wrapper); } diff --git a/src/core/lib/security/credentials/jwt/json_token.cc b/src/core/lib/security/credentials/jwt/json_token.cc index 3b61742064b..8f5a94f4bfd 100644 --- a/src/core/lib/security/credentials/jwt/json_token.cc +++ b/src/core/lib/security/credentials/jwt/json_token.cc @@ -112,7 +112,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const Json& json) { goto end; } result.private_key = - PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, (void*)""); + PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, const_cast("")); if (result.private_key == nullptr) { gpr_log(GPR_ERROR, "Could not deserialize private key."); goto end; diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc index a6ed657dbf2..058715afff0 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc @@ -757,8 +757,8 @@ const char* grpc_jwt_issuer_email_domain(const char* issuer) { if (dot == nullptr || dot == email_domain) return email_domain; GPR_ASSERT(dot > email_domain); /* There may be a subdomain, we just want the domain. */ - dot = static_cast(gpr_memrchr( - (void*)email_domain, '.', static_cast(dot - email_domain))); + dot = static_cast( + gpr_memrchr(email_domain, '.', static_cast(dot - email_domain))); if (dot == nullptr) return email_domain; return dot + 1; } diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.cc b/src/core/lib/security/credentials/plugin/plugin_credentials.cc index 9cb8b815442..a5b01cd84e8 100644 --- a/src/core/lib/security/credentials/plugin/plugin_credentials.cc +++ b/src/core/lib/security/credentials/plugin/plugin_credentials.cc @@ -224,7 +224,7 @@ bool grpc_plugin_credentials::get_request_metadata( grpc_slice_unref_internal(creds_md[i].key); grpc_slice_unref_internal(creds_md[i].value); } - gpr_free((void*)error_details); + gpr_free(const_cast(error_details)); gpr_free(request); } return retval; diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.cc b/src/core/lib/security/credentials/ssl/ssl_credentials.cc index 3bb7790f5c9..7be8aa62410 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.cc +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.cc @@ -38,8 +38,8 @@ void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp, size_t num_key_cert_pairs) { if (kp == nullptr) return; for (size_t i = 0; i < num_key_cert_pairs; i++) { - gpr_free((void*)kp[i].private_key); - gpr_free((void*)kp[i].cert_chain); + gpr_free(const_cast(kp[i].private_key)); + gpr_free(const_cast(kp[i].cert_chain)); } gpr_free(kp); } @@ -262,8 +262,8 @@ void grpc_ssl_server_certificate_config_destroy( grpc_ssl_server_certificate_config* config) { if (config == nullptr) return; for (size_t i = 0; i < config->num_key_cert_pairs; i++) { - gpr_free((void*)config->pem_key_cert_pairs[i].private_key); - gpr_free((void*)config->pem_key_cert_pairs[i].cert_chain); + gpr_free(const_cast(config->pem_key_cert_pairs[i].private_key)); + gpr_free(const_cast(config->pem_key_cert_pairs[i].cert_chain)); } gpr_free(config->pem_key_cert_pairs); gpr_free(config->pem_root_certs); diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc b/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc index 9e69d986887..e6ec16f6613 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc @@ -172,7 +172,7 @@ FileWatcherCertificateProvider::~FileWatcherCertificateProvider() { // Reset distributor's callback to make sure the callback won't be invoked // again after this object(provider) is destroyed. distributor_->SetWatchStatusCallback(nullptr); - gpr_event_set(&shutdown_event_, (void*)(1)); + gpr_event_set(&shutdown_event_, reinterpret_cast(1)); refresh_thread_.Join(); } diff --git a/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc b/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc index 7d4574e2581..41a2252435c 100644 --- a/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +++ b/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc @@ -111,7 +111,7 @@ class grpc_ssl_channel_security_connector final const tsi_result result = tsi_create_ssl_client_handshaker_factory_with_options( &options, &client_handshaker_factory_); - gpr_free((void*)options.alpn_protocols); + gpr_free(options.alpn_protocols); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", tsi_result_to_string(result)); @@ -258,7 +258,7 @@ class grpc_ssl_server_security_connector const tsi_result result = tsi_create_ssl_server_handshaker_factory_with_options( &options, &server_handshaker_factory_); - gpr_free((void*)alpn_protocol_strings); + gpr_free(alpn_protocol_strings); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", tsi_result_to_string(result)); @@ -368,7 +368,7 @@ class grpc_ssl_server_security_connector grpc_tsi_ssl_pem_key_cert_pairs_destroy( const_cast(options.pem_key_cert_pairs), options.num_key_cert_pairs); - gpr_free((void*)alpn_protocol_strings); + gpr_free(alpn_protocol_strings); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", diff --git a/src/core/lib/security/security_connector/ssl_utils.cc b/src/core/lib/security/security_connector/ssl_utils.cc index 1761c346c41..f1797d5d80a 100644 --- a/src/core/lib/security/security_connector/ssl_utils.cc +++ b/src/core/lib/security/security_connector/ssl_utils.cc @@ -427,7 +427,7 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init( const tsi_result result = tsi_create_ssl_client_handshaker_factory_with_options(&options, handshaker_factory); - gpr_free((void*)options.alpn_protocols); + gpr_free(options.alpn_protocols); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", tsi_result_to_string(result)); @@ -459,7 +459,7 @@ grpc_security_status grpc_ssl_tsi_server_handshaker_factory_init( const tsi_result result = tsi_create_ssl_server_handshaker_factory_with_options(&options, handshaker_factory); - gpr_free((void*)alpn_protocol_strings); + gpr_free(alpn_protocol_strings); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", tsi_result_to_string(result)); diff --git a/src/core/lib/security/security_connector/tls/tls_security_connector.cc b/src/core/lib/security/security_connector/tls/tls_security_connector.cc index a03e3bf4be9..b288cc6ead9 100644 --- a/src/core/lib/security/security_connector/tls/tls_security_connector.cc +++ b/src/core/lib/security/security_connector/tls/tls_security_connector.cc @@ -419,9 +419,11 @@ void TlsChannelSecurityConnector::ServerAuthorizationCheckArgDestroy( if (arg == nullptr) { return; } - gpr_free((void*)arg->target_name); - gpr_free((void*)arg->peer_cert); - if (arg->peer_cert_full_chain) gpr_free((void*)arg->peer_cert_full_chain); + gpr_free(const_cast(arg->target_name)); + gpr_free(const_cast(arg->peer_cert)); + if (arg->peer_cert_full_chain) { + gpr_free(const_cast(arg->peer_cert_full_chain)); + } delete arg->error_details; if (arg->destroy_context != nullptr) { arg->destroy_context(arg->context); diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index e0a7077a4af..7f87d0e190f 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -869,7 +869,8 @@ static void set_encodings_accepted_by_peer(grpc_call* /*call*/, grpc_mdelem_set_user_data( mdel, destroy_encodings_accepted_by_peer, - (void*)((static_cast(*encodings_accepted_by_peer)) + 1)); + reinterpret_cast( + (static_cast(*encodings_accepted_by_peer)) + 1)); } uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call* call) { diff --git a/src/core/lib/surface/channel_init.cc b/src/core/lib/surface/channel_init.cc index 62eb1c3f9d6..17f6c901d1f 100644 --- a/src/core/lib/surface/channel_init.cc +++ b/src/core/lib/surface/channel_init.cc @@ -87,7 +87,7 @@ void grpc_channel_init_shutdown(void) { for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) { gpr_free(g_slots[i].slots); g_slots[i].slots = - static_cast((void*)static_cast(0xdeadbeef)); + static_cast(reinterpret_cast(0xdeadbeef)); } } diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index ff5b074ca34..0b2151b73b9 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -101,11 +101,12 @@ static void register_builtin_channel_init() { grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, nullptr); - grpc_channel_init_register_stage(GRPC_CLIENT_LAME_CHANNEL, - GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - append_filter, (void*)&grpc_lame_filter); - grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter, - (void*)&grpc_core::Server::kServerTopFilter); + grpc_channel_init_register_stage( + GRPC_CLIENT_LAME_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + append_filter, const_cast(&grpc_lame_filter)); + grpc_channel_init_register_stage( + GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter, + const_cast(&grpc_core::Server::kServerTopFilter)); } typedef struct grpc_plugin { diff --git a/src/core/lib/transport/status_metadata.cc b/src/core/lib/transport/status_metadata.cc index c83d6b0d2dc..6f7890d554e 100644 --- a/src/core/lib/transport/status_metadata.cc +++ b/src/core/lib/transport/status_metadata.cc @@ -48,8 +48,8 @@ grpc_status_code grpc_get_status_code_from_metadata(grpc_mdelem md) { if (!grpc_parse_slice_to_uint32(GRPC_MDVALUE(md), &status)) { status = GRPC_STATUS_UNKNOWN; /* could not parse status code */ } - grpc_mdelem_set_user_data( - md, destroy_status, (void*)static_cast(status + STATUS_OFFSET)); + grpc_mdelem_set_user_data(md, destroy_status, + reinterpret_cast(status + STATUS_OFFSET)); return static_cast(status); } diff --git a/src/core/tsi/alts/crypt/gsec.cc b/src/core/tsi/alts/crypt/gsec.cc index 6236591a97c..d4de9cdbff4 100644 --- a/src/core/tsi/alts/crypt/gsec.cc +++ b/src/core/tsi/alts/crypt/gsec.cc @@ -43,8 +43,9 @@ grpc_status_code gsec_aead_crypter_encrypt( char** error_details) { if (crypter != nullptr && crypter->vtable != nullptr && crypter->vtable->encrypt_iovec != nullptr) { - struct iovec aad_vec = {(void*)aad, aad_length}; - struct iovec plaintext_vec = {(void*)plaintext, plaintext_length}; + struct iovec aad_vec = {const_cast(aad), aad_length}; + struct iovec plaintext_vec = {const_cast(plaintext), + plaintext_length}; struct iovec ciphertext_vec = {ciphertext_and_tag, ciphertext_and_tag_length}; return crypter->vtable->encrypt_iovec( @@ -81,8 +82,8 @@ grpc_status_code gsec_aead_crypter_decrypt( size_t plaintext_length, size_t* bytes_written, char** error_details) { if (crypter != nullptr && crypter->vtable != nullptr && crypter->vtable->decrypt_iovec != nullptr) { - struct iovec aad_vec = {(void*)aad, aad_length}; - struct iovec ciphertext_vec = {(void*)ciphertext_and_tag, + struct iovec aad_vec = {const_cast(aad), aad_length}; + struct iovec ciphertext_vec = {const_cast(ciphertext_and_tag), ciphertext_and_tag_length}; struct iovec plaintext_vec = {plaintext, plaintext_length}; return crypter->vtable->decrypt_iovec( diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index 8108ff26bb8..ccf1dd614ab 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -554,12 +554,12 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX* context, X509* certificate = nullptr; BIO* pem; GPR_ASSERT(pem_cert_chain_size <= INT_MAX); - pem = BIO_new_mem_buf((void*)pem_cert_chain, - static_cast(pem_cert_chain_size)); + pem = BIO_new_mem_buf(pem_cert_chain, static_cast(pem_cert_chain_size)); if (pem == nullptr) return TSI_OUT_OF_RESOURCES; do { - certificate = PEM_read_bio_X509_AUX(pem, nullptr, nullptr, (void*)""); + certificate = + PEM_read_bio_X509_AUX(pem, nullptr, nullptr, const_cast("")); if (certificate == nullptr) { result = TSI_INVALID_ARGUMENT; break; @@ -570,7 +570,7 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX* context, } while (true) { X509* certificate_authority = - PEM_read_bio_X509(pem, nullptr, nullptr, (void*)""); + PEM_read_bio_X509(pem, nullptr, nullptr, const_cast("")); if (certificate_authority == nullptr) { ERR_clear_error(); break; /* Done reading. */ @@ -674,10 +674,11 @@ static tsi_result ssl_ctx_use_pem_private_key(SSL_CTX* context, EVP_PKEY* private_key = nullptr; BIO* pem; GPR_ASSERT(pem_key_size <= INT_MAX); - pem = BIO_new_mem_buf((void*)pem_key, static_cast(pem_key_size)); + pem = BIO_new_mem_buf(pem_key, static_cast(pem_key_size)); if (pem == nullptr) return TSI_OUT_OF_RESOURCES; do { - private_key = PEM_read_bio_PrivateKey(pem, nullptr, nullptr, (void*)""); + private_key = + PEM_read_bio_PrivateKey(pem, nullptr, nullptr, const_cast("")); if (private_key == nullptr) { result = TSI_INVALID_ARGUMENT; break; @@ -718,7 +719,7 @@ static tsi_result x509_store_load_certs(X509_STORE* cert_store, X509_NAME* root_name = nullptr; BIO* pem; GPR_ASSERT(pem_roots_size <= INT_MAX); - pem = BIO_new_mem_buf((void*)pem_roots, static_cast(pem_roots_size)); + pem = BIO_new_mem_buf(pem_roots, static_cast(pem_roots_size)); if (cert_store == nullptr) return TSI_INVALID_ARGUMENT; if (pem == nullptr) return TSI_OUT_OF_RESOURCES; if (root_names != nullptr) { @@ -727,7 +728,7 @@ static tsi_result x509_store_load_certs(X509_STORE* cert_store, } while (true) { - root = PEM_read_bio_X509_AUX(pem, nullptr, nullptr, (void*)""); + root = PEM_read_bio_X509_AUX(pem, nullptr, nullptr, const_cast("")); if (root == nullptr) { ERR_clear_error(); break; /* We're at the end of stream. */ @@ -837,10 +838,10 @@ tsi_result tsi_ssl_extract_x509_subject_names_from_pem_cert( tsi_result result = TSI_OK; X509* cert = nullptr; BIO* pem; - pem = BIO_new_mem_buf((void*)pem_cert, static_cast(strlen(pem_cert))); + pem = BIO_new_mem_buf(pem_cert, static_cast(strlen(pem_cert))); if (pem == nullptr) return TSI_OUT_OF_RESOURCES; - cert = PEM_read_bio_X509(pem, nullptr, nullptr, (void*)""); + cert = PEM_read_bio_X509(pem, nullptr, nullptr, const_cast("")); if (cert == nullptr) { gpr_log(GPR_ERROR, "Invalid certificate"); result = TSI_INVALID_ARGUMENT; diff --git a/src/cpp/common/channel_filter.cc b/src/cpp/common/channel_filter.cc index 8df6c7b98f5..ab56d6073fe 100644 --- a/src/cpp/common/channel_filter.cc +++ b/src/cpp/common/channel_filter.cc @@ -87,7 +87,7 @@ void ChannelFilterPluginInit() { for (size_t i = 0; i < channel_filters->size(); ++i) { FilterRecord& filter = (*channel_filters)[i]; grpc_channel_init_register_stage(filter.stack_type, filter.priority, - MaybeAddFilter, (void*)&filter); + MaybeAddFilter, &filter); } } diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 1d1f2624dc0..a636504082a 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -95,7 +95,7 @@ ServerBuilder& ServerBuilder::RegisterAsyncGenericService( gpr_log(GPR_ERROR, "Adding multiple generic services is unsupported for now. " "Dropping the service %p", - (void*)service); + service); } else { generic_service_ = service; } @@ -122,7 +122,7 @@ ServerBuilder& ServerBuilder::experimental_type::RegisterCallbackGenericService( gpr_log(GPR_ERROR, "Adding multiple generic services is unsupported for now. " "Dropping the service %p", - (void*)service); + service); } else { builder_->callback_generic_service_ = service; } diff --git a/test/core/bad_client/bad_client.cc b/test/core/bad_client/bad_client.cc index 1f366758fd4..000215edf2d 100644 --- a/test/core/bad_client/bad_client.cc +++ b/test/core/bad_client/bad_client.cc @@ -53,13 +53,13 @@ static void thd_func(void* arg) { if (a->validator != nullptr) { a->validator(a->server, a->cq, a->registered_method); } - gpr_event_set(&a->done_thd, (void*)1); + gpr_event_set(&a->done_thd, reinterpret_cast(1)); } /* Sets the done_write event */ static void set_done_write(void* arg, grpc_error* /*error*/) { gpr_event* done_write = static_cast(arg); - gpr_event_set(done_write, (void*)1); + gpr_event_set(done_write, reinterpret_cast(1)); } static void server_setup_transport(void* ts, grpc_transport* transport) { @@ -72,7 +72,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { /* Sets the read_done event */ static void set_read_done(void* arg, grpc_error* /*error*/) { gpr_event* read_done = static_cast(arg); - gpr_event_set(read_done, (void*)1); + gpr_event_set(read_done, reinterpret_cast(1)); } /* shutdown client */ @@ -307,7 +307,7 @@ bool rst_stream_client_validator(grpc_slice_buffer* incoming, void* /*arg*/) { return success; } -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } void server_verifier_request_call(grpc_server* server, grpc_completion_queue* cq, diff --git a/test/core/bad_client/tests/duplicate_header.cc b/test/core/bad_client/tests/duplicate_header.cc index ae191330281..1fa1fd2f97f 100644 --- a/test/core/bad_client/tests/duplicate_header.cc +++ b/test/core/bad_client/tests/duplicate_header.cc @@ -49,7 +49,7 @@ "\x00\x00\x20\x00\x00\x00\x00\x00\x01" \ "\x00\x00\x00\x00" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void verifier(grpc_server* server, grpc_completion_queue* cq, void* /*registered_method*/) { diff --git a/test/core/bad_client/tests/head_of_line_blocking.cc b/test/core/bad_client/tests/head_of_line_blocking.cc index c856b9b122c..08d7bb8e4c5 100644 --- a/test/core/bad_client/tests/head_of_line_blocking.cc +++ b/test/core/bad_client/tests/head_of_line_blocking.cc @@ -66,7 +66,7 @@ static const char prefix[] = "\x01\x00\x00\x27\x10" ""; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { diff --git a/test/core/bad_client/tests/server_registered_method.cc b/test/core/bad_client/tests/server_registered_method.cc index da0ac28d53b..69e26925044 100644 --- a/test/core/bad_client/tests/server_registered_method.cc +++ b/test/core/bad_client/tests/server_registered_method.cc @@ -38,7 +38,7 @@ "\x10\x02te\x08trailers" \ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { diff --git a/test/core/bad_client/tests/simple_request.cc b/test/core/bad_client/tests/simple_request.cc index d1df05dd349..a4aacc20e8f 100644 --- a/test/core/bad_client/tests/simple_request.cc +++ b/test/core/bad_client/tests/simple_request.cc @@ -85,7 +85,7 @@ "\x10\x0cgrpc-timeout\x02" \ "5S" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void verifier(grpc_server* server, grpc_completion_queue* cq, void* /*registered_method*/) { diff --git a/test/core/bad_connection/close_fd_test.cc b/test/core/bad_connection/close_fd_test.cc index 05498f33521..1c89ee72c11 100644 --- a/test/core/bad_connection/close_fd_test.cc +++ b/test/core/bad_connection/close_fd_test.cc @@ -44,7 +44,7 @@ #include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } typedef struct test_ctx test_ctx; diff --git a/test/core/bad_ssl/bad_ssl_test.cc b/test/core/bad_ssl/bad_ssl_test.cc index e273f20a201..ad412a46df9 100644 --- a/test/core/bad_ssl/bad_ssl_test.cc +++ b/test/core/bad_ssl/bad_ssl_test.cc @@ -34,7 +34,7 @@ #include "test/core/util/subprocess.h" #include "test/core/util/test_config.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void run_test(const char* target, size_t nops) { grpc_channel_credentials* ssl_creds = diff --git a/test/core/bad_ssl/server_common.cc b/test/core/bad_ssl/server_common.cc index ebbe2b60a5a..88740a49b6d 100644 --- a/test/core/bad_ssl/server_common.cc +++ b/test/core/bad_ssl/server_common.cc @@ -62,7 +62,8 @@ void bad_ssl_run(grpc_server* server) { grpc_server_start(server); error = grpc_server_request_call(server, &s, &call_details, - &request_metadata_recv, cq, cq, (void*)1); + &request_metadata_recv, cq, cq, + reinterpret_cast(1)); GPR_ASSERT(GRPC_CALL_OK == error); signal(SIGINT, sigint_handler); diff --git a/test/core/channel/channel_stack_builder_test.cc b/test/core/channel/channel_stack_builder_test.cc index e408e4d48c6..b154ad205f0 100644 --- a/test/core/channel/channel_stack_builder_test.cc +++ b/test/core/channel/channel_stack_builder_test.cc @@ -111,12 +111,12 @@ static bool add_original_filter(grpc_channel_stack_builder* builder, } static void init_plugin(void) { - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, - add_original_filter, - (void*)&original_filter); - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, - add_replacement_filter, - (void*)&replacement_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, INT_MAX, add_original_filter, + const_cast(&original_filter)); + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, INT_MAX, add_replacement_filter, + const_cast(&replacement_filter)); } static void destroy_plugin(void) {} diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc index d0521375e85..163a4f42776 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -128,7 +128,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler { GPR_ASSERT(output != nullptr); output->result = std::move(result); output->error = GRPC_ERROR_NONE; - gpr_event_set(&output->ev, (void*)1); + gpr_event_set(&output->ev, reinterpret_cast(1)); } void ReturnError(grpc_error* error) override { @@ -136,7 +136,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler { reinterpret_cast(gpr_atm_acq_load(&output_)); GPR_ASSERT(output != nullptr); output->error = error; - gpr_event_set(&output->ev, (void*)1); + gpr_event_set(&output->ev, reinterpret_cast(1)); } private: diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc index 2d5e37c9f3e..d10468a2092 100644 --- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc @@ -174,7 +174,7 @@ static void poll_pollset_until_request_done(iomgr_args* args) { gpr_mu_unlock(args->mu); grpc_core::ExecCtx::Get()->Flush(); } - gpr_event_set(&args->ev, (void*)1); + gpr_event_set(&args->ev, reinterpret_cast(1)); } struct OnResolutionCallbackArg; diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index f0316ba4385..c5cdf4b63e5 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -54,7 +54,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler { for (size_t i = 0; i < expected_.addresses.size(); ++i) { GPR_ASSERT(actual.addresses[i] == expected_.addresses[i]); } - gpr_event_set(ev_, (void*)1); + gpr_event_set(ev_, reinterpret_cast(1)); ev_ = nullptr; } diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc index 8cc0b619b18..cb5427fe837 100644 --- a/test/core/end2end/bad_server_response_test.cc +++ b/test/core/end2end/bad_server_response_test.cc @@ -93,7 +93,7 @@ static grpc_closure on_read; static grpc_closure on_writing_settings_frame; static grpc_closure on_write; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void done_write(void* /*arg*/, grpc_error* error) { GPR_ASSERT(error == GRPC_ERROR_NONE); @@ -286,7 +286,7 @@ static void actually_poll_server(void* arg) { } test_tcp_server_poll(pa->server, 1000); } - gpr_event_set(pa->signal_when_done, (void*)1); + gpr_event_set(pa->signal_when_done, reinterpret_cast(1)); gpr_free(pa); } diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc index 7df6f0ebd5e..59d7c69409b 100644 --- a/test/core/end2end/connection_refused_test.cc +++ b/test/core/end2end/connection_refused_test.cc @@ -33,7 +33,7 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -static void* tag(intptr_t i) { return (void*)i; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void run_test(bool wait_for_ready, bool use_service_config) { grpc_channel* chan; diff --git a/test/core/end2end/dualstack_socket_test.cc b/test/core/end2end/dualstack_socket_test.cc index 63b0ddaa92e..2b332dca30c 100644 --- a/test/core/end2end/dualstack_socket_test.cc +++ b/test/core/end2end/dualstack_socket_test.cc @@ -48,7 +48,7 @@ /* This test exercises IPv4, IPv6, and dualstack sockets in various ways. */ -static void* tag(intptr_t i) { return (void*)i; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index 8901ca6547e..3d55bffd814 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -33,7 +33,7 @@ bool leak_check = true; static void discard_write(grpc_slice /*slice*/) {} -static void* tag(int n) { return (void*)static_cast(n); } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void dont_log(gpr_log_func_args* /*args*/) {} diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index 377a1a99c19..1f1b40ed7d0 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -29,8 +29,7 @@ bool leak_check = true; static void discard_write(grpc_slice /*slice*/) {} -static void* tag(int n) { return (void*)static_cast(n); } -static int detag(void* p) { return static_cast((uintptr_t)p); } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void dont_log(gpr_log_func_args* /*args*/) {} @@ -84,12 +83,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { case GRPC_QUEUE_SHUTDOWN: break; case GRPC_OP_COMPLETE: - switch (detag(ev.tag)) { - case 1: - requested_calls--; - // TODO(ctiller): keep reading that call! - break; + if (ev.tag == tag(1)) { + requested_calls--; + // TODO(ctiller): keep reading that call! } + break; } } diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc index 6c76c243b21..d0ca2196e05 100644 --- a/test/core/end2end/goaway_server_test.cc +++ b/test/core/end2end/goaway_server_test.cc @@ -44,7 +44,7 @@ extern grpc_address_resolver_vtable* grpc_resolve_address_impl; static grpc_address_resolver_vtable* default_resolver; -static void* tag(intptr_t i) { return (void*)i; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static gpr_mu g_mu; static int g_resolve_port = -1; diff --git a/test/core/end2end/h2_ssl_session_reuse_test.cc b/test/core/end2end/h2_ssl_session_reuse_test.cc index a209d8f62f8..4aeac24395a 100644 --- a/test/core/end2end/h2_ssl_session_reuse_test.cc +++ b/test/core/end2end/h2_ssl_session_reuse_test.cc @@ -44,7 +44,7 @@ namespace grpc { namespace testing { namespace { -void* tag(intptr_t t) { return (void*)t; } +void* tag(intptr_t t) { return reinterpret_cast(t); } gpr_timespec five_seconds_time() { return grpc_timeout_seconds_to_deadline(5); } diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc index 7c2e961a298..10ca9fbe4d4 100644 --- a/test/core/end2end/invalid_call_argument_test.cc +++ b/test/core/end2end/invalid_call_argument_test.cc @@ -31,7 +31,7 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -static void* tag(intptr_t i) { return (void*)i; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } struct test_state { int is_client; diff --git a/test/core/end2end/no_server_test.cc b/test/core/end2end/no_server_test.cc index f5cf823f589..e69d92c640e 100644 --- a/test/core/end2end/no_server_test.cc +++ b/test/core/end2end/no_server_test.cc @@ -27,7 +27,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/util/test_config.h" -static void* tag(intptr_t i) { return (void*)i; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } void run_test(bool wait_for_ready) { gpr_log(GPR_INFO, "TEST: wait_for_ready=%d", wait_for_ready); diff --git a/test/core/end2end/tests/authority_not_supported.cc b/test/core/end2end/tests/authority_not_supported.cc index 01a95e4e10b..18cc6f5f120 100644 --- a/test/core/end2end/tests/authority_not_supported.cc +++ b/test/core/end2end/tests/authority_not_supported.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/bad_hostname.cc b/test/core/end2end/tests/bad_hostname.cc index b6f06a20d6a..33281ab88b5 100644 --- a/test/core/end2end/tests/bad_hostname.cc +++ b/test/core/end2end/tests/bad_hostname.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc index 12aff71e188..6d927ee490d 100644 --- a/test/core/end2end/tests/bad_ping.cc +++ b/test/core/end2end/tests/bad_ping.cc @@ -32,7 +32,7 @@ #define MAX_PING_STRIKES 2 -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; diff --git a/test/core/end2end/tests/binary_metadata.cc b/test/core/end2end/tests/binary_metadata.cc index cdf5b1eb94d..6bcaac5e83e 100644 --- a/test/core/end2end/tests/binary_metadata.cc +++ b/test/core/end2end/tests/binary_metadata.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/call_creds.cc b/test/core/end2end/tests/call_creds.cc index 83802a65ee5..e12c53207c8 100644 --- a/test/core/end2end/tests/call_creds.cc +++ b/test/core/end2end/tests/call_creds.cc @@ -38,7 +38,7 @@ static const char overridden_iam_selector[] = "overridden_selector"; typedef enum { NONE, OVERRIDE, DESTROY, FAIL } override_mode; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/call_host_override.cc b/test/core/end2end/tests/call_host_override.cc index b5b79fda705..2538999d493 100644 --- a/test/core/end2end/tests/call_host_override.cc +++ b/test/core/end2end/tests/call_host_override.cc @@ -31,7 +31,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc index 510bf3cee5f..d80f524e393 100644 --- a/test/core/end2end/tests/cancel_after_accept.cc +++ b/test/core/end2end/tests/cancel_after_accept.cc @@ -34,7 +34,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_after_client_done.cc b/test/core/end2end/tests/cancel_after_client_done.cc index 6e9378378ed..5ff9dd08abd 100644 --- a/test/core/end2end/tests/cancel_after_client_done.cc +++ b/test/core/end2end/tests/cancel_after_client_done.cc @@ -30,7 +30,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_after_invoke.cc b/test/core/end2end/tests/cancel_after_invoke.cc index 78009eb3bb3..2d58b99ca84 100644 --- a/test/core/end2end/tests/cancel_after_invoke.cc +++ b/test/core/end2end/tests/cancel_after_invoke.cc @@ -31,7 +31,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc index 609ac570d90..ea03daed8e5 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.cc +++ b/test/core/end2end/tests/cancel_after_round_trip.cc @@ -34,7 +34,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_before_invoke.cc b/test/core/end2end/tests/cancel_before_invoke.cc index abb2dbc8c3c..f118ffff80a 100644 --- a/test/core/end2end/tests/cancel_before_invoke.cc +++ b/test/core/end2end/tests/cancel_before_invoke.cc @@ -28,7 +28,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.cc b/test/core/end2end/tests/cancel_in_a_vacuum.cc index 4672e64a4e1..4b530f18686 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.cc +++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc @@ -30,7 +30,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc index 2d6ad771fcc..588463871b0 100644 --- a/test/core/end2end/tests/cancel_with_status.cc +++ b/test/core/end2end/tests/cancel_with_status.cc @@ -31,7 +31,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/channelz.cc b/test/core/end2end/tests/channelz.cc index 1be992dc0e8..20618736e72 100644 --- a/test/core/end2end/tests/channelz.cc +++ b/test/core/end2end/tests/channelz.cc @@ -33,7 +33,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/client_streaming.cc b/test/core/end2end/tests/client_streaming.cc index e3f8868ed16..f9cfaff7115 100644 --- a/test/core/end2end/tests/client_streaming.cc +++ b/test/core/end2end/tests/client_streaming.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc index c703449282f..05ffb500a46 100644 --- a/test/core/end2end/tests/compressed_payload.cc +++ b/test/core/end2end/tests/compressed_payload.cc @@ -39,7 +39,7 @@ #include "src/core/lib/transport/static_metadata.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/connectivity.cc b/test/core/end2end/tests/connectivity.cc index 70b3c852140..208672e261f 100644 --- a/test/core/end2end/tests/connectivity.cc +++ b/test/core/end2end/tests/connectivity.cc @@ -25,7 +25,7 @@ #include "src/core/lib/gprpp/thd.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } typedef struct { gpr_event started; @@ -47,7 +47,7 @@ struct CallbackContext { static void child_thread(void* arg) { child_events* ce = static_cast(arg); grpc_event ev; - gpr_event_set(&ce->started, (void*)1); + gpr_event_set(&ce->started, reinterpret_cast(1)); gpr_log(GPR_DEBUG, "verifying"); ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); @@ -183,7 +183,7 @@ static void cb_watch_connectivity( /* callback must not have errors */ GPR_ASSERT(success != 0); - gpr_event_set(&cb_ctx->finished, (void*)1); + gpr_event_set(&cb_ctx->finished, reinterpret_cast(1)); } static void cb_shutdown(grpc_experimental_completion_queue_functor* functor, @@ -191,7 +191,7 @@ static void cb_shutdown(grpc_experimental_completion_queue_functor* functor, CallbackContext* cb_ctx = reinterpret_cast(functor); gpr_log(GPR_DEBUG, "cb_shutdown called, nothing to do"); - gpr_event_set(&cb_ctx->finished, (void*)1); + gpr_event_set(&cb_ctx->finished, reinterpret_cast(1)); } static void test_watch_connectivity_cq_callback( diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc index ec2baef4c96..3527073afc4 100644 --- a/test/core/end2end/tests/default_host.cc +++ b/test/core/end2end/tests/default_host.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/disappearing_server.cc b/test/core/end2end/tests/disappearing_server.cc index b281d44003d..e8fa4e4fec4 100644 --- a/test/core/end2end/tests/disappearing_server.cc +++ b/test/core/end2end/tests/disappearing_server.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static gpr_timespec n_seconds_from_now(int n) { return grpc_timeout_seconds_to_deadline(n); diff --git a/test/core/end2end/tests/empty_batch.cc b/test/core/end2end/tests/empty_batch.cc index 1144ebf1759..7325616f3fe 100644 --- a/test/core/end2end/tests/empty_batch.cc +++ b/test/core/end2end/tests/empty_batch.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/filter_causes_close.cc b/test/core/end2end/tests/filter_causes_close.cc index 7f99b9219e2..fb1af999699 100644 --- a/test/core/end2end/tests/filter_causes_close.cc +++ b/test/core/end2end/tests/filter_causes_close.cc @@ -32,7 +32,7 @@ static bool g_enable_filter = false; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/filter_context.cc b/test/core/end2end/tests/filter_context.cc index 0c418748334..5b02e067d08 100644 --- a/test/core/end2end/tests/filter_context.cc +++ b/test/core/end2end/tests/filter_context.cc @@ -36,7 +36,7 @@ enum { TIMEOUT = 200000 }; static bool g_enable_filter = false; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, @@ -295,14 +295,18 @@ static bool maybe_add_filter(grpc_channel_stack_builder* builder, void* arg) { } static void init_plugin(void) { - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, - maybe_add_filter, (void*)&test_filter); - grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, - maybe_add_filter, (void*)&test_filter); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, - maybe_add_filter, (void*)&test_filter); - grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, - maybe_add_filter, (void*)&test_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_filter)); + grpc_channel_init_register_stage( + GRPC_CLIENT_SUBCHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_filter)); + grpc_channel_init_register_stage( + GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_filter)); + grpc_channel_init_register_stage( + GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_filter)); } static void destroy_plugin(void) {} diff --git a/test/core/end2end/tests/filter_init_fails.cc b/test/core/end2end/tests/filter_init_fails.cc index 4c9b16155a8..2ac21cf0035 100644 --- a/test/core/end2end/tests/filter_init_fails.cc +++ b/test/core/end2end/tests/filter_init_fails.cc @@ -38,7 +38,7 @@ static bool g_enable_client_channel_filter = false; static bool g_enable_client_subchannel_filter = false; static bool g_channel_filter_init_failure = false; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc index b0992b1aa8e..1a8091e86ed 100644 --- a/test/core/end2end/tests/filter_latency.cc +++ b/test/core/end2end/tests/filter_latency.cc @@ -39,7 +39,7 @@ static gpr_mu g_mu; static gpr_timespec g_client_latency; static gpr_timespec g_server_latency; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, @@ -326,15 +326,15 @@ static bool maybe_add_filter(grpc_channel_stack_builder* builder, void* arg) { static void init_plugin(void) { gpr_mu_init(&g_mu); - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, - maybe_add_filter, - (void*)&test_client_filter); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, - maybe_add_filter, - (void*)&test_client_filter); - grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, - maybe_add_filter, - (void*)&test_server_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_client_filter)); + grpc_channel_init_register_stage( + GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_client_filter)); + grpc_channel_init_register_stage( + GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_server_filter)); } static void destroy_plugin(void) { gpr_mu_destroy(&g_mu); } diff --git a/test/core/end2end/tests/filter_status_code.cc b/test/core/end2end/tests/filter_status_code.cc index 3fc47acc681..061166fa111 100644 --- a/test/core/end2end/tests/filter_status_code.cc +++ b/test/core/end2end/tests/filter_status_code.cc @@ -52,7 +52,7 @@ static gpr_cv g_server_code_cv; static grpc_status_code g_client_status_code; static grpc_status_code g_server_status_code; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, @@ -376,15 +376,15 @@ static void init_plugin(void) { g_client_code_recv = false; g_server_code_recv = false; - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, - maybe_add_filter, - (void*)&test_client_filter); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, - maybe_add_filter, - (void*)&test_client_filter); - grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, - maybe_add_filter, - (void*)&test_server_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_client_filter)); + grpc_channel_init_register_stage( + GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_client_filter)); + grpc_channel_init_register_stage( + GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_filter, + const_cast(&test_server_filter)); } static void destroy_plugin(void) { diff --git a/test/core/end2end/tests/graceful_server_shutdown.cc b/test/core/end2end/tests/graceful_server_shutdown.cc index 376b00bca24..93561bf5c3d 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.cc +++ b/test/core/end2end/tests/graceful_server_shutdown.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/high_initial_seqno.cc b/test/core/end2end/tests/high_initial_seqno.cc index 30ccc83dfbc..55005947499 100644 --- a/test/core/end2end/tests/high_initial_seqno.cc +++ b/test/core/end2end/tests/high_initial_seqno.cc @@ -34,7 +34,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/hpack_size.cc b/test/core/end2end/tests/hpack_size.cc index 8dfb9ebdd68..a9be0144fac 100644 --- a/test/core/end2end/tests/hpack_size.cc +++ b/test/core/end2end/tests/hpack_size.cc @@ -35,7 +35,7 @@ #include "src/core/lib/gpr/useful.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } const char* hobbits[][2] = { {"Adaldrida", "Brandybuck"}, {"Adamanta", "Took"}, diff --git a/test/core/end2end/tests/idempotent_request.cc b/test/core/end2end/tests/idempotent_request.cc index f91375c0ca6..294b94c70d2 100644 --- a/test/core/end2end/tests/idempotent_request.cc +++ b/test/core/end2end/tests/idempotent_request.cc @@ -30,7 +30,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/invoke_large_request.cc b/test/core/end2end/tests/invoke_large_request.cc index 2ac09a36d93..987125f622d 100644 --- a/test/core/end2end/tests/invoke_large_request.cc +++ b/test/core/end2end/tests/invoke_large_request.cc @@ -33,7 +33,7 @@ #include "src/core/lib/gpr/useful.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/keepalive_timeout.cc b/test/core/end2end/tests/keepalive_timeout.cc index 1750f6fe5ee..a1aacd024bd 100644 --- a/test/core/end2end/tests/keepalive_timeout.cc +++ b/test/core/end2end/tests/keepalive_timeout.cc @@ -37,7 +37,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #endif // GRPC_POSIX_SOCKET -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/large_metadata.cc b/test/core/end2end/tests/large_metadata.cc index fb1fe412566..07983d8eb96 100644 --- a/test/core/end2end/tests/large_metadata.cc +++ b/test/core/end2end/tests/large_metadata.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/max_concurrent_streams.cc b/test/core/end2end/tests/max_concurrent_streams.cc index 90f2f5a065d..2b392b0e432 100644 --- a/test/core/end2end/tests/max_concurrent_streams.cc +++ b/test/core/end2end/tests/max_concurrent_streams.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc index a8979f0a5cf..63b804294d8 100644 --- a/test/core/end2end/tests/max_connection_age.cc +++ b/test/core/end2end/tests/max_connection_age.cc @@ -45,7 +45,7 @@ /* The grace period for the test to observe the channel shutdown process */ #define IMMEDIATE_SHUTDOWN_GRACE_TIME_MS 3000 -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; diff --git a/test/core/end2end/tests/max_connection_idle.cc b/test/core/end2end/tests/max_connection_idle.cc index 53701ab6137..6df32f4b376 100644 --- a/test/core/end2end/tests/max_connection_idle.cc +++ b/test/core/end2end/tests/max_connection_idle.cc @@ -32,7 +32,7 @@ #define MAX_CONNECTION_IDLE_MS 500 #define MAX_CONNECTION_AGE_MS 9999 -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc index 256cc982940..ca9f8605282 100644 --- a/test/core/end2end/tests/max_message_length.cc +++ b/test/core/end2end/tests/max_message_length.cc @@ -34,7 +34,7 @@ #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/negative_deadline.cc b/test/core/end2end/tests/negative_deadline.cc index 464267c92f1..e975f371db8 100644 --- a/test/core/end2end/tests/negative_deadline.cc +++ b/test/core/end2end/tests/negative_deadline.cc @@ -30,7 +30,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/no_error_on_hotpath.cc b/test/core/end2end/tests/no_error_on_hotpath.cc index 7affd5ba6f6..411ed93e5d1 100644 --- a/test/core/end2end/tests/no_error_on_hotpath.cc +++ b/test/core/end2end/tests/no_error_on_hotpath.cc @@ -31,7 +31,7 @@ #include "src/core/lib/iomgr/error.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/no_logging.cc b/test/core/end2end/tests/no_logging.cc index 8341501af2a..e55b343b6ab 100644 --- a/test/core/end2end/tests/no_logging.cc +++ b/test/core/end2end/tests/no_logging.cc @@ -36,7 +36,7 @@ enum { TIMEOUT = 200000 }; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } void gpr_default_log(gpr_log_func_args* args); diff --git a/test/core/end2end/tests/no_op.cc b/test/core/end2end/tests/no_op.cc index 020f8422192..2c515f10c22 100644 --- a/test/core/end2end/tests/no_op.cc +++ b/test/core/end2end/tests/no_op.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/payload.cc b/test/core/end2end/tests/payload.cc index 6e2bc1690b6..fab5daf837d 100644 --- a/test/core/end2end/tests/payload.cc +++ b/test/core/end2end/tests/payload.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/ping.cc b/test/core/end2end/tests/ping.cc index 0a979626155..28bef18c026 100644 --- a/test/core/end2end/tests/ping.cc +++ b/test/core/end2end/tests/ping.cc @@ -29,7 +29,7 @@ #define PING_NUM 5 -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static void test_ping(grpc_end2end_test_config config, int min_time_between_pings_ms) { diff --git a/test/core/end2end/tests/ping_pong_streaming.cc b/test/core/end2end/tests/ping_pong_streaming.cc index 30ee0bf8b82..4e030e015c1 100644 --- a/test/core/end2end/tests/ping_pong_streaming.cc +++ b/test/core/end2end/tests/ping_pong_streaming.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/proxy_auth.cc b/test/core/end2end/tests/proxy_auth.cc index 3f1443f5b56..3684b27a099 100644 --- a/test/core/end2end/tests/proxy_auth.cc +++ b/test/core/end2end/tests/proxy_auth.cc @@ -34,7 +34,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/registered_call.cc b/test/core/end2end/tests/registered_call.cc index 6228476e5e9..719758ea1fc 100644 --- a/test/core/end2end/tests/registered_call.cc +++ b/test/core/end2end/tests/registered_call.cc @@ -30,7 +30,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/request_with_flags.cc b/test/core/end2end/tests/request_with_flags.cc index f3baf3790fb..348e0b66a6a 100644 --- a/test/core/end2end/tests/request_with_flags.cc +++ b/test/core/end2end/tests/request_with_flags.cc @@ -30,7 +30,7 @@ #include "src/core/lib/transport/byte_stream.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/request_with_payload.cc b/test/core/end2end/tests/request_with_payload.cc index 37d9481f282..404c3bf6d7d 100644 --- a/test/core/end2end/tests/request_with_payload.cc +++ b/test/core/end2end/tests/request_with_payload.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc index df83caa6625..32d6ca7b65b 100644 --- a/test/core/end2end/tests/resource_quota_server.cc +++ b/test/core/end2end/tests/resource_quota_server.cc @@ -28,7 +28,7 @@ #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry.cc b/test/core/end2end/tests/retry.cc index 51e77ecda29..5e9f8aa52da 100644 --- a/test/core/end2end/tests/retry.cc +++ b/test/core/end2end/tests/retry.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_cancellation.cc b/test/core/end2end/tests/retry_cancellation.cc index 751f2a03445..261e962c369 100644 --- a/test/core/end2end/tests/retry_cancellation.cc +++ b/test/core/end2end/tests/retry_cancellation.cc @@ -40,7 +40,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_disabled.cc b/test/core/end2end/tests/retry_disabled.cc index 2ccff138d70..3cdc0452c70 100644 --- a/test/core/end2end/tests/retry_disabled.cc +++ b/test/core/end2end/tests/retry_disabled.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc b/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc index 3fa250efae6..4d5f6914c82 100644 --- a/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc +++ b/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc b/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc index 38d787b77c7..1c99f4c31ba 100644 --- a/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc +++ b/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_non_retriable_status.cc b/test/core/end2end/tests/retry_non_retriable_status.cc index 26bb4318edf..51247138bef 100644 --- a/test/core/end2end/tests/retry_non_retriable_status.cc +++ b/test/core/end2end/tests/retry_non_retriable_status.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc b/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc index 17a1a0de3a6..5bdada8a1f6 100644 --- a/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc +++ b/test/core/end2end/tests/retry_non_retriable_status_before_recv_trailing_metadata_started.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_recv_initial_metadata.cc b/test/core/end2end/tests/retry_recv_initial_metadata.cc index 222f9912d0f..eae84eee257 100644 --- a/test/core/end2end/tests/retry_recv_initial_metadata.cc +++ b/test/core/end2end/tests/retry_recv_initial_metadata.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_recv_message.cc b/test/core/end2end/tests/retry_recv_message.cc index 75e82072d24..f720591f926 100644 --- a/test/core/end2end/tests/retry_recv_message.cc +++ b/test/core/end2end/tests/retry_recv_message.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_server_pushback_delay.cc b/test/core/end2end/tests/retry_server_pushback_delay.cc index d08c6c34dae..122eb494dc8 100644 --- a/test/core/end2end/tests/retry_server_pushback_delay.cc +++ b/test/core/end2end/tests/retry_server_pushback_delay.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_server_pushback_disabled.cc b/test/core/end2end/tests/retry_server_pushback_disabled.cc index cbd55928d75..44a37a42195 100644 --- a/test/core/end2end/tests/retry_server_pushback_disabled.cc +++ b/test/core/end2end/tests/retry_server_pushback_disabled.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_streaming.cc b/test/core/end2end/tests/retry_streaming.cc index 3a8fe5d6355..25219102b80 100644 --- a/test/core/end2end/tests/retry_streaming.cc +++ b/test/core/end2end/tests/retry_streaming.cc @@ -40,7 +40,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_streaming_after_commit.cc b/test/core/end2end/tests/retry_streaming_after_commit.cc index bb60a612331..de7d7c3d372 100644 --- a/test/core/end2end/tests/retry_streaming_after_commit.cc +++ b/test/core/end2end/tests/retry_streaming_after_commit.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc b/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc index 8bbf9b6f800..866c948161d 100644 --- a/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc +++ b/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_throttled.cc b/test/core/end2end/tests/retry_throttled.cc index af12ae9dd46..9fdca88ec2f 100644 --- a/test/core/end2end/tests/retry_throttled.cc +++ b/test/core/end2end/tests/retry_throttled.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/retry_too_many_attempts.cc b/test/core/end2end/tests/retry_too_many_attempts.cc index 2432b4c984b..2a8301fd2ee 100644 --- a/test/core/end2end/tests/retry_too_many_attempts.cc +++ b/test/core/end2end/tests/retry_too_many_attempts.cc @@ -37,7 +37,7 @@ #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/tests/cancel_test_helpers.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/server_finishes_request.cc b/test/core/end2end/tests/server_finishes_request.cc index dc489a4c7fb..859fa61ca80 100644 --- a/test/core/end2end/tests/server_finishes_request.cc +++ b/test/core/end2end/tests/server_finishes_request.cc @@ -29,7 +29,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/server_streaming.cc b/test/core/end2end/tests/server_streaming.cc index ece86f80951..f457e650647 100644 --- a/test/core/end2end/tests/server_streaming.cc +++ b/test/core/end2end/tests/server_streaming.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc index 60b738ef9ef..443c3cef604 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.cc +++ b/test/core/end2end/tests/shutdown_finishes_calls.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/shutdown_finishes_tags.cc b/test/core/end2end/tests/shutdown_finishes_tags.cc index 55caacb7ff9..4ddba41080e 100644 --- a/test/core/end2end/tests/shutdown_finishes_tags.cc +++ b/test/core/end2end/tests/shutdown_finishes_tags.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/simple_cacheable_request.cc b/test/core/end2end/tests/simple_cacheable_request.cc index be6d16ecad7..25a09a765fc 100644 --- a/test/core/end2end/tests/simple_cacheable_request.cc +++ b/test/core/end2end/tests/simple_cacheable_request.cc @@ -29,7 +29,7 @@ enum { TIMEOUT = 200000 }; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/simple_delayed_request.cc b/test/core/end2end/tests/simple_delayed_request.cc index 4b2b7ce77fc..947e3976f87 100644 --- a/test/core/end2end/tests/simple_delayed_request.cc +++ b/test/core/end2end/tests/simple_delayed_request.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static gpr_timespec n_seconds_from_now(int n) { return grpc_timeout_seconds_to_deadline(n); diff --git a/test/core/end2end/tests/simple_metadata.cc b/test/core/end2end/tests/simple_metadata.cc index 3e476c2129d..9e1a18b7af7 100644 --- a/test/core/end2end/tests/simple_metadata.cc +++ b/test/core/end2end/tests/simple_metadata.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index afeb43df057..c9782a1c967 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -32,7 +32,7 @@ #include "src/core/lib/gpr/string.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, @@ -228,7 +228,7 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(was_cancelled == 0); grpc_slice_unref(details); - gpr_free((void*)error_string); + gpr_free(const_cast(error_string)); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc index 8fa7af50567..3bb481af587 100644 --- a/test/core/end2end/tests/stream_compression_compressed_payload.cc +++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc @@ -39,7 +39,7 @@ #include "src/core/lib/transport/static_metadata.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc index b67566e91bc..cf29185f8ff 100644 --- a/test/core/end2end/tests/stream_compression_payload.cc +++ b/test/core/end2end/tests/stream_compression_payload.cc @@ -31,7 +31,7 @@ #include "src/core/lib/surface/call.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc index 39698bde442..36c6cd28a66 100644 --- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc @@ -32,7 +32,7 @@ #include "src/core/lib/surface/call.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/streaming_error_response.cc b/test/core/end2end/tests/streaming_error_response.cc index 0502bba15cb..df0c7784736 100644 --- a/test/core/end2end/tests/streaming_error_response.cc +++ b/test/core/end2end/tests/streaming_error_response.cc @@ -30,7 +30,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/trailing_metadata.cc b/test/core/end2end/tests/trailing_metadata.cc index 5cf6f2bb115..1201729909d 100644 --- a/test/core/end2end/tests/trailing_metadata.cc +++ b/test/core/end2end/tests/trailing_metadata.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc index 5ffb477aebc..69b33ebcf15 100644 --- a/test/core/end2end/tests/workaround_cronet_compression.cc +++ b/test/core/end2end/tests/workaround_cronet_compression.cc @@ -36,7 +36,7 @@ #include "src/core/lib/transport/static_metadata.h" #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/write_buffering.cc b/test/core/end2end/tests/write_buffering.cc index 2f7ee9c8926..2f1b297309b 100644 --- a/test/core/end2end/tests/write_buffering.cc +++ b/test/core/end2end/tests/write_buffering.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/end2end/tests/write_buffering_at_end.cc b/test/core/end2end/tests/write_buffering_at_end.cc index 886d491a10f..55c208f346b 100644 --- a/test/core/end2end/tests/write_buffering_at_end.cc +++ b/test/core/end2end/tests/write_buffering_at_end.cc @@ -27,7 +27,7 @@ #include #include "test/core/end2end/cq_verifier.h" -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char* test_name, diff --git a/test/core/fling/client.cc b/test/core/fling/client.cc index 2a7a5ca6232..c9db1951a7c 100644 --- a/test/core/fling/client.cc +++ b/test/core/fling/client.cc @@ -104,7 +104,8 @@ static void init_ping_pong_stream(void) { stream_init_ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; stream_init_ops[1].data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; - error = grpc_call_start_batch(call, stream_init_ops, 2, (void*)1, nullptr); + error = grpc_call_start_batch(call, stream_init_ops, 2, + reinterpret_cast(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); @@ -119,7 +120,8 @@ static void init_ping_pong_stream(void) { static void step_ping_pong_stream(void) { GPR_TIMER_SCOPE("ping_pong", 1); grpc_call_error error; - error = grpc_call_start_batch(call, stream_step_ops, 2, (void*)1, nullptr); + error = grpc_call_start_batch(call, stream_step_ops, 2, + reinterpret_cast(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_byte_buffer_destroy(response_payload_recv); diff --git a/test/core/fling/server.cc b/test/core/fling/server.cc index 4085e28ed22..5832ca9aca7 100644 --- a/test/core/fling/server.cc +++ b/test/core/fling/server.cc @@ -59,7 +59,7 @@ static int was_cancelled = 2; static grpc_op unary_ops[6]; static int got_sigint = 0; -static void* tag(intptr_t t) { return (void*)t; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } typedef enum { FLING_SERVER_NEW_REQUEST = 1, diff --git a/test/core/gpr/arena_test.cc b/test/core/gpr/arena_test.cc index c7aa63ab2e9..64bd0589897 100644 --- a/test/core/gpr/arena_test.cc +++ b/test/core/gpr/arena_test.cc @@ -106,7 +106,7 @@ static void concurrent_test(void) { thds[i].Start(); } - gpr_event_set(&args.ev_start, (void*)1); + gpr_event_set(&args.ev_start, reinterpret_cast(1)); for (auto& th : thds) { th.Join(); diff --git a/test/core/gpr/sync_test.cc b/test/core/gpr/sync_test.cc index fc7216e3601..ae0025f25bc 100644 --- a/test/core/gpr/sync_test.cc +++ b/test/core/gpr/sync_test.cc @@ -431,7 +431,7 @@ static void refinc(void* v /*=m*/) { } } if (gpr_unref(&m->thread_refcount)) { - gpr_event_set(&m->event, (void*)1); + gpr_event_set(&m->event, reinterpret_cast(1)); } mark_thread_done(m); } diff --git a/test/core/gprpp/fork_test.cc b/test/core/gprpp/fork_test.cc index 93dcf119ca5..3f2ce5915ce 100644 --- a/test/core/gprpp/fork_test.cc +++ b/test/core/gprpp/fork_test.cc @@ -74,8 +74,8 @@ static void test_thd_count() { for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) { intptr_t sleep_time_ms = (i * THREAD_DELAY_MS) / (CONCURRENT_TEST_THREADS - 1); - thds[i] = - grpc_core::Thread("grpc_fork_test", sleeping_thd, (void*)sleep_time_ms); + thds[i] = grpc_core::Thread("grpc_fork_test", sleeping_thd, + reinterpret_cast(sleep_time_ms)); thds[i].Start(); } grpc_core::Fork::AwaitThreads(); diff --git a/test/core/gprpp/mpscq_test.cc b/test/core/gprpp/mpscq_test.cc index 2c1760f58a0..406679425b0 100644 --- a/test/core/gprpp/mpscq_test.cc +++ b/test/core/gprpp/mpscq_test.cc @@ -90,7 +90,7 @@ static void test_mt(void) { } size_t num_done = 0; size_t spins = 0; - gpr_event_set(&start, (void*)1); + gpr_event_set(&start, reinterpret_cast(1)); while (num_done != GPR_ARRAY_SIZE(thds)) { MultiProducerSingleConsumerQueue::Node* n; while ((n = q.Pop()) == nullptr) { @@ -168,7 +168,7 @@ static void test_mt_multipop(void) { pull_thds[i] = grpc_core::Thread("grpc_multipop_pull", pull_thread, &pa); pull_thds[i].Start(); } - gpr_event_set(&start, (void*)1); + gpr_event_set(&start, reinterpret_cast(1)); for (auto& pth : pull_thds) { pth.Join(); } diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc index 1554a0909cd..fa0a23df59c 100644 --- a/test/core/iomgr/combiner_test.cc +++ b/test/core/iomgr/combiner_test.cc @@ -33,7 +33,7 @@ static void test_no_op(void) { } static void set_event_to_true(void* value, grpc_error* /*error*/) { - gpr_event_set(static_cast(value), (void*)1); + gpr_event_set(static_cast(value), reinterpret_cast(1)); } static void test_execute_one(void) { @@ -115,7 +115,7 @@ static void test_execute_many(void) { static gpr_event got_in_finally; static void in_finally(void* /*arg*/, grpc_error* /*error*/) { - gpr_event_set(&got_in_finally, (void*)1); + gpr_event_set(&got_in_finally, reinterpret_cast(1)); } static void add_finally(void* arg, grpc_error* /*error*/) { diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc index 8769e3b4053..1a60e58c389 100644 --- a/test/core/iomgr/resolve_address_posix_test.cc +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -109,7 +109,7 @@ static void actually_poll(void* argsp) { gpr_mu_unlock(args->mu); grpc_core::ExecCtx::Get()->Flush(); } - gpr_event_set(&args->ev, (void*)1); + gpr_event_set(&args->ev, reinterpret_cast(1)); } static void poll_pollset_until_request_done(args_struct* args) { diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index ca7c914f51b..62496204c3e 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -101,7 +101,7 @@ static void poll_pollset_until_request_done(args_struct* args) { gpr_mu_unlock(args->mu); grpc_core::ExecCtx::Get()->Flush(); } - gpr_event_set(&args->ev, (void*)1); + gpr_event_set(&args->ev, reinterpret_cast(1)); } static void must_succeed(void* argsp, grpc_error* err) { diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc index d5d86a37e7a..7f516b77a43 100644 --- a/test/core/iomgr/resource_quota_test.cc +++ b/test/core/iomgr/resource_quota_test.cc @@ -45,7 +45,7 @@ static void assert_counter_becomes(int* ctr, int value) { } static void set_event_cb(void* a, grpc_error* /*error*/) { - gpr_event_set(static_cast(a), (void*)1); + gpr_event_set(static_cast(a), reinterpret_cast(1)); } grpc_closure* set_event(gpr_event* ev) { return GRPC_CLOSURE_CREATE(set_event_cb, ev, grpc_schedule_on_exec_ctx); diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc index 6d6766b80ea..3d995eedc11 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -448,7 +448,7 @@ static void write_test(size_t num_bytes, size_t slice_size, gpr_atm_rel_store(&done_timestamps, static_cast(0)); grpc_endpoint_write(ep, &outgoing, &write_done_closure, grpc_event_engine_can_track_errors() && collect_timestamps - ? (void*)&done_timestamps + ? &done_timestamps : nullptr); drain_socket_blocking(sv[0], num_bytes, num_bytes); exec_ctx.Flush(); diff --git a/test/core/iomgr/work_serializer_test.cc b/test/core/iomgr/work_serializer_test.cc index fa8ef54f439..bbc9e3f74ab 100644 --- a/test/core/iomgr/work_serializer_test.cc +++ b/test/core/iomgr/work_serializer_test.cc @@ -38,7 +38,8 @@ TEST(WorkSerializerTest, ExecuteOne) { grpc_core::WorkSerializer lock; gpr_event done; gpr_event_init(&done); - lock.Run([&done]() { gpr_event_set(&done, (void*)1); }, DEBUG_LOCATION); + lock.Run([&done]() { gpr_event_set(&done, reinterpret_cast(1)); }, + DEBUG_LOCATION); EXPECT_TRUE(gpr_event_wait(&done, grpc_timeout_seconds_to_deadline(5)) != nullptr); } @@ -81,8 +82,9 @@ class TestThread { // sleep for a little bit, to test other threads picking up the load gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); } - self->lock_->Run([self]() { gpr_event_set(&self->done_, (void*)1); }, - DEBUG_LOCATION); + self->lock_->Run( + [self]() { gpr_event_set(&self->done_, reinterpret_cast(1)); }, + DEBUG_LOCATION); } grpc_core::WorkSerializer* lock_ = nullptr; diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index a60d874b6eb..71178cb657d 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -382,7 +382,8 @@ static void test_jwt_verifier_google_email_issuer_success(void) { grpc_auth_json_key_destruct(&key); GPR_ASSERT(jwt != nullptr); grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, - on_verification_success, (void*)expected_user_data); + on_verification_success, + const_cast(expected_user_data)); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); gpr_free(jwt); @@ -415,7 +416,8 @@ static void test_jwt_verifier_custom_email_issuer_success(void) { grpc_auth_json_key_destruct(&key); GPR_ASSERT(jwt != nullptr); grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, - on_verification_success, (void*)expected_user_data); + on_verification_success, + const_cast(expected_user_data)); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); gpr_free(jwt); @@ -462,7 +464,8 @@ static void test_jwt_verifier_url_issuer_success(void) { grpc_auth_json_key_destruct(&key); GPR_ASSERT(jwt != nullptr); grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, - on_verification_success, (void*)expected_user_data); + on_verification_success, + const_cast(expected_user_data)); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); gpr_free(jwt); @@ -502,7 +505,7 @@ static void test_jwt_verifier_url_issuer_bad_config(void) { GPR_ASSERT(jwt != nullptr); grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, on_verification_key_retrieval_error, - (void*)expected_user_data); + const_cast(expected_user_data)); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); gpr_free(jwt); @@ -525,7 +528,7 @@ static void test_jwt_verifier_bad_json_key(void) { GPR_ASSERT(jwt != nullptr); grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, on_verification_key_retrieval_error, - (void*)expected_user_data); + const_cast(expected_user_data)); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); gpr_free(jwt); @@ -577,7 +580,7 @@ static void test_jwt_verifier_bad_signature(void) { GPR_ASSERT(jwt != nullptr); grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, on_verification_bad_signature, - (void*)expected_user_data); + const_cast(expected_user_data)); gpr_free(jwt); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); @@ -606,7 +609,7 @@ static void test_jwt_verifier_bad_format(void) { httpcli_post_should_not_be_called); grpc_jwt_verifier_verify(verifier, nullptr, "bad jwt", expected_audience, on_verification_bad_format, - (void*)expected_user_data); + const_cast(expected_user_data)); grpc_jwt_verifier_destroy(verifier); grpc_core::ExecCtx::Get()->Flush(); grpc_httpcli_set_override(nullptr, nullptr); diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc index 3d8304bc986..22079f88ae8 100644 --- a/test/core/surface/completion_queue_test.cc +++ b/test/core/surface/completion_queue_test.cc @@ -31,7 +31,7 @@ static void* create_test_tag(void) { static intptr_t i = 0; - return (void*)(++i); + return reinterpret_cast(++i); } /* helper for tests to shutdown correctly and tersely */ diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc index e68d21beefc..a466cd22d8c 100644 --- a/test/core/surface/completion_queue_threading_test.cc +++ b/test/core/surface/completion_queue_threading_test.cc @@ -31,7 +31,7 @@ static void* create_test_tag(void) { static intptr_t i = 0; - return (void*)(++i); + return reinterpret_cast(++i); } /* helper for tests to shutdown correctly and tersely */ @@ -146,7 +146,7 @@ static void producer_thread(void* arg) { int i; gpr_log(GPR_INFO, "producer %d started", opt->id); - gpr_event_set(&opt->on_started, (void*)static_cast(1)); + gpr_event_set(&opt->on_started, reinterpret_cast(1)); GPR_ASSERT(gpr_event_wait(opt->phase1, ten_seconds_time())); gpr_log(GPR_INFO, "producer %d phase 1", opt->id); @@ -155,13 +155,13 @@ static void producer_thread(void* arg) { } gpr_log(GPR_INFO, "producer %d phase 1 done", opt->id); - gpr_event_set(&opt->on_phase1_done, (void*)static_cast(1)); + gpr_event_set(&opt->on_phase1_done, reinterpret_cast(1)); GPR_ASSERT(gpr_event_wait(opt->phase2, ten_seconds_time())); gpr_log(GPR_INFO, "producer %d phase 2", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { grpc_core::ExecCtx exec_ctx; - grpc_cq_end_op(opt->cc, (void*)static_cast(1), GRPC_ERROR_NONE, + grpc_cq_end_op(opt->cc, reinterpret_cast(1), GRPC_ERROR_NONE, free_completion, nullptr, static_cast( gpr_malloc(sizeof(grpc_cq_completion)))); @@ -169,7 +169,7 @@ static void producer_thread(void* arg) { } gpr_log(GPR_INFO, "producer %d phase 2 done", opt->id); - gpr_event_set(&opt->on_finished, (void*)static_cast(1)); + gpr_event_set(&opt->on_finished, reinterpret_cast(1)); } static void consumer_thread(void* arg) { @@ -177,13 +177,13 @@ static void consumer_thread(void* arg) { grpc_event ev; gpr_log(GPR_INFO, "consumer %d started", opt->id); - gpr_event_set(&opt->on_started, (void*)static_cast(1)); + gpr_event_set(&opt->on_started, reinterpret_cast(1)); GPR_ASSERT(gpr_event_wait(opt->phase1, ten_seconds_time())); gpr_log(GPR_INFO, "consumer %d phase 1", opt->id); gpr_log(GPR_INFO, "consumer %d phase 1 done", opt->id); - gpr_event_set(&opt->on_phase1_done, (void*)static_cast(1)); + gpr_event_set(&opt->on_phase1_done, reinterpret_cast(1)); GPR_ASSERT(gpr_event_wait(opt->phase2, ten_seconds_time())); gpr_log(GPR_INFO, "consumer %d phase 2", opt->id); @@ -197,7 +197,7 @@ static void consumer_thread(void* arg) { break; case GRPC_QUEUE_SHUTDOWN: gpr_log(GPR_INFO, "consumer %d phase 2 done", opt->id); - gpr_event_set(&opt->on_finished, (void*)static_cast(1)); + gpr_event_set(&opt->on_finished, reinterpret_cast(1)); return; case GRPC_QUEUE_TIMEOUT: gpr_log(GPR_ERROR, "Invalid timeout received"); @@ -244,7 +244,7 @@ static void test_threading(size_t producers, size_t consumers) { /* start phase1: producers will pre-declare all operations they will complete */ gpr_log(GPR_INFO, "start phase 1"); - gpr_event_set(&phase1, (void*)static_cast(1)); + gpr_event_set(&phase1, reinterpret_cast(1)); gpr_log(GPR_INFO, "wait phase 1"); for (i = 0; i < producers + consumers; i++) { @@ -254,7 +254,7 @@ static void test_threading(size_t producers, size_t consumers) { /* start phase2: operations will complete, and consumers will consume them */ gpr_log(GPR_INFO, "start phase 2"); - gpr_event_set(&phase2, (void*)static_cast(1)); + gpr_event_set(&phase2, reinterpret_cast(1)); /* in parallel, we shutdown the completion channel - all events should still be consumed */ diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc index b317758b355..f2edbc86a0b 100644 --- a/test/core/surface/concurrent_connectivity_test.cc +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -66,8 +66,7 @@ // it should never take longer that this to shutdown the server #define SERVER_SHUTDOWN_TIMEOUT 30000 -static void* tag(int n) { return (void*)static_cast(n); } -static int detag(void* p) { return static_cast((uintptr_t)p); } +static void* tag(int n) { return reinterpret_cast(n); } void create_loop_destroy(void* addr) { for (int i = 0; i < NUM_OUTER_LOOPS; ++i) { @@ -113,7 +112,7 @@ void server_thread(void* vargs) { grpc_timeout_milliseconds_to_deadline(SERVER_SHUTDOWN_TIMEOUT); ev = grpc_completion_queue_next(args->cq, deadline, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(detag(ev.tag) == 0xd1e); + GPR_ASSERT(ev.tag == tag(0xd1e)); } static void on_connect(void* vargs, grpc_endpoint* tcp, @@ -148,7 +147,7 @@ void bad_server_thread(void* vargs) { args->addr = absl::StrCat("localhost:", port); grpc_tcp_server_start(s, &args->pollset, on_connect, args); - gpr_event_set(&args->ready, (void*)1); + gpr_event_set(&args->ready, reinterpret_cast(1)); gpr_mu_lock(args->mu); while (args->stop.load(std::memory_order_acquire) == false) { diff --git a/test/core/surface/lame_client_test.cc b/test/core/surface/lame_client_test.cc index 1160268002b..bac7ee008ee 100644 --- a/test/core/surface/lame_client_test.cc +++ b/test/core/surface/lame_client_test.cc @@ -36,7 +36,7 @@ class Watcher : public grpc_core::ConnectivityStateWatcherInterface { } }; -static void* tag(intptr_t x) { return (void*)x; } +static void* tag(intptr_t t) { return reinterpret_cast(t); } static grpc_closure transport_op_cb; diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc index 1b2cce86819..2a348daeaa5 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.cc +++ b/test/core/surface/num_external_connectivity_watchers_test.cc @@ -45,8 +45,9 @@ static void channel_idle_start_watch(grpc_channel* channel, GPR_ASSERT(grpc_channel_check_connectivity_state(channel, 0) == GRPC_CHANNEL_IDLE); - grpc_channel_watch_connectivity_state( - channel, GRPC_CHANNEL_IDLE, connect_deadline, cq, (void*)(next_tag++)); + grpc_channel_watch_connectivity_state(channel, GRPC_CHANNEL_IDLE, + connect_deadline, cq, + reinterpret_cast(next_tag++)); gpr_log(GPR_DEBUG, "number of active connect watchers: %d", grpc_channel_num_external_connectivity_watchers(channel)); } @@ -136,7 +137,8 @@ static void run_channel_shutdown_before_timeout_test( GRPC_CHANNEL_IDLE); grpc_channel_watch_connectivity_state(channel, GRPC_CHANNEL_IDLE, - connect_deadline, cq, (void*)1); + connect_deadline, cq, + reinterpret_cast(1)); grpc_channel_destroy(channel); grpc_event ev = grpc_completion_queue_next( diff --git a/test/core/transport/chttp2/stream_map_test.cc b/test/core/transport/chttp2/stream_map_test.cc index 3452c86cdc9..6bf83eab528 100644 --- a/test/core/transport/chttp2/stream_map_test.cc +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -55,7 +55,7 @@ static void test_basic_add_find(uint32_t n) { grpc_chttp2_stream_map_init(&map, 8); GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void*)static_cast(i)); + grpc_chttp2_stream_map_add(&map, i, reinterpret_cast(i)); } GPR_ASSERT(n == grpc_chttp2_stream_map_size(&map)); GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 0)); @@ -110,7 +110,7 @@ static void test_delete_evens_sweep(uint32_t n) { grpc_chttp2_stream_map_init(&map, 8); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void*)static_cast(i)); + grpc_chttp2_stream_map_add(&map, i, reinterpret_cast(i)); } for (i = 1; i <= n; i++) { if ((i & 1) == 0) { @@ -132,7 +132,7 @@ static void test_delete_evens_incremental(uint32_t n) { grpc_chttp2_stream_map_init(&map, 8); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void*)static_cast(i)); + grpc_chttp2_stream_map_add(&map, i, reinterpret_cast(i)); if ((i & 1) == 0) { grpc_chttp2_stream_map_delete(&map, i); } @@ -154,7 +154,7 @@ static void test_periodic_compaction(uint32_t n) { grpc_chttp2_stream_map_init(&map, 16); GPR_ASSERT(map.capacity == 16); for (i = 1; i <= n; i++) { - grpc_chttp2_stream_map_add(&map, i, (void*)static_cast(i)); + grpc_chttp2_stream_map_add(&map, i, reinterpret_cast(i)); if (i > 8) { del = i - 8; GPR_ASSERT((void*)(uintptr_t)del == diff --git a/test/core/transport/chttp2/too_many_pings_test.cc b/test/core/transport/chttp2/too_many_pings_test.cc index 38cb77ce275..08d635a1d69 100644 --- a/test/core/transport/chttp2/too_many_pings_test.cc +++ b/test/core/transport/chttp2/too_many_pings_test.cc @@ -59,7 +59,7 @@ namespace { -void* tag(int i) { return (void*)static_cast(i); } +void* tag(intptr_t t) { return reinterpret_cast(t); } // Perform a simple RPC where the server cancels the request with // grpc_call_cancel_with_status @@ -249,10 +249,10 @@ grpc_status_code PerformWaitingCall(grpc_channel* channel, grpc_server* server, // Shuts down and destroys the server. void ServerShutdownAndDestroy(grpc_server* server, grpc_completion_queue* cq) { // Shutdown and destroy server - grpc_server_shutdown_and_notify(server, cq, (void*)(1000)); + grpc_server_shutdown_and_notify(server, cq, reinterpret_cast(1000)); while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) - .tag != (void*)(1000)) { + .tag != reinterpret_cast(1000)) { } grpc_server_destroy(server); } @@ -273,11 +273,11 @@ void VerifyChannelDisconnected(grpc_channel* channel, grpc_completion_queue* cq) { // Verify channel gets disconnected. Use a ping to make sure that clients // tries sending/receiving bytes if the channel is connected. - grpc_channel_ping(channel, cq, (void*)(2000), nullptr); + grpc_channel_ping(channel, cq, reinterpret_cast(2000), nullptr); grpc_event ev = grpc_completion_queue_next( cq, grpc_timeout_seconds_to_deadline(5), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev.tag == (void*)(2000)); + GPR_ASSERT(ev.tag == reinterpret_cast(2000)); GPR_ASSERT(ev.success == 0); GPR_ASSERT(grpc_channel_check_connectivity_state(channel, 0) != GRPC_CHANNEL_READY); diff --git a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc index a7d9f24b3d5..c96a6141f43 100644 --- a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc +++ b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc @@ -388,7 +388,7 @@ class FakeTcpServer { gpr_log(GPR_DEBUG, "FakeTcpServer stop and " "join server thread"); - gpr_event_set(&stop_ev_, (void*)1); + gpr_event_set(&stop_ev_, reinterpret_cast(1)); run_server_loop_thd_->join(); gpr_log(GPR_DEBUG, "FakeTcpServer join server " diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc index 61053040501..a450001635b 100644 --- a/test/core/tsi/ssl_transport_security_test.cc +++ b/test/core/tsi/ssl_transport_security_test.cc @@ -366,8 +366,8 @@ static void ssl_test_check_handshaker_peers(tsi_test_fixture* fixture) { } static void ssl_test_pem_key_cert_pair_destroy(tsi_ssl_pem_key_cert_pair kp) { - gpr_free((void*)kp.private_key); - gpr_free((void*)kp.cert_chain); + gpr_free(const_cast(kp.private_key)); + gpr_free(const_cast(kp.cert_chain)); } static void ssl_test_destruct(tsi_test_fixture* fixture) { diff --git a/test/core/util/stack_tracer.cc b/test/core/util/stack_tracer.cc index 228e5bbe726..f611ff1e2f8 100644 --- a/test/core/util/stack_tracer.cc +++ b/test/core/util/stack_tracer.cc @@ -97,8 +97,7 @@ std::string GetCurrentStackTrace() { void* stack[kNumStackFrames]; int frame_sizes[kNumStackFrames]; int depth = absl::GetStackFrames(stack, frame_sizes, kNumStackFrames, 1); - DumpStackTrace(stack, frame_sizes, depth, true, DebugWriteToString, - (void*)&result); + DumpStackTrace(stack, frame_sizes, depth, true, DebugWriteToString, &result); return result; } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 4bb5c1cb730..f914fdd7a53 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -60,7 +60,7 @@ namespace testing { namespace { -void* tag(int i) { return (void*)static_cast(i); } +void* tag(int t) { return reinterpret_cast(t); } int detag(void* p) { return static_cast(reinterpret_cast(p)); } class Verifier { diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index e89971e018b..08e75eff61f 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1357,7 +1357,7 @@ TEST_P(End2endTest, RpcMaxMessageSize) { void ReaderThreadFunc(ClientReaderWriter* stream, gpr_event* ev) { EchoResponse resp; - gpr_event_set(ev, (void*)1); + gpr_event_set(ev, reinterpret_cast(1)); while (stream->Read(&resp)) { gpr_log(GPR_INFO, "Read message"); } diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index 6287677f5dc..0d8f1d787bc 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -51,7 +51,7 @@ namespace grpc { namespace testing { namespace { -void* tag(int i) { return (void*)static_cast(i); } +void* tag(int i) { return reinterpret_cast(i); } void verify_ok(CompletionQueue* cq, int i, bool expect_ok) { bool ok; diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 32aacc416bc..cff1cf8b829 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -48,7 +48,7 @@ namespace grpc { namespace testing { namespace { -void* tag(int i) { return (void*)static_cast(i); } +void* tag(int i) { return reinterpret_cast(i); } void verify_ok(CompletionQueue* cq, int i, bool expect_ok) { bool ok; diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index 8646b5a54b1..76e1f830594 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -49,7 +49,7 @@ using ::grpc::experimental::GenericCallbackServerContext; using ::grpc::experimental::ServerGenericBidiReactor; #endif -void* tag(int i) { return (void*)static_cast(i); } +void* tag(int i) { return reinterpret_cast(i); } bool VerifyReturnSuccess(CompletionQueue* cq, int i) { void* got_tag; diff --git a/test/cpp/end2end/interceptors_util.h b/test/cpp/end2end/interceptors_util.h index 01009cdc93f..0b386b3cd27 100644 --- a/test/cpp/end2end/interceptors_util.h +++ b/test/cpp/end2end/interceptors_util.h @@ -191,7 +191,7 @@ bool CheckMetadata(const std::multimap& map, std::vector> CreateDummyClientInterceptors(); -inline void* tag(int i) { return (void*)static_cast(i); } +inline void* tag(int i) { return reinterpret_cast(i); } inline int detag(void* p) { return static_cast(reinterpret_cast(p)); } diff --git a/test/cpp/end2end/raw_end2end_test.cc b/test/cpp/end2end/raw_end2end_test.cc index 31edffdc948..d6300ecad66 100644 --- a/test/cpp/end2end/raw_end2end_test.cc +++ b/test/cpp/end2end/raw_end2end_test.cc @@ -50,7 +50,7 @@ namespace testing { namespace { -void* tag(int i) { return (void*)static_cast(i); } +void* tag(int i) { return reinterpret_cast(i); } int detag(void* p) { return static_cast(reinterpret_cast(p)); } class Verifier { diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index 37dfcd44a71..ed86f8a9135 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -48,7 +48,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { Status Echo(ServerContext* context, const EchoRequest* /*request*/, EchoResponse* /*response*/) override { - gpr_event_set(ev_, (void*)1); + gpr_event_set(ev_, reinterpret_cast(1)); while (!context->IsCancelled()) { } return Status::OK; diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index eeb93ce0c80..0e7da2e01ed 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -245,7 +245,7 @@ class CommonStressTestAsyncServer : public BaseClass { service_.RequestEcho(contexts_[i].srv_ctx.get(), &contexts_[i].recv_request, contexts_[i].response_writer.get(), cq_.get(), - cq_.get(), (void*)static_cast(i)); + cq_.get(), reinterpret_cast(i)); } } struct Context { @@ -369,8 +369,7 @@ class AsyncClientEnd2endTest : public ::testing::Test { request.set_message("Hello: " + std::to_string(i)); call->response_reader = common_.GetStub()->AsyncEcho(&call->context, request, &cq_); - call->response_reader->Finish(&call->response, &call->status, - (void*)call); + call->response_reader->Finish(&call->response, &call->status, call); grpc::internal::MutexLock l(&mu_); rpcs_outstanding_++; diff --git a/test/cpp/interop/xds_interop_client.cc b/test/cpp/interop/xds_interop_client.cc index 78c71b0a185..1e6282f3220 100644 --- a/test/cpp/interop/xds_interop_client.cc +++ b/test/cpp/interop/xds_interop_client.cc @@ -246,7 +246,7 @@ class TestClient { &call->context, SimpleRequest::default_instance(), &cq_); call->simple_response_reader->StartCall(); call->simple_response_reader->Finish(&call->simple_response, &call->status, - (void*)call); + call); } void AsyncEmptyCall( @@ -278,7 +278,7 @@ class TestClient { &call->context, Empty::default_instance(), &cq_); call->empty_response_reader->StartCall(); call->empty_response_reader->Finish(&call->empty_response, &call->status, - (void*)call); + call); } void AsyncCompleteRpc() { diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 6a783d30aca..220504b3de8 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -244,7 +244,7 @@ class Stream { grpc_transport_destroy_stream(stream->f_->transport(), static_cast(stream->stream_), stream->destroy_closure_); - gpr_event_set(&stream->done_, (void*)(1)); + gpr_event_set(&stream->done_, reinterpret_cast(1)); } Fixture* f_; @@ -396,7 +396,7 @@ static void BM_TransportEmptyOp(benchmark::State& state) { std::unique_ptr stream_cancel_closure = MakeTestClosure([&](grpc_error* error) { GPR_ASSERT(error == GRPC_ERROR_NONE); - gpr_event_set(stream_cancel_done, (void*)(1)); + gpr_event_set(stream_cancel_done, reinterpret_cast(1)); }); op.on_complete = stream_cancel_closure.get(); s->Op(&op); @@ -444,7 +444,7 @@ static void BM_TransportStreamSend(benchmark::State& state) { std::unique_ptr c = MakeTestClosure([&](grpc_error* /*error*/) { if (!state.KeepRunning()) { - gpr_event_set(bm_done, (void*)(1)); + gpr_event_set(bm_done, reinterpret_cast(1)); return; } grpc_slice_buffer send_buffer; @@ -480,7 +480,7 @@ static void BM_TransportStreamSend(benchmark::State& state) { std::unique_ptr stream_cancel_closure = MakeTestClosure([&](grpc_error* error) { GPR_ASSERT(error == GRPC_ERROR_NONE); - gpr_event_set(stream_cancel_done, (void*)(1)); + gpr_event_set(stream_cancel_done, reinterpret_cast(1)); }); op.on_complete = stream_cancel_closure.get(); s->Op(&op); @@ -666,7 +666,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) { std::unique_ptr stream_cancel_closure = MakeTestClosure([&](grpc_error* error) { GPR_ASSERT(error == GRPC_ERROR_NONE); - gpr_event_set(stream_cancel_done, (void*)(1)); + gpr_event_set(stream_cancel_done, reinterpret_cast(1)); }); op.on_complete = stream_cancel_closure.get(); s->Op(&op); diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index b89eafb9c2c..f0082491be3 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -78,7 +78,7 @@ static grpc_error* pollset_work(grpc_pollset* ps, gpr_mu_unlock(&ps->mu); - void* tag = (void*)static_cast(10); // Some random number + void* tag = reinterpret_cast(10); // Some random number GPR_ASSERT(grpc_cq_begin_op(g_cq, tag)); grpc_cq_end_op( g_cq, tag, GRPC_ERROR_NONE, cq_done_cb, nullptr, diff --git a/test/cpp/naming/cancel_ares_query_test.cc b/test/cpp/naming/cancel_ares_query_test.cc index ab03d2b3b93..371e3e5eb4e 100644 --- a/test/cpp/naming/cancel_ares_query_test.cc +++ b/test/cpp/naming/cancel_ares_query_test.cc @@ -57,7 +57,7 @@ namespace { -void* Tag(intptr_t t) { return (void*)t; } +void* Tag(intptr_t t) { return reinterpret_cast(t); } gpr_timespec FiveSecondsFromNow(void) { return grpc_timeout_seconds_to_deadline(5); @@ -374,7 +374,7 @@ void TestCancelDuringActiveQuery( // Teardown grpc_channel_args_destroy(client_args); grpc_slice_unref(details); - gpr_free((void*)error_string); + gpr_free(const_cast(error_string)); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index 61e2698d670..b5565784d24 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -257,7 +257,7 @@ void PollPollsetUntilRequestDone(ArgsStruct* args) { NSecondDeadline(1)))); gpr_mu_unlock(args->mu); } - gpr_event_set(&args->ev, (void*)1); + gpr_event_set(&args->ev, reinterpret_cast(1)); } void CheckServiceConfigResultLocked(const char* service_config_json, @@ -660,7 +660,7 @@ TEST(ResolverComponentTest, TestResolvesRelevantRecordsWithConcurrentFdStress) { // Run the resolver test RunResolvesRelevantRecordsTest(ResultHandler::Create); // Shutdown and join stress thread - gpr_event_set(&done_ev, (void*)1); + gpr_event_set(&done_ev, reinterpret_cast(1)); socket_stress_thread.join(); } diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 29cb327e823..5cb4d9dd1d6 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -411,7 +411,7 @@ class Client { void MaybeStartRequests() { if (!started_requests_) { started_requests_ = true; - gpr_event_set(&start_requests_, (void*)1); + gpr_event_set(&start_requests_, reinterpret_cast(1)); } } diff --git a/test/cpp/server/server_request_call_test.cc b/test/cpp/server/server_request_call_test.cc index 4b30de34b68..5ce852575e3 100644 --- a/test/cpp/server/server_request_call_test.cc +++ b/test/cpp/server/server_request_call_test.cc @@ -65,7 +65,7 @@ TEST(ServerRequestCallTest, ShortDeadlineDoesNotCauseOkayFalse) { std::lock_guard lock(mu); if (!shutting_down) { service.RequestEcho(&ctx, &req, &responder, cq.get(), cq.get(), - (void*)1); + reinterpret_cast(1)); } } @@ -106,7 +106,8 @@ TEST(ServerRequestCallTest, ShortDeadlineDoesNotCauseOkayFalse) { continue; } gpr_log(GPR_INFO, "Finishing request %d", n); - responder.Finish(response, grpc::Status::OK, (void*)2); + responder.Finish(response, grpc::Status::OK, + reinterpret_cast(2)); if (!cq->Next(&tag, &ok)) { break; } diff --git a/test/cpp/util/channelz_sampler_test.cc b/test/cpp/util/channelz_sampler_test.cc index efd01e78d40..89d82c60a46 100644 --- a/test/cpp/util/channelz_sampler_test.cc +++ b/test/cpp/util/channelz_sampler_test.cc @@ -155,8 +155,8 @@ TEST(ChannelzSamplerTest, SimpleTest) { GPR_ASSERT(0); } delete test_driver; - gpr_event_set(&done_ev1, (void*)1); - gpr_event_set(&done_ev2, (void*)1); + gpr_event_set(&done_ev1, reinterpret_cast(1)); + gpr_event_set(&done_ev2, reinterpret_cast(1)); client_thread_1.join(); client_thread_2.join(); } diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index 30f3c1d6c03..34def7a66f2 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -32,7 +32,7 @@ namespace grpc { namespace testing { namespace { -void* tag(int i) { return (void*)static_cast(i); } +void* tag(intptr_t t) { return reinterpret_cast(t); } } // namespace Status CliCall::Call(const std::shared_ptr& channel,