[PATCH v1 16/48] perf annotate powerpc: Silence -Wshorten-64-to-32 warnings
From: Ian Rogers
Date: Tue Apr 01 2025 - 14:28:13 EST
The clang warning -Wshorten-64-to-32 can be useful to catch
inadvertent truncation. In some instances this truncation can lead to
changing the sign of a result, for example, truncation to return an
int to fit a sort routine. Silence the warning by making the implicit
truncation explicit.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/arch/powerpc/annotate/instructions.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c
index ca567cfdcbdb..598dc10a1751 100644
--- a/tools/perf/arch/powerpc/annotate/instructions.c
+++ b/tools/perf/arch/powerpc/annotate/instructions.c
@@ -18,7 +18,7 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con
ops = &jump_ops;
- i = strlen(name) - 1;
+ i = (int)strlen(name) - 1;
if (i < 0)
return NULL;
--
2.49.0.504.g3bcea36a83-goog