From 718607457994046f03cf0459517355c82391ed87 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 26 Jan 2022 19:10:43 +0000 Subject: [PATCH] common: fix compilation warnings in numa.cc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ``` [141/1591] Building CXX object src/common/CMakeFiles/common-common-objs.dir/numa.cc.o In file included from ../src/include/types.h:63, from ../src/include/stringify.h:7, from ../src/common/numa.cc:10: ../src/common/numa.cc: In function ‘std::string get_task_comm(pid_t)’: ../src/common/numa.cc:176:12: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare] 176 | assert(n <= sizeof(name)); | ~~^~~~~~~~~~~~~~~ ../src/common/numa.cc: At global scope: ../src/common/numa.cc:159:20: warning: ‘std::string get_task_comm(pid_t)’ defined but not used [-Wunused-function] 159 | static std::string get_task_comm(pid_t tid) | ^~~~~~~~~~~~~ ``` Signed-off-by: Radoslaw Zarzynski --- src/common/numa.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/numa.cc b/src/common/numa.cc index 7af8247f2a5..f62f0d010b7 100644 --- a/src/common/numa.cc +++ b/src/common/numa.cc @@ -156,6 +156,7 @@ static int easy_readdir(const std::string& dir, std::set *out) return 0; } +#ifdef HAVE_DPDK static std::string get_task_comm(pid_t tid) { static const char* comm_fmt = "/proc/self/task/%d/comm"; @@ -173,7 +174,7 @@ static std::string get_task_comm(pid_t tid) if (n < 0) { return ""; } - assert(n <= sizeof(name)); + assert(static_cast(n) <= sizeof(name)); if (name[n - 1] == '\n') { name[n - 1] = '\0'; } else { @@ -181,6 +182,7 @@ static std::string get_task_comm(pid_t tid) } return name; } +#endif int set_cpu_affinity_all_threads(size_t cpu_set_size, cpu_set_t *cpu_set) { -- 2.39.5