From a0d15b915f8092f9cfcd19a700e7059dbdaa5296 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 8 May 2018 17:19:38 -0400 Subject: [PATCH] perfglue: Silence truncation warning Signed-off-by: Adam C. Emerson --- src/perfglue/heap_profiler.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/perfglue/heap_profiler.cc b/src/perfglue/heap_profiler.cc index e35f6b1da24..dc1954012cf 100644 --- a/src/perfglue/heap_profiler.cc +++ b/src/perfglue/heap_profiler.cc @@ -79,6 +79,12 @@ bool ceph_heap_profiler_running() static void get_profile_name(char *profile_name, int profile_name_len) { +#if __GNUC__ && __GNUC__ >= 8 +#pragma GCC diagnostic push + // Don't care, it doesn't matter, and we can't do anything about it. +#pragma GCC diagnostic ignored "-Wformat-truncation" +#endif + char path[PATH_MAX]; snprintf(path, sizeof(path), "%s", g_conf->log_file.c_str()); char *last_slash = rindex(path, '/'); @@ -92,6 +98,9 @@ static void get_profile_name(char *profile_name, int profile_name_len) snprintf(profile_name, profile_name_len, "%s/%s.profile", path, g_conf->name.to_cstr()); } +#if __GNUC__ && __GNUC__ >= 8 +#pragma GCC diagnostic pop +#endif } void ceph_heap_profiler_start() -- 2.39.5