aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2019-01-15 11:30:32 -0500
committerGravatar Benjamin Barenblat <bbaren@google.com>2019-01-15 11:30:32 -0500
commit8ce2783b4bc6d4507232362430554c6462790ce6 (patch)
treeceafdc43ce17fcd94f44213f21bb97186e143c86
parentb02fbfb90f691fa18e8f752286908f30da666bf9 (diff)
Correct a format stringHEADmaster
Use a format string macro from inttypes.h when printfing thread IDs on non-Windows, non-Linux platforms. This silences a -Wformat trigger when cross-compiling for macOS.
-rw-r--r--src/core/lib/gpr/log_posix.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc
index 0acb225572..b6edc14ab6 100644
--- a/src/core/lib/gpr/log_posix.cc
+++ b/src/core/lib/gpr/log_posix.cc
@@ -24,6 +24,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+#include <inttypes.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
@@ -83,7 +84,7 @@ void gpr_default_log(gpr_log_func_args* args) {
}
char* prefix;
- gpr_asprintf(&prefix, "%s%s.%09d %7tu %s:%d]",
+ gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]",
gpr_log_severity_string(args->severity), time_buffer,
(int)(now.tv_nsec), gettid(), display_file, args->line);