Merge pull request #20705 from vjpai/more_cpp_warning_removals_201910210916_14

Remove unused-parameter warnings, round 2 (14 of 19)
pull/20614/head^2
Vijay Pai 5 years ago committed by GitHub
commit bed9a5b183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      src/core/tsi/ssl_transport_security.cc
  2. 2
      src/cpp/client/channel_cc.cc
  3. 4
      src/cpp/client/client_context.cc
  4. 35
      src/cpp/common/alarm.cc
  5. 6
      src/cpp/server/channel_argument_option.cc
  6. 2
      src/cpp/server/health/health_check_service_server_builder_option.cc
  7. 3
      src/cpp/server/server_context.cc
  8. 5
      templates/test/core/surface/public_headers_must_be_c89.c.template
  9. 6
      test/core/avl/avl_test.cc
  10. 2
      test/core/bad_ssl/server_common.cc
  11. 5
      test/core/surface/public_headers_must_be_c89.c

@ -774,7 +774,7 @@ static tsi_result build_alpn_protocol_name_list(
// the server's certificate, but we need to pull it anyway, in case a higher
// layer wants to look at it. In this case the verification may fail, but
// we don't really care.
static int NullVerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) {
static int NullVerifyCallback(int /*preverify_ok*/, X509_STORE_CTX* /*ctx*/) {
return 1;
}
@ -1265,7 +1265,7 @@ static tsi_result ssl_handshaker_next(
tsi_handshaker* self, const unsigned char* received_bytes,
size_t received_bytes_size, const unsigned char** bytes_to_send,
size_t* bytes_to_send_size, tsi_handshaker_result** handshaker_result,
tsi_handshaker_on_next_done_cb cb, void* user_data) {
tsi_handshaker_on_next_done_cb /*cb*/, void* /*user_data*/) {
/* Input sanity check. */
if ((received_bytes_size > 0 && received_bytes == nullptr) ||
bytes_to_send == nullptr || bytes_to_send_size == nullptr ||
@ -1465,11 +1465,9 @@ static void tsi_ssl_client_handshaker_factory_destroy(
gpr_free(self);
}
static int client_handshaker_factory_npn_callback(SSL* ssl, unsigned char** out,
unsigned char* outlen,
const unsigned char* in,
unsigned int inlen,
void* arg) {
static int client_handshaker_factory_npn_callback(
SSL* /*ssl*/, unsigned char** out, unsigned char* outlen,
const unsigned char* in, unsigned int inlen, void* arg) {
tsi_ssl_client_handshaker_factory* factory =
static_cast<tsi_ssl_client_handshaker_factory*>(arg);
return select_protocol_list((const unsigned char**)out, outlen,
@ -1556,7 +1554,8 @@ static int does_entry_match_name(grpc_core::StringView entry,
return !entry.empty() && name_subdomain == entry;
}
static int ssl_server_handshaker_factory_servername_callback(SSL* ssl, int* ap,
static int ssl_server_handshaker_factory_servername_callback(SSL* ssl,
int* /*ap*/,
void* arg) {
tsi_ssl_server_handshaker_factory* impl =
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
@ -1579,7 +1578,7 @@ static int ssl_server_handshaker_factory_servername_callback(SSL* ssl, int* ap,
#if TSI_OPENSSL_ALPN_SUPPORT
static int server_handshaker_factory_alpn_callback(
SSL* ssl, const unsigned char** out, unsigned char* outlen,
SSL* /*ssl*/, const unsigned char** out, unsigned char* outlen,
const unsigned char* in, unsigned int inlen, void* arg) {
tsi_ssl_server_handshaker_factory* factory =
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
@ -1590,7 +1589,7 @@ static int server_handshaker_factory_alpn_callback(
#endif /* TSI_OPENSSL_ALPN_SUPPORT */
static int server_handshaker_factory_npn_advertised_callback(
SSL* ssl, const unsigned char** out, unsigned int* outlen, void* arg) {
SSL* /*ssl*/, const unsigned char** out, unsigned int* outlen, void* arg) {
tsi_ssl_server_handshaker_factory* factory =
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
*out = factory->alpn_protocol_list;

@ -180,7 +180,7 @@ class TagSaver final : public ::grpc::internal::CompletionQueueTag {
public:
explicit TagSaver(void* tag) : tag_(tag) {}
~TagSaver() override {}
bool FinalizeResult(void** tag, bool* status) override {
bool FinalizeResult(void** tag, bool* /*status*/) override {
*tag = tag_;
delete this;
return true;

@ -39,8 +39,8 @@ class DefaultGlobalClientCallbacks final
: public ClientContext::GlobalCallbacks {
public:
~DefaultGlobalClientCallbacks() override {}
void DefaultConstructor(ClientContext* context) override {}
void Destructor(ClientContext* context) override {}
void DefaultConstructor(ClientContext* /*context*/) override {}
void Destructor(ClientContext* /*context*/) override {}
};
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;

@ -41,7 +41,7 @@ class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
grpc_timer_init_unset(&timer_);
}
~AlarmImpl() {}
bool FinalizeResult(void** tag, bool* status) override {
bool FinalizeResult(void** tag, bool* /*status*/) override {
*tag = tag_;
Unref();
return true;
@ -53,22 +53,23 @@ class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
cq_ = cq->cq();
tag_ = tag;
GPR_ASSERT(grpc_cq_begin_op(cq_, this));
GRPC_CLOSURE_INIT(&on_alarm_,
[](void* arg, grpc_error* error) {
// queue the op on the completion queue
AlarmImpl* alarm = static_cast<AlarmImpl*>(arg);
alarm->Ref();
// Preserve the cq and reset the cq_ so that the alarm
// can be reset when the alarm tag is delivered.
grpc_completion_queue* cq = alarm->cq_;
alarm->cq_ = nullptr;
grpc_cq_end_op(
cq, alarm, error,
[](void* arg, grpc_cq_completion* completion) {},
arg, &alarm->completion_);
GRPC_CQ_INTERNAL_UNREF(cq, "alarm");
},
this, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(
&on_alarm_,
[](void* arg, grpc_error* error) {
// queue the op on the completion queue
AlarmImpl* alarm = static_cast<AlarmImpl*>(arg);
alarm->Ref();
// Preserve the cq and reset the cq_ so that the alarm
// can be reset when the alarm tag is delivered.
grpc_completion_queue* cq = alarm->cq_;
alarm->cq_ = nullptr;
grpc_cq_end_op(
cq, alarm, error,
[](void* /*arg*/, grpc_cq_completion* /*completion*/) {}, arg,
&alarm->completion_);
GRPC_CQ_INTERNAL_UNREF(cq, "alarm");
},
this, grpc_schedule_on_exec_ctx);
grpc_timer_init(&timer_, grpc_timespec_to_millis_round_up(deadline),
&on_alarm_);
}

@ -31,7 +31,8 @@ std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
args->SetString(name_, value_);
}
virtual void UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override {}
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
override {}
private:
const grpc::string name_;
@ -51,7 +52,8 @@ std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
args->SetInt(name_, value_);
}
virtual void UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override {}
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
override {}
private:
const grpc::string name_;

@ -30,6 +30,6 @@ void HealthCheckServiceServerBuilderOption::UpdateArguments(
}
void HealthCheckServiceServerBuilderOption::UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) {}
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/) {}
} // namespace grpc

@ -74,6 +74,9 @@ class ServerContext::CompletionOp final
// But this class is not trivially destructible, so must actually call delete
// before allowing the arena to be freed
static void operator delete(void* /*ptr*/, std::size_t size) {
// Use size to avoid unused-parameter warning since assert seems to be
// compiled out and treated as unused in some gcc optimized versions.
(void)size;
assert(size == sizeof(CompletionOp));
}

@ -50,6 +50,11 @@
#include <stdio.h>
int main(int argc, char **argv) {
/* Use the parameters to avoid unused-parameter warning.
(C89 parameters must be named.) */
(void)argc;
(void)argv;
% for fn in fns:
printf("%lx", (unsigned long) ${fn});
% endfor

@ -33,14 +33,14 @@ static int* box(int x) {
return b;
}
static long int_compare(void* int1, void* int2, void* unused) {
static long int_compare(void* int1, void* int2, void* /*unused*/) {
return (*static_cast<int*>(int1)) - (*static_cast<int*>(int2));
}
static void* int_copy(void* p, void* unused) {
static void* int_copy(void* p, void* /*unused*/) {
return box(*static_cast<int*>(p));
}
static void destroy(void* p, void* unused) { gpr_free(p); }
static void destroy(void* p, void* /*unused*/) { gpr_free(p); }
static const grpc_avl_vtable int_int_vtable = {destroy, int_copy, int_compare,
destroy, int_copy};

@ -30,7 +30,7 @@
static int got_sigint = 0;
static void sigint_handler(int x) { got_sigint = 1; }
static void sigint_handler(int /*x*/) { got_sigint = 1; }
const char* bad_ssl_addr(int argc, char** argv) {
gpr_cmdline* cl;

@ -61,6 +61,11 @@
#include <stdio.h>
int main(int argc, char **argv) {
/* Use the parameters to avoid unused-parameter warning.
(C89 parameters must be named.) */
(void)argc;
(void)argv;
printf("%lx", (unsigned long) grpc_compression_algorithm_is_message);
printf("%lx", (unsigned long) grpc_compression_algorithm_is_stream);
printf("%lx", (unsigned long) grpc_compression_algorithm_parse);

Loading…
Cancel
Save