aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorIrina Tirdea <irina.tirdea@gmail.com>2012-09-10 18:15:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-09-11 11:19:15 -0400
commit1d037ca1648b775277fc96401ec2aa233724906c (patch)
tree266722dc6c9e00c67c66f5f8d06f30d0c2dd3979 /tools/perf/util/event.c
parent7dbf4dcfe2987c35c2c4675cd7ae1b6006979176 (diff)
perf tools: Use __maybe_used for unused variables
perf defines both __used and __unused variables to use for marking unused variables. The variable __used is defined to __attribute__((__unused__)), which contradicts the kernel definition to __attribute__((__used__)) for new gcc versions. On Android, __used is also defined in system headers and this leads to warnings like: warning: '__used__' attribute ignored __unused is not defined in the kernel and is not a standard definition. If __unused is included everywhere instead of __used, this leads to conflicts with glibc headers, since glibc has a variables with this name in its headers. The best approach is to use __maybe_unused, the definition used in the kernel for __attribute__((unused)). In this way there is only one definition in perf sources (instead of 2 definitions that point to the same thing: __used and __unused) and it works on both Linux and Android. This patch simply replaces all instances of __used and __unused with __maybe_unused. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Acked-by: Pekka Enberg <penberg@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1347315303-29906-7-git-send-email-irina.tirdea@intel.com [ committer note: fixed up conflict with a116e05 in builtin-sched.c ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index f7f480503af4..8202f5ca0483 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -514,9 +514,9 @@ size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)
514 return fprintf(fp, ": %s:%d\n", event->comm.comm, event->comm.tid); 514 return fprintf(fp, ": %s:%d\n", event->comm.comm, event->comm.tid);
515} 515}
516 516
517int perf_event__process_comm(struct perf_tool *tool __used, 517int perf_event__process_comm(struct perf_tool *tool __maybe_unused,
518 union perf_event *event, 518 union perf_event *event,
519 struct perf_sample *sample __used, 519 struct perf_sample *sample __maybe_unused,
520 struct machine *machine) 520 struct machine *machine)
521{ 521{
522 struct thread *thread = machine__findnew_thread(machine, event->comm.tid); 522 struct thread *thread = machine__findnew_thread(machine, event->comm.tid);
@@ -532,10 +532,10 @@ int perf_event__process_comm(struct perf_tool *tool __used,
532 return 0; 532 return 0;
533} 533}
534 534
535int perf_event__process_lost(struct perf_tool *tool __used, 535int perf_event__process_lost(struct perf_tool *tool __maybe_unused,
536 union perf_event *event, 536 union perf_event *event,
537 struct perf_sample *sample __used, 537 struct perf_sample *sample __maybe_unused,
538 struct machine *machine __used) 538 struct machine *machine __maybe_unused)
539{ 539{
540 dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n", 540 dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n",
541 event->lost.id, event->lost.lost); 541 event->lost.id, event->lost.lost);
@@ -555,7 +555,8 @@ static void perf_event__set_kernel_mmap_len(union perf_event *event,
555 maps[MAP__FUNCTION]->end = ~0ULL; 555 maps[MAP__FUNCTION]->end = ~0ULL;
556} 556}
557 557
558static int perf_event__process_kernel_mmap(struct perf_tool *tool __used, 558static int perf_event__process_kernel_mmap(struct perf_tool *tool
559 __maybe_unused,
559 union perf_event *event, 560 union perf_event *event,
560 struct machine *machine) 561 struct machine *machine)
561{ 562{
@@ -657,7 +658,7 @@ size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
657 658
658int perf_event__process_mmap(struct perf_tool *tool, 659int perf_event__process_mmap(struct perf_tool *tool,
659 union perf_event *event, 660 union perf_event *event,
660 struct perf_sample *sample __used, 661 struct perf_sample *sample __maybe_unused,
661 struct machine *machine) 662 struct machine *machine)
662{ 663{
663 struct thread *thread; 664 struct thread *thread;
@@ -701,9 +702,9 @@ size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
701 event->fork.ppid, event->fork.ptid); 702 event->fork.ppid, event->fork.ptid);
702} 703}
703 704
704int perf_event__process_task(struct perf_tool *tool __used, 705int perf_event__process_task(struct perf_tool *tool __maybe_unused,
705 union perf_event *event, 706 union perf_event *event,
706 struct perf_sample *sample __used, 707 struct perf_sample *sample __maybe_unused,
707 struct machine *machine) 708 struct machine *machine)
708{ 709{
709 struct thread *thread = machine__findnew_thread(machine, event->fork.tid); 710 struct thread *thread = machine__findnew_thread(machine, event->fork.tid);