From 5a88028c8998f7ea815d801411319c942f43c1d8 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 17 Oct 2019 08:50:38 -0700 Subject: [PATCH] Remove unused parameter warning (1 of 20) --- src/core/lib/iomgr/executor/threadpool.h | 2 +- src/cpp/client/secure_credentials.cc | 2 +- src/cpp/common/channel_filter.h | 16 ++++++------- .../common/tls_credentials_options_util.cc | 10 ++++---- src/cpp/ext/proto_server_reflection.cc | 10 ++++---- src/cpp/ext/proto_server_reflection_plugin.cc | 4 ++-- src/cpp/server/channelz/channelz_service.cc | 17 ++++++++------ .../channelz/channelz_service_plugin.cc | 5 ++-- .../health/default_health_check_service.h | 4 ++-- src/cpp/server/server_cc.cc | 23 ++++++++++--------- 10 files changed, 50 insertions(+), 43 deletions(-) diff --git a/src/core/lib/iomgr/executor/threadpool.h b/src/core/lib/iomgr/executor/threadpool.h index 0402c6ddf0e..3336ca0ccc1 100644 --- a/src/core/lib/iomgr/executor/threadpool.h +++ b/src/core/lib/iomgr/executor/threadpool.h @@ -62,7 +62,7 @@ class ThreadPoolInterface { // NULL closure. class ThreadPoolWorker { public: - ThreadPoolWorker(const char* thd_name, ThreadPoolInterface* pool, + ThreadPoolWorker(const char* thd_name, ThreadPoolInterface* /*pool*/, MPMCQueueInterface* queue, Thread::Options& options, int index) : queue_(queue), thd_name_(thd_name), index_(index) { diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 8ad9b62b9f5..15a6bec0d05 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -382,7 +382,7 @@ std::shared_ptr MetadataCredentialsFromPlugin( namespace grpc { namespace { -void DeleteWrapper(void* wrapper, grpc_error* ignored) { +void DeleteWrapper(void* wrapper, grpc_error* /*ignored*/) { MetadataCredentialsPluginWrapper* w = static_cast(wrapper); delete w; diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index 1a3295fc80f..5ce720b3075 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -236,13 +236,13 @@ class ChannelData { // TODO(roth): Come up with a more C++-like API for the channel element. /// Initializes the channel data. - virtual grpc_error* Init(grpc_channel_element* elem, - grpc_channel_element_args* args) { + virtual grpc_error* Init(grpc_channel_element* /*elem*/, + grpc_channel_element_args* /*args*/) { return GRPC_ERROR_NONE; } // Called before destruction. - virtual void Destroy(grpc_channel_element* elem) {} + virtual void Destroy(grpc_channel_element* /*elem*/) {} virtual void StartTransportOp(grpc_channel_element* elem, TransportOp* op); @@ -259,15 +259,15 @@ class CallData { // TODO(roth): Come up with a more C++-like API for the call element. /// Initializes the call data. - virtual grpc_error* Init(grpc_call_element* elem, - const grpc_call_element_args* args) { + virtual grpc_error* Init(grpc_call_element* /*elem*/, + const grpc_call_element_args* /*args*/) { return GRPC_ERROR_NONE; } // Called before destruction. - virtual void Destroy(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* then_call_closure) {} + virtual void Destroy(grpc_call_element* /*elem*/, + const grpc_call_final_info* /*final_info*/, + grpc_closure* /*then_call_closure*/) {} /// Starts a new stream operation. virtual void StartTransportStreamOpBatch(grpc_call_element* elem, diff --git a/src/cpp/common/tls_credentials_options_util.cc b/src/cpp/common/tls_credentials_options_util.cc index d279afea807..927474f3bae 100644 --- a/src/cpp/common/tls_credentials_options_util.cc +++ b/src/cpp/common/tls_credentials_options_util.cc @@ -57,7 +57,7 @@ grpc_tls_key_materials_config* ConvertToCKeyMaterialsConfig( /** The C schedule and cancel functions for the credential reload config. * They populate a C credential reload arg with the result of a C++ credential * reload schedule/cancel API. **/ -int TlsCredentialReloadConfigCSchedule(void* config_user_data, +int TlsCredentialReloadConfigCSchedule(void* /*config_user_data*/, grpc_tls_credential_reload_arg* arg) { if (arg == nullptr || arg->config == nullptr || arg->config->context() == nullptr) { @@ -71,7 +71,7 @@ int TlsCredentialReloadConfigCSchedule(void* config_user_data, return schedule_result; } -void TlsCredentialReloadConfigCCancel(void* config_user_data, +void TlsCredentialReloadConfigCCancel(void* /*config_user_data*/, grpc_tls_credential_reload_arg* arg) { if (arg == nullptr || arg->config == nullptr || arg->config->context() == nullptr) { @@ -101,7 +101,8 @@ void TlsCredentialReloadArgDestroyContext(void* context) { * config. They populate a C server authorization check arg with the result * of a C++ server authorization check schedule/cancel API. **/ int TlsServerAuthorizationCheckConfigCSchedule( - void* config_user_data, grpc_tls_server_authorization_check_arg* arg) { + void* /*config_user_data*/, + grpc_tls_server_authorization_check_arg* arg) { if (arg == nullptr || arg->config == nullptr || arg->config->context() == nullptr) { gpr_log(GPR_ERROR, @@ -117,7 +118,8 @@ int TlsServerAuthorizationCheckConfigCSchedule( } void TlsServerAuthorizationCheckConfigCCancel( - void* config_user_data, grpc_tls_server_authorization_check_arg* arg) { + void* /*config_user_data*/, + grpc_tls_server_authorization_check_arg* arg) { if (arg == nullptr || arg->config == nullptr || arg->config->context() == nullptr) { gpr_log(GPR_ERROR, diff --git a/src/cpp/ext/proto_server_reflection.cc b/src/cpp/ext/proto_server_reflection.cc index 1507210e2e1..de72e18327a 100644 --- a/src/cpp/ext/proto_server_reflection.cc +++ b/src/cpp/ext/proto_server_reflection.cc @@ -97,7 +97,7 @@ void ProtoServerReflection::FillErrorResponse(const Status& status, error_response->set_error_message(status.error_message()); } -Status ProtoServerReflection::ListService(ServerContext* context, +Status ProtoServerReflection::ListService(ServerContext* /*context*/, ListServiceResponse* response) { if (services_ == nullptr) { return Status(StatusCode::NOT_FOUND, "Services not found."); @@ -110,7 +110,7 @@ Status ProtoServerReflection::ListService(ServerContext* context, } Status ProtoServerReflection::GetFileByName( - ServerContext* context, const grpc::string& filename, + ServerContext* /*context*/, const grpc::string& filename, ServerReflectionResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; @@ -127,7 +127,7 @@ Status ProtoServerReflection::GetFileByName( } Status ProtoServerReflection::GetFileContainingSymbol( - ServerContext* context, const grpc::string& symbol, + ServerContext* /*context*/, const grpc::string& symbol, ServerReflectionResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; @@ -144,7 +144,7 @@ Status ProtoServerReflection::GetFileContainingSymbol( } Status ProtoServerReflection::GetFileContainingExtension( - ServerContext* context, const ExtensionRequest* request, + ServerContext* /*context*/, const ExtensionRequest* request, ServerReflectionResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; @@ -168,7 +168,7 @@ Status ProtoServerReflection::GetFileContainingExtension( } Status ProtoServerReflection::GetAllExtensionNumbers( - ServerContext* context, const grpc::string& type, + ServerContext* /*context*/, const grpc::string& type, ExtensionNumberResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; diff --git a/src/cpp/ext/proto_server_reflection_plugin.cc b/src/cpp/ext/proto_server_reflection_plugin.cc index 0ac4cb80c64..6f61853416e 100644 --- a/src/cpp/ext/proto_server_reflection_plugin.cc +++ b/src/cpp/ext/proto_server_reflection_plugin.cc @@ -41,8 +41,8 @@ void ProtoServerReflectionPlugin::Finish(grpc::ServerInitializer* si) { reflection_service_->SetServiceList(si->GetServiceList()); } -void ProtoServerReflectionPlugin::ChangeArguments(const grpc::string& name, - void* value) {} +void ProtoServerReflectionPlugin::ChangeArguments( + const grpc::string& /*name*/, void* /*value*/) {} bool ProtoServerReflectionPlugin::has_sync_methods() const { if (reflection_service_) { diff --git a/src/cpp/server/channelz/channelz_service.cc b/src/cpp/server/channelz/channelz_service.cc index 0409991fe67..62852bfab4a 100644 --- a/src/cpp/server/channelz/channelz_service.cc +++ b/src/cpp/server/channelz/channelz_service.cc @@ -32,7 +32,8 @@ grpc::protobuf::util::Status ParseJson(const char* json_str, } Status ChannelzService::GetTopChannels( - ServerContext* unused, const channelz::v1::GetTopChannelsRequest* request, + ServerContext* /*unused*/, + const channelz::v1::GetTopChannelsRequest* request, channelz::v1::GetTopChannelsResponse* response) { char* json_str = grpc_channelz_get_top_channels(request->start_channel_id()); if (json_str == nullptr) { @@ -48,7 +49,7 @@ Status ChannelzService::GetTopChannels( } Status ChannelzService::GetServers( - ServerContext* unused, const channelz::v1::GetServersRequest* request, + ServerContext* /*unused*/, const channelz::v1::GetServersRequest* request, channelz::v1::GetServersResponse* response) { char* json_str = grpc_channelz_get_servers(request->start_server_id()); if (json_str == nullptr) { @@ -63,7 +64,7 @@ Status ChannelzService::GetServers( return Status::OK; } -Status ChannelzService::GetServer(ServerContext* unused, +Status ChannelzService::GetServer(ServerContext* /*unused*/, const channelz::v1::GetServerRequest* request, channelz::v1::GetServerResponse* response) { char* json_str = grpc_channelz_get_server(request->server_id()); @@ -80,7 +81,8 @@ Status ChannelzService::GetServer(ServerContext* unused, } Status ChannelzService::GetServerSockets( - ServerContext* unused, const channelz::v1::GetServerSocketsRequest* request, + ServerContext* /*unused*/, + const channelz::v1::GetServerSocketsRequest* request, channelz::v1::GetServerSocketsResponse* response) { char* json_str = grpc_channelz_get_server_sockets( request->server_id(), request->start_socket_id(), request->max_results()); @@ -97,7 +99,7 @@ Status ChannelzService::GetServerSockets( } Status ChannelzService::GetChannel( - ServerContext* unused, const channelz::v1::GetChannelRequest* request, + ServerContext* /*unused*/, const channelz::v1::GetChannelRequest* request, channelz::v1::GetChannelResponse* response) { char* json_str = grpc_channelz_get_channel(request->channel_id()); if (json_str == nullptr) { @@ -112,7 +114,8 @@ Status ChannelzService::GetChannel( } Status ChannelzService::GetSubchannel( - ServerContext* unused, const channelz::v1::GetSubchannelRequest* request, + ServerContext* /*unused*/, + const channelz::v1::GetSubchannelRequest* request, channelz::v1::GetSubchannelResponse* response) { char* json_str = grpc_channelz_get_subchannel(request->subchannel_id()); if (json_str == nullptr) { @@ -127,7 +130,7 @@ Status ChannelzService::GetSubchannel( return Status::OK; } -Status ChannelzService::GetSocket(ServerContext* unused, +Status ChannelzService::GetSocket(ServerContext* /*unused*/, const channelz::v1::GetSocketRequest* request, channelz::v1::GetSocketResponse* response) { char* json_str = grpc_channelz_get_socket(request->socket_id()); diff --git a/src/cpp/server/channelz/channelz_service_plugin.cc b/src/cpp/server/channelz/channelz_service_plugin.cc index 04c6411d5a3..cbc485d759a 100644 --- a/src/cpp/server/channelz/channelz_service_plugin.cc +++ b/src/cpp/server/channelz/channelz_service_plugin.cc @@ -39,9 +39,10 @@ class ChannelzServicePlugin : public ::grpc::ServerBuilderPlugin { si->RegisterService(channelz_service_); } - void Finish(grpc::ServerInitializer* si) override {} + void Finish(grpc::ServerInitializer* /*si*/) override {} - void ChangeArguments(const grpc::string& name, void* value) override {} + void ChangeArguments(const grpc::string& /*name*/, + void* /*value*/) override {} bool has_sync_methods() const override { if (channelz_service_) { diff --git a/src/cpp/server/health/default_health_check_service.h b/src/cpp/server/health/default_health_check_service.h index 14a54d53ee0..3f91ba6283e 100644 --- a/src/cpp/server/health/default_health_check_service.h +++ b/src/cpp/server/health/default_health_check_service.h @@ -120,8 +120,8 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface { HealthCheckServiceImpl* service); // Not used for Check. - void SendHealth(std::shared_ptr self, - ServingStatus status) override {} + void SendHealth(std::shared_ptr /*self*/, + ServingStatus /*status*/) override {} private: // Called when we receive a call. diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index bc0a71c19bc..e2061939246 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -75,8 +75,8 @@ namespace { class DefaultGlobalCallbacks final : public Server::GlobalCallbacks { public: ~DefaultGlobalCallbacks() override {} - void PreSynchronousRequest(ServerContext* context) override {} - void PostSynchronousRequest(ServerContext* context) override {} + void PreSynchronousRequest(ServerContext* /*context*/) override {} + void PostSynchronousRequest(ServerContext* /*context*/) override {} }; std::shared_ptr g_callbacks = nullptr; @@ -90,12 +90,12 @@ void InitGlobalCallbacks() { class ShutdownTag : public internal::CompletionQueueTag { public: - bool FinalizeResult(void** tag, bool* status) { return false; } + bool FinalizeResult(void** /*tag*/, bool* /*status*/) { return false; } }; class DummyTag : public internal::CompletionQueueTag { public: - bool FinalizeResult(void** tag, bool* status) { return true; } + bool FinalizeResult(void** /*tag*/, bool* /*status*/) { return true; } }; class UnimplementedAsyncRequestContext { @@ -185,10 +185,11 @@ void ServerInterface::BaseAsyncRequest:: // Queue a tag which will be returned immediately grpc_core::ExecCtx exec_ctx; grpc_cq_begin_op(notification_cq_->cq(), this); - grpc_cq_end_op( - notification_cq_->cq(), this, GRPC_ERROR_NONE, - [](void* arg, grpc_cq_completion* completion) { delete completion; }, - nullptr, new grpc_cq_completion()); + grpc_cq_end_op(notification_cq_->cq(), this, GRPC_ERROR_NONE, + [](void* /*arg*/, grpc_cq_completion* completion) { + delete completion; + }, + nullptr, new grpc_cq_completion()); } ServerInterface::RegisteredAsyncRequest::RegisteredAsyncRequest( @@ -395,7 +396,7 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag { } } - bool FinalizeResult(void** tag, bool* status) override { + bool FinalizeResult(void** /*tag*/, bool* status) override { if (!*status) { grpc_completion_queue_destroy(cq_); cq_ = nullptr; @@ -785,13 +786,13 @@ class Server::CallbackRequest final : public Server::CallbackRequestBase { template <> bool Server::CallbackRequest::FinalizeResult( - void** tag, bool* status) { + void** /*tag*/, bool* /*status*/) { return false; } template <> bool Server::CallbackRequest::FinalizeResult( - void** tag, bool* status) { + void** /*tag*/, bool* status) { if (*status) { // TODO(yangg) remove the copy here ctx_.method_ = grpc::StringFromCopiedSlice(call_details_->method);