From a2035ca163199a05013201c9518e843a03f2f0b8 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 25 Jan 2021 10:03:18 -0800 Subject: [PATCH 1/2] Enabled format warning --- bazel/copts.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/bazel/copts.bzl b/bazel/copts.bzl index 8e9d74b36b7..c00d3587d88 100644 --- a/bazel/copts.bzl +++ b/bazel/copts.bzl @@ -43,7 +43,6 @@ GRPC_LLVM_WARNING_FLAGS = [ "-Wvla", # Exceptions but will be removed "-Wno-deprecated-declarations", - "-Wno-format", "-Wno-missing-field-initializers", "-Wno-sign-compare", "-Wno-unused-function", From ca92d3465acc0c8cf9d4803564b9b2c3bd99e314 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 25 Jan 2021 10:19:43 -0800 Subject: [PATCH 2/2] Fix format warnings --- src/cpp/server/load_reporter/load_reporter.cc | 3 ++- .../load_reporter_async_service_impl.cc | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cpp/server/load_reporter/load_reporter.cc b/src/cpp/server/load_reporter/load_reporter.cc index 2ef1b4933ad..1a8ad4a250e 100644 --- a/src/cpp/server/load_reporter/load_reporter.cc +++ b/src/cpp/server/load_reporter/load_reporter.cc @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -227,7 +228,7 @@ std::string LoadReporter::GenerateLbId() { GPR_ASSERT(lb_id >= 0); // Convert to padded hex string for a 32-bit LB ID. E.g, "0000ca5b". char buf[kLbIdLength + 1]; - snprintf(buf, sizeof(buf), "%08lx", lb_id); + snprintf(buf, sizeof(buf), "%08" PRIx64, lb_id); std::string lb_id_str(buf, kLbIdLength); // The client may send requests with LB ID that has never been allocated // by this load reporter. Those IDs are tracked and will be skipped when diff --git a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc index 73b8a903514..b76cd5db755 100644 --- a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc +++ b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc @@ -18,6 +18,8 @@ #include +#include + #include "absl/memory/memory.h" #include "src/cpp/server/load_reporter/load_reporter_async_service_impl.h" @@ -216,12 +218,12 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnReadDone( load_report_interval_ms_ = static_cast(load_report_interval.seconds() * 1000 + load_report_interval.nanos() / 1000); - gpr_log( - GPR_INFO, - "[LRS %p] Initial request received. Start load reporting (load " - "balanced host: %s, interval: %lu ms, lb_id_: %s, handler: %p)...", - service_, load_balanced_hostname_.c_str(), load_report_interval_ms_, - lb_id_.c_str(), this); + gpr_log(GPR_INFO, + "[LRS %p] Initial request received. Start load reporting (load " + "balanced host: %s, interval: %" PRIu64 + " ms, lb_id_: %s, handler: %p)...", + service_, load_balanced_hostname_.c_str(), + load_report_interval_ms_, lb_id_.c_str(), this); SendReport(self, true /* ok */); // Expect this read to fail. {