[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210209113357.1535104-1-Jianlin.Lv@arm.com>
Date: Tue, 9 Feb 2021 19:33:57 +0800
From: Jianlin Lv <Jianlin.Lv@....com>
To: john.garry@...wei.com, will@...nel.org, mathieu.poirier@...aro.org,
leo.yan@...aro.org, peterz@...radead.org, mingo@...hat.com,
acme@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
namhyung@...nel.org
Cc: Jianlin.Lv@....com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] perf tools: Fix arm64 build error with gcc-11
gcc version: 11.0.0 20210208 (experimental) (GCC)
Following build error on arm64:
.......
In function ‘printf’,
inlined from ‘regs_dump__printf’ at util/session.c:1141:3,
inlined from ‘regs__printf’ at util/session.c:1169:2:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:107:10: \
error: ‘%-5s’ directive argument is null [-Werror=format-overflow=]
107 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, \
__va_arg_pack ());
......
In function ‘fprintf’,
inlined from ‘perf_sample__fprintf_regs.isra’ at \
builtin-script.c:622:14:
/usr/include/aarch64-linux-gnu/bits/stdio2.h:100:10: \
error: ‘%5s’ directive argument is null [-Werror=format-overflow=]
100 | return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
101 | __va_arg_pack ());
cc1: all warnings being treated as errors
.......
This patch fixes Wformat-overflow warnings by replacing the return
value NULL of perf_reg_name with "unknown".
Signed-off-by: Jianlin Lv <Jianlin.Lv@....com>
---
tools/perf/arch/arm64/include/perf_regs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/arch/arm64/include/perf_regs.h b/tools/perf/arch/arm64/include/perf_regs.h
index baaa5e64a3fb..901419f907c0 100644
--- a/tools/perf/arch/arm64/include/perf_regs.h
+++ b/tools/perf/arch/arm64/include/perf_regs.h
@@ -85,10 +85,10 @@ static inline const char *perf_reg_name(int id)
case PERF_REG_ARM64_PC:
return "pc";
default:
- return NULL;
+ return "unknown";
}
- return NULL;
+ return "unknown";
}
#endif /* ARCH_PERF_REGS_H */
--
2.25.1
Powered by blists - more mailing lists