perf: Fix potential compilation error with some compilers
PATCH 1/1 perf: Fix potential compilation error with some compilers
The building of the perf tool failed in a SLES11 sp3 system with the following compilation error:
cc1: warnings being treated as errors util/scripting-engines/trace-event-perl.c: In function ‘perl_process_tracepoint’:util/scripting-engines/trace-event-perl.c:285: error: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘__u64’
This patch replaces PRIu64 which is "lu" by the explicit "llu" to fix this problem as __u64 is of type "long long unsigned".
--- .../perf/util/scripting-engines/trace-event-perl.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
tools/perf/util/scripting-engines/trace-event-perl.c +5 -1
@@ -281,8 +281,12 @@ static void perl_process_tracepoint(union perf_event *perf_event __maybe_unused,return ; event =find_cache_event (evsel); +/* +* attr.config is a __u64 which requires "%llu" to avoid compilation +* error/warning with some compilers. +*/ if (!event) -die ("ug! no event found for type %" PRIu64, evsel->attr.config); +die ("ug! no event found for type %llu" , evsel->attr.config); pid =raw_field_value (event,"common_pid" , data);
Signature · 1 line
1.7.1
tip-bot for Arnaldo Carvalho de Melo
merge bot[tip:perf/urgent] perf scripting perl: Fix build error on Fedora 12
perf scripting perl: Fix build error on Fedora 12
Commit-ID: 3b16ff89676d9902dc39976aee3cb0314ee37d93 Gitweb: http://git.kernel.org/tip/3b16ff89676d9902dc39976aee3cb0314ee37d93 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 14 Oct 2013 18:25:12 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 17 Oct 2013 16:24:26 -0300
perf scripting perl: Fix build error on Fedora 12
Cast __u64 to u64 to silence this warning on older distros, such as Fedora 12:
CC /tmp/build/perf/util/scripting-engines/trace-event-perl.o
cc1: warnings being treated as errors
util/scripting-engines/trace-event-perl.c: In function ‘perl_process_tracepoint’:
util/scripting-engines/trace-event-perl.c:285: error: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘__u64’ make[1]: *** [/tmp/build/perf/util/scripting-engines/trace-event-perl.o] Error 1
make: *** [install] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@fedora12 linux]$
--- tools/perf/util/scripting-engines/trace-event-perl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/scripting-engines/trace-event-perl.c +1 -1
@@ -282,7 +282,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __maybe_unused, event =find_cache_event (evsel);if (!event) -die ("ug! no event found for type %" PRIu64, evsel->attr.config); +die ("ug! no event found for type %" PRIu64, (u64 )evsel->attr.config); pid =raw_field_value (event,"common_pid" , data);