[PATCH 17/22] perf diff: Use llabs() with 64-bit values

From: Arnaldo Carvalho de Melo
Date: Thu Nov 28 2019 - 08:41:34 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

To fix this build error on a debian mipsel cross build environment:

builtin-diff.c: In function 'compute_cycles_diff':
builtin-diff.c:649:10: error: absolute value function 'labs' given an argument of type 's64' {aka 'long long int'} but has parameter of type 'long int' which may cause truncation of value [-Werror=absolute-value]
649 | val = labs(pair->block_info->cycles_spark[i] -
| ^~~~

Fixes: cebf7d51a6c3 ("perf diff: Report noisy for cycles diff")
Cc: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Link: https://lkml.kernel.org/n/tip-pn7szy5uw384ntjgk6zckh6a@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/builtin-diff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index eae879376283..f8b6ae557d8b 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -646,7 +646,7 @@ static void compute_cycles_diff(struct hist_entry *he,
if (i >= he->block_info->num || i >= NUM_SPARKS)
break;

- val = labs(pair->block_info->cycles_spark[i] -
+ val = llabs(pair->block_info->cycles_spark[i] -
he->block_info->cycles_spark[i]);

update_spark_value(pair->diff.svals, NUM_SPARKS,
--
2.21.0