Fix gpr_log format mismatches in c++ tests
diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h
index 05cbd3b..952cbfc 100644
--- a/include/grpc/support/string_util.h
+++ b/include/grpc/support/string_util.h
@@ -54,8 +54,8 @@
On error, returns -1 and sets *strp to NULL. If the format string is bad,
the result is undefined. */
-GPRAPI int gpr_asprintf(char **strp, const char *format,
- ...) GPRC_PRINT_FORMAT_CHECK(2, 3);
+GPRAPI int gpr_asprintf(char **strp, const char *format, ...)
+ GPRC_PRINT_FORMAT_CHECK(2, 3);
#ifdef __cplusplus
}
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index 047f164..c37867a 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -957,7 +957,7 @@
if (metadata_size > metadata_peer_limit) {
gpr_log(GPR_DEBUG,
"to-be-sent initial metadata size exceeds peer limit "
- "(%lu vs. %lu)",
+ "(%" PRIuPTR " vs. %" PRIuPTR ")",
metadata_size, metadata_peer_limit);
cancel_from_api(exec_ctx, transport_global, stream_global,
GRPC_STATUS_RESOURCE_EXHAUSTED);
@@ -1012,7 +1012,7 @@
if (metadata_size > metadata_peer_limit) {
gpr_log(GPR_DEBUG,
"to-be-sent trailing metadata size exceeds peer limit "
- "(%lu vs. %lu)",
+ "(%" PRIuPTR " vs. %" PRIuPTR ")",
metadata_size, metadata_peer_limit);
cancel_from_api(exec_ctx, transport_global, stream_global,
GRPC_STATUS_RESOURCE_EXHAUSTED);
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index b839801..5915187 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -231,7 +231,8 @@
void Log() const {
gpr_log(GPR_INFO,
"Scenario: disable_blocking %d, credentials %s, message size %d",
- disable_blocking, credentials_type.c_str(), message_content.size());
+ disable_blocking, credentials_type.c_str(),
+ (int)(message_content.size()));
}
bool disable_blocking;
const grpc::string credentials_type;
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 7727824..addaf17 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -171,8 +171,9 @@
"large_unary|large_compressed_unary|client_streaming|server_streaming|"
"server_compressed_streaming|half_duplex|ping_pong|cancel_after_begin|"
"cancel_after_first_response|timeout_on_sleeping_server|empty_stream|"
- "compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds",
- "status_code_and_message|custom_metadata", FLAGS_test_case.c_str());
+ "compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds|"
+ "status_code_and_message|custom_metadata",
+ FLAGS_test_case.c_str());
ret = 1;
}
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index a0479e8..f9813f3 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -433,7 +433,7 @@
// most likely due to connection failure.
gpr_log(GPR_ERROR,
"DoResponseStreaming(): Read fewer streams (%d) than "
- "response_stream_sizes.size() (%d)",
+ "response_stream_sizes.size() (%" PRIu64 ")",
i, response_stream_sizes.size());
return TransientFailureOrAbort();
}
@@ -517,9 +517,11 @@
// stream->Read() failed before reading all the expected messages. This
// is most likely due to a connection failure.
gpr_log(GPR_ERROR,
- "DoResponseCompressedStreaming(): Responses read (k=%d) is "
+ "DoResponseCompressedStreaming(): Responses read (k=%" PRIuPTR
+ ") is "
"less than the expected messages (i.e "
- "response_stream_sizes.size() (%d)). (i=%d, j=%d)",
+ "response_stream_sizes.size() (%" PRIu64 ")). (i=%" PRIuPTR
+ ", j=%" PRIuPTR ")",
k, response_stream_sizes.size(), i, j);
return TransientFailureOrAbort();
}
@@ -608,7 +610,7 @@
// most likely due to a connection failure
gpr_log(GPR_ERROR,
"DoHalfDuplex(): Responses read (i=%d) are less than the expected "
- "number of messages response_stream_sizes.size() (%d)",
+ "number of messages response_stream_sizes.size() (%" PRIu64 ")",
i, response_stream_sizes.size());
return TransientFailureOrAbort();
}
diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc
index c8c2215..7a0cb99 100644
--- a/test/cpp/interop/metrics_client.cc
+++ b/test/cpp/interop/metrics_client.cc
@@ -76,7 +76,7 @@
while (reader->Read(&gauge_response)) {
if (gauge_response.value_case() == GaugeResponse::kLongValue) {
if (!total_only) {
- gpr_log(GPR_INFO, "%s: %ld", gauge_response.name().c_str(),
+ gpr_log(GPR_INFO, "%s: %lld", gauge_response.name().c_str(),
gauge_response.long_value());
}
overall_qps += gauge_response.long_value();
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 57d8c22..83dbdc3 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -244,8 +244,8 @@
// where class contained in std::vector must have a copy constructor
auto* servers = new ServerData[num_servers];
for (size_t i = 0; i < num_servers; i++) {
- gpr_log(GPR_INFO, "Starting server on %s (worker #%d)", workers[i].c_str(),
- i);
+ gpr_log(GPR_INFO, "Starting server on %s (worker #%" PRIuPTR ")",
+ workers[i].c_str(), i);
servers[i].stub = WorkerService::NewStub(
CreateChannel(workers[i], InsecureChannelCredentials()));
@@ -307,8 +307,8 @@
auto* clients = new ClientData[num_clients];
for (size_t i = 0; i < num_clients; i++) {
const auto& worker = workers[i + num_servers];
- gpr_log(GPR_INFO, "Starting client on %s (worker #%d)", worker.c_str(),
- i + num_servers);
+ gpr_log(GPR_INFO, "Starting client on %s (worker #%" PRIuPTR ")",
+ worker.c_str(), i + num_servers);
clients[i].stub = WorkerService::NewStub(
CreateChannel(worker, InsecureChannelCredentials()));
ClientConfig per_client_config = client_config;
diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc
index be80428..e4fc35f 100644
--- a/test/cpp/qps/parse_json.cc
+++ b/test/cpp/qps/parse_json.cc
@@ -55,7 +55,7 @@
grpc::string errmsg(status.error_message());
gpr_log(GPR_ERROR, "Failed to convert json to binary: errcode=%d msg=%s",
status.error_code(), errmsg.c_str());
- gpr_log(GPR_ERROR, "JSON: ", json.c_str());
+ gpr_log(GPR_ERROR, "JSON: %s", json.c_str());
abort();
}
GPR_ASSERT(msg->ParseFromString(binary));