Re: [PATCH] perf tests: objdump output can contain multi byte chunks

Arnaldo Carvalho de Melo
2016-08-02T19:56:21Z

Em Tue, Aug 02, 2016 at 04:33:16PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Aug 02, 2016 at 04:07:00PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Jan 13, 2016 at 10:22:04AM +0200, Adrian Hunter escreveu:
> > > Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> > Oops, this one got lost, finally applying...

> Ok, it failed for:

> ubuntu:16.04-x-armhf: FAIL
> ubuntu:16.04-x-powerpc64: FAIL
>
> Both are related to, which I am fixing:
>
> CC /tmp/build/perf/tests/code-reading.o
> In file included from /git/linux/tools/perf/util/cpumap.h:9:0,
> from /git/linux/tools/perf/util/evsel.h:11,
> from /git/linux/tools/perf/util/evlist.h:10,
> from tests/code-reading.c:9:
> tests/code-reading.c: In function 'read_via_objdump':
> tests/code-reading.c:197:12: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Werror=format=]
> pr_debug("objdump read too few bytes: %lu\n", len);
> ^
> /git/linux/tools/perf/util/debug.h:18:21: note: in definition of macro 'pr_fmt'
> #define pr_fmt(fmt) fmt
> ^
> tests/code-reading.c:197:3: note: in expansion of macro 'pr_debug'
> pr_debug("objdump read too few bytes: %lu\n", len);
> ^

Just use %zd for size_t:

[root@jouet ~]# dm ubuntu:16.04-x-armhf ubuntu:16.04-x-powerpc64
1: ubuntu:16.04-x-armhf: Ok
2: ubuntu:16.04-x-powerpc64: Ok
[root@jouet ~]#

- Arnaldo