aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/alias.c3
-rw-r--r--tools/perf/util/annotate.c6
-rw-r--r--tools/perf/util/annotate.h13
-rw-r--r--tools/perf/util/build-id.c11
-rw-r--r--tools/perf/util/cache.h6
-rw-r--r--tools/perf/util/callchain.c6
-rw-r--r--tools/perf/util/cgroup.c4
-rw-r--r--tools/perf/util/config.c6
-rw-r--r--tools/perf/util/debug.h9
-rw-r--r--tools/perf/util/event.c19
-rw-r--r--tools/perf/util/header.c93
-rw-r--r--tools/perf/util/help.c3
-rw-r--r--tools/perf/util/hist.c2
-rw-r--r--tools/perf/util/hist.h32
-rw-r--r--tools/perf/util/include/linux/compiler.h4
-rw-r--r--tools/perf/util/intlist.c4
-rw-r--r--tools/perf/util/map.h2
-rw-r--r--tools/perf/util/parse-events-test.c6
-rw-r--r--tools/perf/util/parse-events.c7
-rw-r--r--tools/perf/util/parse-events.l2
-rw-r--r--tools/perf/util/parse-events.y4
-rw-r--r--tools/perf/util/parse-options.c3
-rw-r--r--tools/perf/util/perf_regs.h2
-rw-r--r--tools/perf/util/pmu.y6
-rw-r--r--tools/perf/util/probe-event.c21
-rw-r--r--tools/perf/util/probe-finder.c4
-rw-r--r--tools/perf/util/python.c8
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c8
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c10
-rw-r--r--tools/perf/util/session.c50
-rw-r--r--tools/perf/util/sort.c14
-rw-r--r--tools/perf/util/symbol-minimal.c28
-rw-r--r--tools/perf/util/symbol.c2
-rw-r--r--tools/perf/util/symbol.h7
-rw-r--r--tools/perf/util/trace-event-parse.c4
-rw-r--r--tools/perf/util/trace-event-scripting.c33
-rw-r--r--tools/perf/util/unwind.c36
-rw-r--r--tools/perf/util/unwind.h11
-rw-r--r--tools/perf/util/wrapper.c3
39 files changed, 270 insertions, 222 deletions
diff --git a/tools/perf/util/alias.c b/tools/perf/util/alias.c
index b8144e80bb1e..e6d134773d0a 100644
--- a/tools/perf/util/alias.c
+++ b/tools/perf/util/alias.c
@@ -3,7 +3,8 @@
3static const char *alias_key; 3static const char *alias_key;
4static char *alias_val; 4static char *alias_val;
5 5
6static int alias_lookup_cb(const char *k, const char *v, void *cb __used) 6static int alias_lookup_cb(const char *k, const char *v,
7 void *cb __maybe_unused)
7{ 8{
8 if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) { 9 if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
9 if (!v) 10 if (!v)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 04eafd3939df..f0a910371377 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -313,8 +313,8 @@ static struct ins_ops dec_ops = {
313 .scnprintf = dec__scnprintf, 313 .scnprintf = dec__scnprintf,
314}; 314};
315 315
316static int nop__scnprintf(struct ins *ins __used, char *bf, size_t size, 316static int nop__scnprintf(struct ins *ins __maybe_unused, char *bf, size_t size,
317 struct ins_operands *ops __used) 317 struct ins_operands *ops __maybe_unused)
318{ 318{
319 return scnprintf(bf, size, "%-6.6s", "nop"); 319 return scnprintf(bf, size, "%-6.6s", "nop");
320} 320}
@@ -416,7 +416,7 @@ static struct ins *ins__find(const char *name)
416 return bsearch(name, instructions, nmemb, sizeof(struct ins), ins__cmp); 416 return bsearch(name, instructions, nmemb, sizeof(struct ins), ins__cmp);
417} 417}
418 418
419int symbol__annotate_init(struct map *map __used, struct symbol *sym) 419int symbol__annotate_init(struct map *map __maybe_unused, struct symbol *sym)
420{ 420{
421 struct annotation *notes = symbol__annotation(sym); 421 struct annotation *notes = symbol__annotation(sym);
422 pthread_mutex_init(&notes->lock, NULL); 422 pthread_mutex_init(&notes->lock, NULL);
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 62a6e7a7365d..9b5b21e7b032 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -126,7 +126,7 @@ int symbol__alloc_hist(struct symbol *sym);
126void symbol__annotate_zero_histograms(struct symbol *sym); 126void symbol__annotate_zero_histograms(struct symbol *sym);
127 127
128int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize); 128int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize);
129int symbol__annotate_init(struct map *map __used, struct symbol *sym); 129int symbol__annotate_init(struct map *map __maybe_unused, struct symbol *sym);
130int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, 130int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
131 bool full_paths, int min_pcnt, int max_lines, 131 bool full_paths, int min_pcnt, int max_lines,
132 int context); 132 int context);
@@ -139,11 +139,12 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
139 int max_lines); 139 int max_lines);
140 140
141#ifdef NO_NEWT_SUPPORT 141#ifdef NO_NEWT_SUPPORT
142static inline int symbol__tui_annotate(struct symbol *sym __used, 142static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
143 struct map *map __used, 143 struct map *map __maybe_unused,
144 int evidx __used, 144 int evidx __maybe_unused,
145 void(*timer)(void *arg) __used, 145 void(*timer)(void *arg) __maybe_unused,
146 void *arg __used, int delay_secs __used) 146 void *arg __maybe_unused,
147 int delay_secs __maybe_unused)
147{ 148{
148 return 0; 149 return 0;
149} 150}
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index fd9a5944b627..8e3a740ddbd4 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -16,10 +16,10 @@
16#include "session.h" 16#include "session.h"
17#include "tool.h" 17#include "tool.h"
18 18
19static int build_id__mark_dso_hit(struct perf_tool *tool __used, 19static int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
20 union perf_event *event, 20 union perf_event *event,
21 struct perf_sample *sample __used, 21 struct perf_sample *sample __maybe_unused,
22 struct perf_evsel *evsel __used, 22 struct perf_evsel *evsel __maybe_unused,
23 struct machine *machine) 23 struct machine *machine)
24{ 24{
25 struct addr_location al; 25 struct addr_location al;
@@ -41,9 +41,10 @@ static int build_id__mark_dso_hit(struct perf_tool *tool __used,
41 return 0; 41 return 0;
42} 42}
43 43
44static int perf_event__exit_del_thread(struct perf_tool *tool __used, 44static int perf_event__exit_del_thread(struct perf_tool *tool __maybe_unused,
45 union perf_event *event, 45 union perf_event *event,
46 struct perf_sample *sample __used, 46 struct perf_sample *sample
47 __maybe_unused,
47 struct machine *machine) 48 struct machine *machine)
48{ 49{
49 struct thread *thread = machine__findnew_thread(machine, event->fork.tid); 50 struct thread *thread = machine__findnew_thread(machine, event->fork.tid);
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index cff18c617d13..ab1769426541 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -39,7 +39,7 @@ static inline void setup_browser(bool fallback_to_pager)
39 if (fallback_to_pager) 39 if (fallback_to_pager)
40 setup_pager(); 40 setup_pager();
41} 41}
42static inline void exit_browser(bool wait_for_ok __used) {} 42static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
43#else 43#else
44void setup_browser(bool fallback_to_pager); 44void setup_browser(bool fallback_to_pager);
45void exit_browser(bool wait_for_ok); 45void exit_browser(bool wait_for_ok);
@@ -49,7 +49,7 @@ static inline int ui__init(void)
49{ 49{
50 return -1; 50 return -1;
51} 51}
52static inline void ui__exit(bool wait_for_ok __used) {} 52static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
53#else 53#else
54int ui__init(void); 54int ui__init(void);
55void ui__exit(bool wait_for_ok); 55void ui__exit(bool wait_for_ok);
@@ -60,7 +60,7 @@ static inline int perf_gtk__init(void)
60{ 60{
61 return -1; 61 return -1;
62} 62}
63static inline void perf_gtk__exit(bool wait_for_ok __used) {} 63static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {}
64#else 64#else
65int perf_gtk__init(void); 65int perf_gtk__init(void);
66void perf_gtk__exit(bool wait_for_ok); 66void perf_gtk__exit(bool wait_for_ok);
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 3a6bff47614f..d3b3f5d82137 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -93,7 +93,7 @@ __sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node,
93 */ 93 */
94static void 94static void
95sort_chain_flat(struct rb_root *rb_root, struct callchain_root *root, 95sort_chain_flat(struct rb_root *rb_root, struct callchain_root *root,
96 u64 min_hit, struct callchain_param *param __used) 96 u64 min_hit, struct callchain_param *param __maybe_unused)
97{ 97{
98 __sort_chain_flat(rb_root, &root->node, min_hit); 98 __sort_chain_flat(rb_root, &root->node, min_hit);
99} 99}
@@ -115,7 +115,7 @@ static void __sort_chain_graph_abs(struct callchain_node *node,
115 115
116static void 116static void
117sort_chain_graph_abs(struct rb_root *rb_root, struct callchain_root *chain_root, 117sort_chain_graph_abs(struct rb_root *rb_root, struct callchain_root *chain_root,
118 u64 min_hit, struct callchain_param *param __used) 118 u64 min_hit, struct callchain_param *param __maybe_unused)
119{ 119{
120 __sort_chain_graph_abs(&chain_root->node, min_hit); 120 __sort_chain_graph_abs(&chain_root->node, min_hit);
121 rb_root->rb_node = chain_root->node.rb_root.rb_node; 121 rb_root->rb_node = chain_root->node.rb_root.rb_node;
@@ -140,7 +140,7 @@ static void __sort_chain_graph_rel(struct callchain_node *node,
140 140
141static void 141static void
142sort_chain_graph_rel(struct rb_root *rb_root, struct callchain_root *chain_root, 142sort_chain_graph_rel(struct rb_root *rb_root, struct callchain_root *chain_root,
143 u64 min_hit __used, struct callchain_param *param) 143 u64 min_hit __maybe_unused, struct callchain_param *param)
144{ 144{
145 __sort_chain_graph_rel(&chain_root->node, param->min_percent / 100.0); 145 __sort_chain_graph_rel(&chain_root->node, param->min_percent / 100.0);
146 rb_root->rb_node = chain_root->node.rb_root.rb_node; 146 rb_root->rb_node = chain_root->node.rb_root.rb_node;
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index dbe2f16b1a1a..96bbda1ddb83 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -138,8 +138,8 @@ void close_cgroup(struct cgroup_sel *cgrp)
138 } 138 }
139} 139}
140 140
141int parse_cgroups(const struct option *opt __used, const char *str, 141int parse_cgroups(const struct option *opt __maybe_unused, const char *str,
142 int unset __used) 142 int unset __maybe_unused)
143{ 143{
144 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value; 144 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
145 const char *p, *e, *eos = str + strlen(str); 145 const char *p, *e, *eos = str + strlen(str);
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 6faa3a18bfbd..3e0fdd369ccb 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -342,13 +342,15 @@ const char *perf_config_dirname(const char *name, const char *value)
342 return value; 342 return value;
343} 343}
344 344
345static int perf_default_core_config(const char *var __used, const char *value __used) 345static int perf_default_core_config(const char *var __maybe_unused,
346 const char *value __maybe_unused)
346{ 347{
347 /* Add other config variables here. */ 348 /* Add other config variables here. */
348 return 0; 349 return 0;
349} 350}
350 351
351int perf_default_config(const char *var, const char *value, void *dummy __used) 352int perf_default_config(const char *var, const char *value,
353 void *dummy __maybe_unused)
352{ 354{
353 if (!prefixcmp(var, "core.")) 355 if (!prefixcmp(var, "core."))
354 return perf_default_core_config(var, value); 356 return perf_default_core_config(var, value);
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 05e660cbf7e2..bb2e7d1007ab 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -16,19 +16,20 @@ struct ui_progress;
16struct perf_error_ops; 16struct perf_error_ops;
17 17
18#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) 18#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
19static inline void ui_progress__update(u64 curr __used, u64 total __used, 19static inline void ui_progress__update(u64 curr __maybe_unused,
20 const char *title __used) {} 20 u64 total __maybe_unused,
21 const char *title __maybe_unused) {}
21 22
22#define ui__error(format, arg...) ui__warning(format, ##arg) 23#define ui__error(format, arg...) ui__warning(format, ##arg)
23 24
24static inline int 25static inline int
25perf_error__register(struct perf_error_ops *eops __used) 26perf_error__register(struct perf_error_ops *eops __maybe_unused)
26{ 27{
27 return 0; 28 return 0;
28} 29}
29 30
30static inline int 31static inline int
31perf_error__unregister(struct perf_error_ops *eops __used) 32perf_error__unregister(struct perf_error_ops *eops __maybe_unused)
32{ 33{
33 return 0; 34 return 0;
34} 35}
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);
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 87996cab21d0..acbf6336199e 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -475,7 +475,7 @@ static bool perf_session__read_build_ids(struct perf_session *session, bool with
475 return ret; 475 return ret;
476} 476}
477 477
478static int write_tracing_data(int fd, struct perf_header *h __used, 478static int write_tracing_data(int fd, struct perf_header *h __maybe_unused,
479 struct perf_evlist *evlist) 479 struct perf_evlist *evlist)
480{ 480{
481 return read_tracing_data(fd, &evlist->entries); 481 return read_tracing_data(fd, &evlist->entries);
@@ -483,7 +483,7 @@ static int write_tracing_data(int fd, struct perf_header *h __used,
483 483
484 484
485static int write_build_id(int fd, struct perf_header *h, 485static int write_build_id(int fd, struct perf_header *h,
486 struct perf_evlist *evlist __used) 486 struct perf_evlist *evlist __maybe_unused)
487{ 487{
488 struct perf_session *session; 488 struct perf_session *session;
489 int err; 489 int err;
@@ -504,8 +504,8 @@ static int write_build_id(int fd, struct perf_header *h,
504 return 0; 504 return 0;
505} 505}
506 506
507static int write_hostname(int fd, struct perf_header *h __used, 507static int write_hostname(int fd, struct perf_header *h __maybe_unused,
508 struct perf_evlist *evlist __used) 508 struct perf_evlist *evlist __maybe_unused)
509{ 509{
510 struct utsname uts; 510 struct utsname uts;
511 int ret; 511 int ret;
@@ -517,8 +517,8 @@ static int write_hostname(int fd, struct perf_header *h __used,
517 return do_write_string(fd, uts.nodename); 517 return do_write_string(fd, uts.nodename);
518} 518}
519 519
520static int write_osrelease(int fd, struct perf_header *h __used, 520static int write_osrelease(int fd, struct perf_header *h __maybe_unused,
521 struct perf_evlist *evlist __used) 521 struct perf_evlist *evlist __maybe_unused)
522{ 522{
523 struct utsname uts; 523 struct utsname uts;
524 int ret; 524 int ret;
@@ -530,8 +530,8 @@ static int write_osrelease(int fd, struct perf_header *h __used,
530 return do_write_string(fd, uts.release); 530 return do_write_string(fd, uts.release);
531} 531}
532 532
533static int write_arch(int fd, struct perf_header *h __used, 533static int write_arch(int fd, struct perf_header *h __maybe_unused,
534 struct perf_evlist *evlist __used) 534 struct perf_evlist *evlist __maybe_unused)
535{ 535{
536 struct utsname uts; 536 struct utsname uts;
537 int ret; 537 int ret;
@@ -543,14 +543,14 @@ static int write_arch(int fd, struct perf_header *h __used,
543 return do_write_string(fd, uts.machine); 543 return do_write_string(fd, uts.machine);
544} 544}
545 545
546static int write_version(int fd, struct perf_header *h __used, 546static int write_version(int fd, struct perf_header *h __maybe_unused,
547 struct perf_evlist *evlist __used) 547 struct perf_evlist *evlist __maybe_unused)
548{ 548{
549 return do_write_string(fd, perf_version_string); 549 return do_write_string(fd, perf_version_string);
550} 550}
551 551
552static int write_cpudesc(int fd, struct perf_header *h __used, 552static int write_cpudesc(int fd, struct perf_header *h __maybe_unused,
553 struct perf_evlist *evlist __used) 553 struct perf_evlist *evlist __maybe_unused)
554{ 554{
555#ifndef CPUINFO_PROC 555#ifndef CPUINFO_PROC
556#define CPUINFO_PROC NULL 556#define CPUINFO_PROC NULL
@@ -608,8 +608,8 @@ done:
608 return ret; 608 return ret;
609} 609}
610 610
611static int write_nrcpus(int fd, struct perf_header *h __used, 611static int write_nrcpus(int fd, struct perf_header *h __maybe_unused,
612 struct perf_evlist *evlist __used) 612 struct perf_evlist *evlist __maybe_unused)
613{ 613{
614 long nr; 614 long nr;
615 u32 nrc, nra; 615 u32 nrc, nra;
@@ -634,7 +634,7 @@ static int write_nrcpus(int fd, struct perf_header *h __used,
634 return do_write(fd, &nra, sizeof(nra)); 634 return do_write(fd, &nra, sizeof(nra));
635} 635}
636 636
637static int write_event_desc(int fd, struct perf_header *h __used, 637static int write_event_desc(int fd, struct perf_header *h __maybe_unused,
638 struct perf_evlist *evlist) 638 struct perf_evlist *evlist)
639{ 639{
640 struct perf_evsel *evsel; 640 struct perf_evsel *evsel;
@@ -691,8 +691,8 @@ static int write_event_desc(int fd, struct perf_header *h __used,
691 return 0; 691 return 0;
692} 692}
693 693
694static int write_cmdline(int fd, struct perf_header *h __used, 694static int write_cmdline(int fd, struct perf_header *h __maybe_unused,
695 struct perf_evlist *evlist __used) 695 struct perf_evlist *evlist __maybe_unused)
696{ 696{
697 char buf[MAXPATHLEN]; 697 char buf[MAXPATHLEN];
698 char proc[32]; 698 char proc[32];
@@ -860,8 +860,8 @@ static struct cpu_topo *build_cpu_topology(void)
860 return tp; 860 return tp;
861} 861}
862 862
863static int write_cpu_topology(int fd, struct perf_header *h __used, 863static int write_cpu_topology(int fd, struct perf_header *h __maybe_unused,
864 struct perf_evlist *evlist __used) 864 struct perf_evlist *evlist __maybe_unused)
865{ 865{
866 struct cpu_topo *tp; 866 struct cpu_topo *tp;
867 u32 i; 867 u32 i;
@@ -896,8 +896,8 @@ done:
896 896
897 897
898 898
899static int write_total_mem(int fd, struct perf_header *h __used, 899static int write_total_mem(int fd, struct perf_header *h __maybe_unused,
900 struct perf_evlist *evlist __used) 900 struct perf_evlist *evlist __maybe_unused)
901{ 901{
902 char *buf = NULL; 902 char *buf = NULL;
903 FILE *fp; 903 FILE *fp;
@@ -982,8 +982,8 @@ done:
982 return ret; 982 return ret;
983} 983}
984 984
985static int write_numa_topology(int fd, struct perf_header *h __used, 985static int write_numa_topology(int fd, struct perf_header *h __maybe_unused,
986 struct perf_evlist *evlist __used) 986 struct perf_evlist *evlist __maybe_unused)
987{ 987{
988 char *buf = NULL; 988 char *buf = NULL;
989 size_t len = 0; 989 size_t len = 0;
@@ -1043,8 +1043,8 @@ done:
1043 * }; 1043 * };
1044 */ 1044 */
1045 1045
1046static int write_pmu_mappings(int fd, struct perf_header *h __used, 1046static int write_pmu_mappings(int fd, struct perf_header *h __maybe_unused,
1047 struct perf_evlist *evlist __used) 1047 struct perf_evlist *evlist __maybe_unused)
1048{ 1048{
1049 struct perf_pmu *pmu = NULL; 1049 struct perf_pmu *pmu = NULL;
1050 off_t offset = lseek(fd, 0, SEEK_CUR); 1050 off_t offset = lseek(fd, 0, SEEK_CUR);
@@ -1074,13 +1074,14 @@ static int write_pmu_mappings(int fd, struct perf_header *h __used,
1074 * default get_cpuid(): nothing gets recorded 1074 * default get_cpuid(): nothing gets recorded
1075 * actual implementation must be in arch/$(ARCH)/util/header.c 1075 * actual implementation must be in arch/$(ARCH)/util/header.c
1076 */ 1076 */
1077int __attribute__((weak)) get_cpuid(char *buffer __used, size_t sz __used) 1077int __attribute__ ((weak)) get_cpuid(char *buffer __maybe_unused,
1078 size_t sz __maybe_unused)
1078{ 1079{
1079 return -1; 1080 return -1;
1080} 1081}
1081 1082
1082static int write_cpuid(int fd, struct perf_header *h __used, 1083static int write_cpuid(int fd, struct perf_header *h __maybe_unused,
1083 struct perf_evlist *evlist __used) 1084 struct perf_evlist *evlist __maybe_unused)
1084{ 1085{
1085 char buffer[64]; 1086 char buffer[64];
1086 int ret; 1087 int ret;
@@ -1094,8 +1095,9 @@ write_it:
1094 return do_write_string(fd, buffer); 1095 return do_write_string(fd, buffer);
1095} 1096}
1096 1097
1097static int write_branch_stack(int fd __used, struct perf_header *h __used, 1098static int write_branch_stack(int fd __maybe_unused,
1098 struct perf_evlist *evlist __used) 1099 struct perf_header *h __maybe_unused,
1100 struct perf_evlist *evlist __maybe_unused)
1099{ 1101{
1100 return 0; 1102 return 0;
1101} 1103}
@@ -1372,7 +1374,8 @@ static void print_event_desc(struct perf_header *ph, int fd, FILE *fp)
1372 free_event_desc(events); 1374 free_event_desc(events);
1373} 1375}
1374 1376
1375static void print_total_mem(struct perf_header *h __used, int fd, FILE *fp) 1377static void print_total_mem(struct perf_header *h __maybe_unused, int fd,
1378 FILE *fp)
1376{ 1379{
1377 uint64_t mem; 1380 uint64_t mem;
1378 ssize_t ret; 1381 ssize_t ret;
@@ -1390,7 +1393,8 @@ error:
1390 fprintf(fp, "# total memory : unknown\n"); 1393 fprintf(fp, "# total memory : unknown\n");
1391} 1394}
1392 1395
1393static void print_numa_topology(struct perf_header *h __used, int fd, FILE *fp) 1396static void print_numa_topology(struct perf_header *h __maybe_unused, int fd,
1397 FILE *fp)
1394{ 1398{
1395 ssize_t ret; 1399 ssize_t ret;
1396 u32 nr, c, i; 1400 u32 nr, c, i;
@@ -1450,7 +1454,8 @@ static void print_cpuid(struct perf_header *ph, int fd, FILE *fp)
1450 free(str); 1454 free(str);
1451} 1455}
1452 1456
1453static void print_branch_stack(struct perf_header *ph __used, int fd __used, 1457static void print_branch_stack(struct perf_header *ph __maybe_unused,
1458 int fd __maybe_unused,
1454 FILE *fp) 1459 FILE *fp)
1455{ 1460{
1456 fprintf(fp, "# contains samples with branch stack\n"); 1461 fprintf(fp, "# contains samples with branch stack\n");
@@ -1649,9 +1654,10 @@ out:
1649 return err; 1654 return err;
1650} 1655}
1651 1656
1652static int process_tracing_data(struct perf_file_section *section __unused, 1657static int process_tracing_data(struct perf_file_section *section
1653 struct perf_header *ph __unused, 1658 __maybe_unused,
1654 int feat __unused, int fd, void *data) 1659 struct perf_header *ph __maybe_unused,
1660 int feat __maybe_unused, int fd, void *data)
1655{ 1661{
1656 trace_report(fd, data, false); 1662 trace_report(fd, data, false);
1657 return 0; 1663 return 0;
@@ -1659,7 +1665,8 @@ static int process_tracing_data(struct perf_file_section *section __unused,
1659 1665
1660static int process_build_id(struct perf_file_section *section, 1666static int process_build_id(struct perf_file_section *section,
1661 struct perf_header *ph, 1667 struct perf_header *ph,
1662 int feat __unused, int fd, void *data __used) 1668 int feat __maybe_unused, int fd,
1669 void *data __maybe_unused)
1663{ 1670{
1664 if (perf_header__read_build_ids(ph, fd, section->offset, section->size)) 1671 if (perf_header__read_build_ids(ph, fd, section->offset, section->size))
1665 pr_debug("Failed to read buildids, continuing...\n"); 1672 pr_debug("Failed to read buildids, continuing...\n");
@@ -1698,9 +1705,9 @@ perf_evlist__set_event_name(struct perf_evlist *evlist, struct perf_evsel *event
1698} 1705}
1699 1706
1700static int 1707static int
1701process_event_desc(struct perf_file_section *section __unused, 1708process_event_desc(struct perf_file_section *section __maybe_unused,
1702 struct perf_header *header, int feat __unused, int fd, 1709 struct perf_header *header, int feat __maybe_unused, int fd,
1703 void *data __used) 1710 void *data __maybe_unused)
1704{ 1711{
1705 struct perf_session *session = container_of(header, struct perf_session, header); 1712 struct perf_session *session = container_of(header, struct perf_session, header);
1706 struct perf_evsel *evsel, *events = read_event_desc(header, fd); 1713 struct perf_evsel *evsel, *events = read_event_desc(header, fd);
@@ -2596,7 +2603,7 @@ int perf_event__synthesize_event_types(struct perf_tool *tool,
2596 return err; 2603 return err;
2597} 2604}
2598 2605
2599int perf_event__process_event_type(struct perf_tool *tool __unused, 2606int perf_event__process_event_type(struct perf_tool *tool __maybe_unused,
2600 union perf_event *event) 2607 union perf_event *event)
2601{ 2608{
2602 if (perf_header__push_event(event->event_type.event_type.event_id, 2609 if (perf_header__push_event(event->event_type.event_type.event_id,
@@ -2613,7 +2620,7 @@ int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd,
2613 union perf_event ev; 2620 union perf_event ev;
2614 struct tracing_data *tdata; 2621 struct tracing_data *tdata;
2615 ssize_t size = 0, aligned_size = 0, padding; 2622 ssize_t size = 0, aligned_size = 0, padding;
2616 int err __used = 0; 2623 int err __maybe_unused = 0;
2617 2624
2618 /* 2625 /*
2619 * We are going to store the size of the data followed 2626 * We are going to store the size of the data followed
@@ -2712,7 +2719,7 @@ int perf_event__synthesize_build_id(struct perf_tool *tool,
2712 return err; 2719 return err;
2713} 2720}
2714 2721
2715int perf_event__process_build_id(struct perf_tool *tool __used, 2722int perf_event__process_build_id(struct perf_tool *tool __maybe_unused,
2716 union perf_event *event, 2723 union perf_event *event,
2717 struct perf_session *session) 2724 struct perf_session *session)
2718{ 2725{
diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c
index 4fa764d8f7d7..8b1f6e891b8a 100644
--- a/tools/perf/util/help.c
+++ b/tools/perf/util/help.c
@@ -332,7 +332,8 @@ const char *help_unknown_cmd(const char *cmd)
332 exit(1); 332 exit(1);
333} 333}
334 334
335int cmd_version(int argc __used, const char **argv __used, const char *prefix __used) 335int cmd_version(int argc __maybe_unused, const char **argv __maybe_unused,
336 const char *prefix __maybe_unused)
336{ 337{
337 printf("perf version %s\n", perf_version_string); 338 printf("perf version %s\n", perf_version_string);
338 return 0; 339 return 0;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 0ba65ad07cd1..6ec5398de89d 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -394,7 +394,7 @@ void hist_entry__free(struct hist_entry *he)
394 * collapse the histogram 394 * collapse the histogram
395 */ 395 */
396 396
397static bool hists__collapse_insert_entry(struct hists *hists __used, 397static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused,
398 struct rb_root *root, 398 struct rb_root *root,
399 struct hist_entry *he) 399 struct hist_entry *he)
400{ 400{
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 4146f51124f0..f011ad4756e8 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -156,20 +156,22 @@ struct perf_evlist;
156 156
157#ifdef NO_NEWT_SUPPORT 157#ifdef NO_NEWT_SUPPORT
158static inline 158static inline
159int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __used, 159int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
160 const char *help __used, 160 const char *help __maybe_unused,
161 void(*timer)(void *arg) __used, 161 void(*timer)(void *arg) __maybe_unused,
162 void *arg __used, 162 void *arg __maybe_unused,
163 int refresh __used) 163 int refresh __maybe_unused)
164{ 164{
165 return 0; 165 return 0;
166} 166}
167 167
168static inline int hist_entry__tui_annotate(struct hist_entry *self __used, 168static inline int hist_entry__tui_annotate(struct hist_entry *self
169 int evidx __used, 169 __maybe_unused,
170 void(*timer)(void *arg) __used, 170 int evidx __maybe_unused,
171 void *arg __used, 171 void(*timer)(void *arg)
172 int delay_secs __used) 172 __maybe_unused,
173 void *arg __maybe_unused,
174 int delay_secs __maybe_unused)
173{ 175{
174 return 0; 176 return 0;
175} 177}
@@ -187,11 +189,11 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
187 189
188#ifdef NO_GTK2_SUPPORT 190#ifdef NO_GTK2_SUPPORT
189static inline 191static inline
190int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __used, 192int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused,
191 const char *help __used, 193 const char *help __maybe_unused,
192 void(*timer)(void *arg) __used, 194 void(*timer)(void *arg) __maybe_unused,
193 void *arg __used, 195 void *arg __maybe_unused,
194 int refresh __used) 196 int refresh __maybe_unused)
195{ 197{
196 return 0; 198 return 0;
197} 199}
diff --git a/tools/perf/util/include/linux/compiler.h b/tools/perf/util/include/linux/compiler.h
index ce2367b7b3f6..96b919dae11c 100644
--- a/tools/perf/util/include/linux/compiler.h
+++ b/tools/perf/util/include/linux/compiler.h
@@ -9,7 +9,9 @@
9#define __attribute_const__ 9#define __attribute_const__
10#endif 10#endif
11 11
12#define __used __attribute__((__unused__)) 12#ifndef __maybe_unused
13#define __maybe_unused __attribute__((unused))
14#endif
13#define __packed __attribute__((__packed__)) 15#define __packed __attribute__((__packed__))
14 16
15#ifndef __force 17#ifndef __force
diff --git a/tools/perf/util/intlist.c b/tools/perf/util/intlist.c
index 77c504ff0088..9d0740024ba8 100644
--- a/tools/perf/util/intlist.c
+++ b/tools/perf/util/intlist.c
@@ -11,7 +11,7 @@
11 11
12#include "intlist.h" 12#include "intlist.h"
13 13
14static struct rb_node *intlist__node_new(struct rblist *rblist __used, 14static struct rb_node *intlist__node_new(struct rblist *rblist __maybe_unused,
15 const void *entry) 15 const void *entry)
16{ 16{
17 int i = (int)((long)entry); 17 int i = (int)((long)entry);
@@ -31,7 +31,7 @@ static void int_node__delete(struct int_node *ilist)
31 free(ilist); 31 free(ilist);
32} 32}
33 33
34static void intlist__node_delete(struct rblist *rblist __used, 34static void intlist__node_delete(struct rblist *rblist __maybe_unused,
35 struct rb_node *rb_node) 35 struct rb_node *rb_node)
36{ 36{
37 struct int_node *node = container_of(rb_node, struct int_node, rb_node); 37 struct int_node *node = container_of(rb_node, struct int_node, rb_node);
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 25ab4cdbc446..d2250fc97e25 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -96,7 +96,7 @@ static inline u64 map__unmap_ip(struct map *map, u64 ip)
96 return ip + map->start - map->pgoff; 96 return ip + map->start - map->pgoff;
97} 97}
98 98
99static inline u64 identity__map_ip(struct map *map __used, u64 ip) 99static inline u64 identity__map_ip(struct map *map __maybe_unused, u64 ip)
100{ 100{
101 return ip; 101 return ip;
102} 102}
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c
index bc8b65130ae0..d7244e553670 100644
--- a/tools/perf/util/parse-events-test.c
+++ b/tools/perf/util/parse-events-test.c
@@ -569,7 +569,7 @@ static int test__group2(struct perf_evlist *evlist)
569 return 0; 569 return 0;
570} 570}
571 571
572static int test__group3(struct perf_evlist *evlist __used) 572static int test__group3(struct perf_evlist *evlist __maybe_unused)
573{ 573{
574 struct perf_evsel *evsel, *leader; 574 struct perf_evsel *evsel, *leader;
575 575
@@ -648,7 +648,7 @@ static int test__group3(struct perf_evlist *evlist __used)
648 return 0; 648 return 0;
649} 649}
650 650
651static int test__group4(struct perf_evlist *evlist __used) 651static int test__group4(struct perf_evlist *evlist __maybe_unused)
652{ 652{
653 struct perf_evsel *evsel, *leader; 653 struct perf_evsel *evsel, *leader;
654 654
@@ -684,7 +684,7 @@ static int test__group4(struct perf_evlist *evlist __used)
684 return 0; 684 return 0;
685} 685}
686 686
687static int test__group5(struct perf_evlist *evlist __used) 687static int test__group5(struct perf_evlist *evlist __maybe_unused)
688{ 688{
689 struct perf_evsel *evsel, *leader; 689 struct perf_evsel *evsel, *leader;
690 690
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index a031ee1f54f6..44afcf40f796 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -807,7 +807,8 @@ int parse_events_terms(struct list_head *terms, const char *str)
807 return ret; 807 return ret;
808} 808}
809 809
810int parse_events(struct perf_evlist *evlist, const char *str, int unset __used) 810int parse_events(struct perf_evlist *evlist, const char *str,
811 int unset __maybe_unused)
811{ 812{
812 struct parse_events_data__events data = { 813 struct parse_events_data__events data = {
813 .list = LIST_HEAD_INIT(data.list), 814 .list = LIST_HEAD_INIT(data.list),
@@ -833,14 +834,14 @@ int parse_events(struct perf_evlist *evlist, const char *str, int unset __used)
833} 834}
834 835
835int parse_events_option(const struct option *opt, const char *str, 836int parse_events_option(const struct option *opt, const char *str,
836 int unset __used) 837 int unset __maybe_unused)
837{ 838{
838 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value; 839 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
839 return parse_events(evlist, str, unset); 840 return parse_events(evlist, str, unset);
840} 841}
841 842
842int parse_filter(const struct option *opt, const char *str, 843int parse_filter(const struct option *opt, const char *str,
843 int unset __used) 844 int unset __maybe_unused)
844{ 845{
845 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value; 846 struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
846 struct perf_evsel *last = NULL; 847 struct perf_evsel *last = NULL;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index f5e28dc68270..c87efc12579d 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -207,7 +207,7 @@ r{num_raw_hex} { return raw(yyscanner); }
207 207
208%% 208%%
209 209
210int parse_events_wrap(void *scanner __used) 210int parse_events_wrap(void *scanner __maybe_unused)
211{ 211{
212 return 1; 212 return 1;
213} 213}
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 42d9a17b83b1..cd88209e3c58 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -391,7 +391,7 @@ sep_slash_dc: '/' | ':' |
391 391
392%% 392%%
393 393
394void parse_events_error(void *data __used, void *scanner __used, 394void parse_events_error(void *data __maybe_unused, void *scanner __maybe_unused,
395 char const *msg __used) 395 char const *msg __maybe_unused)
396{ 396{
397} 397}
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 594f8fad5ecd..443fc116512b 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -557,7 +557,8 @@ int parse_options_usage(const char * const *usagestr,
557} 557}
558 558
559 559
560int parse_opt_verbosity_cb(const struct option *opt, const char *arg __used, 560int parse_opt_verbosity_cb(const struct option *opt,
561 const char *arg __maybe_unused,
561 int unset) 562 int unset)
562{ 563{
563 int *target = opt->value; 564 int *target = opt->value;
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 9bd6c4e069c8..316dbe7f86ed 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -6,7 +6,7 @@
6#else 6#else
7#define PERF_REGS_MASK 0 7#define PERF_REGS_MASK 0
8 8
9static inline const char *perf_reg_name(int id __used) 9static inline const char *perf_reg_name(int id __maybe_unused)
10{ 10{
11 return NULL; 11 return NULL;
12} 12}
diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
index 20ea77e93169..ec898047ebb9 100644
--- a/tools/perf/util/pmu.y
+++ b/tools/perf/util/pmu.y
@@ -86,8 +86,8 @@ PP_VALUE
86 86
87%% 87%%
88 88
89void perf_pmu_error(struct list_head *list __used, 89void perf_pmu_error(struct list_head *list __maybe_unused,
90 char *name __used, 90 char *name __maybe_unused,
91 char const *msg __used) 91 char const *msg __maybe_unused)
92{ 92{
93} 93}
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e8c72de0f70c..4ce04c2281d3 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -41,7 +41,7 @@
41#include "symbol.h" 41#include "symbol.h"
42#include "thread.h" 42#include "thread.h"
43#include "debugfs.h" 43#include "debugfs.h"
44#include "trace-event.h" /* For __unused */ 44#include "trace-event.h" /* For __maybe_unused */
45#include "probe-event.h" 45#include "probe-event.h"
46#include "probe-finder.h" 46#include "probe-finder.h"
47#include "session.h" 47#include "session.h"
@@ -647,8 +647,8 @@ static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
647} 647}
648 648
649static int try_to_find_probe_trace_events(struct perf_probe_event *pev, 649static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
650 struct probe_trace_event **tevs __unused, 650 struct probe_trace_event **tevs __maybe_unused,
651 int max_tevs __unused, const char *target) 651 int max_tevs __maybe_unused, const char *target)
652{ 652{
653 if (perf_probe_event_need_dwarf(pev)) { 653 if (perf_probe_event_need_dwarf(pev)) {
654 pr_warning("Debuginfo-analysis is not supported.\n"); 654 pr_warning("Debuginfo-analysis is not supported.\n");
@@ -661,17 +661,18 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
661 return 0; 661 return 0;
662} 662}
663 663
664int show_line_range(struct line_range *lr __unused, const char *module __unused) 664int show_line_range(struct line_range *lr __maybe_unused,
665 const char *module __maybe_unused)
665{ 666{
666 pr_warning("Debuginfo-analysis is not supported.\n"); 667 pr_warning("Debuginfo-analysis is not supported.\n");
667 return -ENOSYS; 668 return -ENOSYS;
668} 669}
669 670
670int show_available_vars(struct perf_probe_event *pevs __unused, 671int show_available_vars(struct perf_probe_event *pevs __maybe_unused,
671 int npevs __unused, int max_vls __unused, 672 int npevs __maybe_unused, int max_vls __maybe_unused,
672 const char *module __unused, 673 const char *module __maybe_unused,
673 struct strfilter *filter __unused, 674 struct strfilter *filter __maybe_unused,
674 bool externs __unused) 675 bool externs __maybe_unused)
675{ 676{
676 pr_warning("Debuginfo-analysis is not supported.\n"); 677 pr_warning("Debuginfo-analysis is not supported.\n");
677 return -ENOSYS; 678 return -ENOSYS;
@@ -2183,7 +2184,7 @@ static struct strfilter *available_func_filter;
2183 * If a symbol corresponds to a function with global binding and 2184 * If a symbol corresponds to a function with global binding and
2184 * matches filter return 0. For all others return 1. 2185 * matches filter return 0. For all others return 1.
2185 */ 2186 */
2186static int filter_available_functions(struct map *map __unused, 2187static int filter_available_functions(struct map *map __maybe_unused,
2187 struct symbol *sym) 2188 struct symbol *sym)
2188{ 2189{
2189 if (sym->binding == STB_GLOBAL && 2190 if (sym->binding == STB_GLOBAL &&
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index d448984ed789..526ba56e720b 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -207,7 +207,7 @@ static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self,
207#else 207#else
208/* With older elfutils, this just support kernel module... */ 208/* With older elfutils, this just support kernel module... */
209static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self, 209static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self,
210 Dwarf_Addr addr __used) 210 Dwarf_Addr addr __maybe_unused)
211{ 211{
212 const char *path = kernel_get_module_path("kernel"); 212 const char *path = kernel_get_module_path("kernel");
213 213
@@ -1419,7 +1419,7 @@ static int line_range_add_line(const char *src, unsigned int lineno,
1419} 1419}
1420 1420
1421static int line_range_walk_cb(const char *fname, int lineno, 1421static int line_range_walk_cb(const char *fname, int lineno,
1422 Dwarf_Addr addr __used, 1422 Dwarf_Addr addr __maybe_unused,
1423 void *data) 1423 void *data)
1424{ 1424{
1425 struct line_finder *lf = data; 1425 struct line_finder *lf = data;
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 27187f0b71f0..ca85444bcfbf 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -672,7 +672,7 @@ struct pyrf_evlist {
672}; 672};
673 673
674static int pyrf_evlist__init(struct pyrf_evlist *pevlist, 674static int pyrf_evlist__init(struct pyrf_evlist *pevlist,
675 PyObject *args, PyObject *kwargs __used) 675 PyObject *args, PyObject *kwargs __maybe_unused)
676{ 676{
677 PyObject *pcpus = NULL, *pthreads = NULL; 677 PyObject *pcpus = NULL, *pthreads = NULL;
678 struct cpu_map *cpus; 678 struct cpu_map *cpus;
@@ -733,7 +733,8 @@ static PyObject *pyrf_evlist__poll(struct pyrf_evlist *pevlist,
733} 733}
734 734
735static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist, 735static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist,
736 PyObject *args __used, PyObject *kwargs __used) 736 PyObject *args __maybe_unused,
737 PyObject *kwargs __maybe_unused)
737{ 738{
738 struct perf_evlist *evlist = &pevlist->evlist; 739 struct perf_evlist *evlist = &pevlist->evlist;
739 PyObject *list = PyList_New(0); 740 PyObject *list = PyList_New(0);
@@ -765,7 +766,8 @@ free_list:
765 766
766 767
767static PyObject *pyrf_evlist__add(struct pyrf_evlist *pevlist, 768static PyObject *pyrf_evlist__add(struct pyrf_evlist *pevlist,
768 PyObject *args, PyObject *kwargs __used) 769 PyObject *args,
770 PyObject *kwargs __maybe_unused)
769{ 771{
770 struct perf_evlist *evlist = &pevlist->evlist; 772 struct perf_evlist *evlist = &pevlist->evlist;
771 PyObject *pevsel; 773 PyObject *pevsel;
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 94e673643bcb..ffde3e4e34aa 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -257,10 +257,10 @@ static inline struct event_format *find_cache_event(struct perf_evsel *evsel)
257 return event; 257 return event;
258} 258}
259 259
260static void perl_process_tracepoint(union perf_event *perf_event __unused, 260static void perl_process_tracepoint(union perf_event *perf_event __maybe_unused,
261 struct perf_sample *sample, 261 struct perf_sample *sample,
262 struct perf_evsel *evsel, 262 struct perf_evsel *evsel,
263 struct machine *machine __unused, 263 struct machine *machine __maybe_unused,
264 struct addr_location *al) 264 struct addr_location *al)
265{ 265{
266 struct format_field *field; 266 struct format_field *field;
@@ -349,8 +349,8 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused,
349static void perl_process_event_generic(union perf_event *event, 349static void perl_process_event_generic(union perf_event *event,
350 struct perf_sample *sample, 350 struct perf_sample *sample,
351 struct perf_evsel *evsel, 351 struct perf_evsel *evsel,
352 struct machine *machine __unused, 352 struct machine *machine __maybe_unused,
353 struct addr_location *al __unused) 353 struct addr_location *al __maybe_unused)
354{ 354{
355 dSP; 355 dSP;
356 356
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index afba09729183..730c6630cba5 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -221,10 +221,11 @@ static inline struct event_format *find_cache_event(struct perf_evsel *evsel)
221 return event; 221 return event;
222} 222}
223 223
224static void python_process_tracepoint(union perf_event *perf_event __unused, 224static void python_process_tracepoint(union perf_event *perf_event
225 __maybe_unused,
225 struct perf_sample *sample, 226 struct perf_sample *sample,
226 struct perf_evsel *evsel, 227 struct perf_evsel *evsel,
227 struct machine *machine __unused, 228 struct machine *machine __maybe_unused,
228 struct addr_location *al) 229 struct addr_location *al)
229{ 230{
230 PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; 231 PyObject *handler, *retval, *context, *t, *obj, *dict = NULL;
@@ -339,10 +340,11 @@ static void python_process_tracepoint(union perf_event *perf_event __unused,
339 Py_DECREF(t); 340 Py_DECREF(t);
340} 341}
341 342
342static void python_process_general_event(union perf_event *perf_event __unused, 343static void python_process_general_event(union perf_event *perf_event
344 __maybe_unused,
343 struct perf_sample *sample, 345 struct perf_sample *sample,
344 struct perf_evsel *evsel, 346 struct perf_evsel *evsel,
345 struct machine *machine __unused, 347 struct machine *machine __maybe_unused,
346 struct addr_location *al) 348 struct addr_location *al)
347{ 349{
348 PyObject *handler, *retval, *t, *dict; 350 PyObject *handler, *retval, *t, *dict;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index e0fd6c71cc5f..3049b0ae7003 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -401,49 +401,53 @@ int machine__resolve_callchain(struct machine *machine,
401 401
402} 402}
403 403
404static int process_event_synth_tracing_data_stub(union perf_event *event __used, 404static int process_event_synth_tracing_data_stub(union perf_event *event
405 struct perf_session *session __used) 405 __maybe_unused,
406 struct perf_session *session
407 __maybe_unused)
406{ 408{
407 dump_printf(": unhandled!\n"); 409 dump_printf(": unhandled!\n");
408 return 0; 410 return 0;
409} 411}
410 412
411static int process_event_synth_attr_stub(union perf_event *event __used, 413static int process_event_synth_attr_stub(union perf_event *event __maybe_unused,
412 struct perf_evlist **pevlist __used) 414 struct perf_evlist **pevlist
415 __maybe_unused)
413{ 416{
414 dump_printf(": unhandled!\n"); 417 dump_printf(": unhandled!\n");
415 return 0; 418 return 0;
416} 419}
417 420
418static int process_event_sample_stub(struct perf_tool *tool __used, 421static int process_event_sample_stub(struct perf_tool *tool __maybe_unused,
419 union perf_event *event __used, 422 union perf_event *event __maybe_unused,
420 struct perf_sample *sample __used, 423 struct perf_sample *sample __maybe_unused,
421 struct perf_evsel *evsel __used, 424 struct perf_evsel *evsel __maybe_unused,
422 struct machine *machine __used) 425 struct machine *machine __maybe_unused)
423{ 426{
424 dump_printf(": unhandled!\n"); 427 dump_printf(": unhandled!\n");
425 return 0; 428 return 0;
426} 429}
427 430
428static int process_event_stub(struct perf_tool *tool __used, 431static int process_event_stub(struct perf_tool *tool __maybe_unused,
429 union perf_event *event __used, 432 union perf_event *event __maybe_unused,
430 struct perf_sample *sample __used, 433 struct perf_sample *sample __maybe_unused,
431 struct machine *machine __used) 434 struct machine *machine __maybe_unused)
432{ 435{
433 dump_printf(": unhandled!\n"); 436 dump_printf(": unhandled!\n");
434 return 0; 437 return 0;
435} 438}
436 439
437static int process_finished_round_stub(struct perf_tool *tool __used, 440static int process_finished_round_stub(struct perf_tool *tool __maybe_unused,
438 union perf_event *event __used, 441 union perf_event *event __maybe_unused,
439 struct perf_session *perf_session __used) 442 struct perf_session *perf_session
443 __maybe_unused)
440{ 444{
441 dump_printf(": unhandled!\n"); 445 dump_printf(": unhandled!\n");
442 return 0; 446 return 0;
443} 447}
444 448
445static int process_event_type_stub(struct perf_tool *tool __used, 449static int process_event_type_stub(struct perf_tool *tool __maybe_unused,
446 union perf_event *event __used) 450 union perf_event *event __maybe_unused)
447{ 451{
448 dump_printf(": unhandled!\n"); 452 dump_printf(": unhandled!\n");
449 return 0; 453 return 0;
@@ -520,7 +524,7 @@ static void swap_sample_id_all(union perf_event *event, void *data)
520} 524}
521 525
522static void perf_event__all64_swap(union perf_event *event, 526static void perf_event__all64_swap(union perf_event *event,
523 bool sample_id_all __used) 527 bool sample_id_all __maybe_unused)
524{ 528{
525 struct perf_event_header *hdr = &event->header; 529 struct perf_event_header *hdr = &event->header;
526 mem_bswap_64(hdr + 1, event->header.size - sizeof(*hdr)); 530 mem_bswap_64(hdr + 1, event->header.size - sizeof(*hdr));
@@ -631,7 +635,7 @@ void perf_event__attr_swap(struct perf_event_attr *attr)
631} 635}
632 636
633static void perf_event__hdr_attr_swap(union perf_event *event, 637static void perf_event__hdr_attr_swap(union perf_event *event,
634 bool sample_id_all __used) 638 bool sample_id_all __maybe_unused)
635{ 639{
636 size_t size; 640 size_t size;
637 641
@@ -643,14 +647,14 @@ static void perf_event__hdr_attr_swap(union perf_event *event,
643} 647}
644 648
645static void perf_event__event_type_swap(union perf_event *event, 649static void perf_event__event_type_swap(union perf_event *event,
646 bool sample_id_all __used) 650 bool sample_id_all __maybe_unused)
647{ 651{
648 event->event_type.event_type.event_id = 652 event->event_type.event_type.event_id =
649 bswap_64(event->event_type.event_type.event_id); 653 bswap_64(event->event_type.event_type.event_id);
650} 654}
651 655
652static void perf_event__tracing_data_swap(union perf_event *event, 656static void perf_event__tracing_data_swap(union perf_event *event,
653 bool sample_id_all __used) 657 bool sample_id_all __maybe_unused)
654{ 658{
655 event->tracing_data.size = bswap_32(event->tracing_data.size); 659 event->tracing_data.size = bswap_32(event->tracing_data.size);
656} 660}
@@ -791,7 +795,7 @@ static int flush_sample_queue(struct perf_session *s,
791 * etc... 795 * etc...
792 */ 796 */
793static int process_finished_round(struct perf_tool *tool, 797static int process_finished_round(struct perf_tool *tool,
794 union perf_event *event __used, 798 union perf_event *event __maybe_unused,
795 struct perf_session *session) 799 struct perf_session *session)
796{ 800{
797 int ret = flush_sample_queue(session, tool); 801 int ret = flush_sample_queue(session, tool);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 7a2fbd8855b7..0981bc7a2917 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -170,7 +170,7 @@ static int hist_entry__dso_snprintf(struct hist_entry *self, char *bf,
170 170
171static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym, 171static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
172 u64 ip, char level, char *bf, size_t size, 172 u64 ip, char level, char *bf, size_t size,
173 unsigned int width __used) 173 unsigned int width __maybe_unused)
174{ 174{
175 size_t ret = 0; 175 size_t ret = 0;
176 176
@@ -205,7 +205,8 @@ struct sort_entry sort_dso = {
205}; 205};
206 206
207static int hist_entry__sym_snprintf(struct hist_entry *self, char *bf, 207static int hist_entry__sym_snprintf(struct hist_entry *self, char *bf,
208 size_t size, unsigned int width __used) 208 size_t size,
209 unsigned int width __maybe_unused)
209{ 210{
210 return _hist_entry__sym_snprintf(self->ms.map, self->ms.sym, self->ip, 211 return _hist_entry__sym_snprintf(self->ms.map, self->ms.sym, self->ip,
211 self->level, bf, size, width); 212 self->level, bf, size, width);
@@ -248,7 +249,8 @@ sort__srcline_cmp(struct hist_entry *left, struct hist_entry *right)
248} 249}
249 250
250static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf, 251static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
251 size_t size, unsigned int width __used) 252 size_t size,
253 unsigned int width __maybe_unused)
252{ 254{
253 FILE *fp; 255 FILE *fp;
254 char cmd[PATH_MAX + 2], *path = self->srcline, *nl; 256 char cmd[PATH_MAX + 2], *path = self->srcline, *nl;
@@ -397,7 +399,8 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
397} 399}
398 400
399static int hist_entry__sym_from_snprintf(struct hist_entry *self, char *bf, 401static int hist_entry__sym_from_snprintf(struct hist_entry *self, char *bf,
400 size_t size, unsigned int width __used) 402 size_t size,
403 unsigned int width __maybe_unused)
401{ 404{
402 struct addr_map_symbol *from = &self->branch_info->from; 405 struct addr_map_symbol *from = &self->branch_info->from;
403 return _hist_entry__sym_snprintf(from->map, from->sym, from->addr, 406 return _hist_entry__sym_snprintf(from->map, from->sym, from->addr,
@@ -406,7 +409,8 @@ static int hist_entry__sym_from_snprintf(struct hist_entry *self, char *bf,
406} 409}
407 410
408static int hist_entry__sym_to_snprintf(struct hist_entry *self, char *bf, 411static int hist_entry__sym_to_snprintf(struct hist_entry *self, char *bf,
409 size_t size, unsigned int width __used) 412 size_t size,
413 unsigned int width __maybe_unused)
410{ 414{
411 struct addr_map_symbol *to = &self->branch_info->to; 415 struct addr_map_symbol *to = &self->branch_info->to;
412 return _hist_entry__sym_snprintf(to->map, to->sym, to->addr, 416 return _hist_entry__sym_snprintf(to->map, to->sym, to->addr,
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index 6738ea128c90..259f8f2ea9c9 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -69,8 +69,9 @@ static int read_build_id(void *note_data, size_t note_len, void *bf,
69 return -1; 69 return -1;
70} 70}
71 71
72int filename__read_debuglink(const char *filename __used, 72int filename__read_debuglink(const char *filename __maybe_unused,
73 char *debuglink __used, size_t size __used) 73 char *debuglink __maybe_unused,
74 size_t size __maybe_unused)
74{ 75{
75 return -1; 76 return -1;
76} 77}
@@ -241,7 +242,8 @@ out:
241 return ret; 242 return ret;
242} 243}
243 244
244int symsrc__init(struct symsrc *ss, struct dso *dso __used, const char *name, 245int symsrc__init(struct symsrc *ss, struct dso *dso __maybe_unused,
246 const char *name,
245 enum dso_binary_type type) 247 enum dso_binary_type type)
246{ 248{
247 int fd = open(name, O_RDONLY); 249 int fd = open(name, O_RDONLY);
@@ -260,13 +262,13 @@ out_close:
260 return -1; 262 return -1;
261} 263}
262 264
263bool symsrc__possibly_runtime(struct symsrc *ss __used) 265bool symsrc__possibly_runtime(struct symsrc *ss __maybe_unused)
264{ 266{
265 /* Assume all sym sources could be a runtime image. */ 267 /* Assume all sym sources could be a runtime image. */
266 return true; 268 return true;
267} 269}
268 270
269bool symsrc__has_symtab(struct symsrc *ss __used) 271bool symsrc__has_symtab(struct symsrc *ss __maybe_unused)
270{ 272{
271 return false; 273 return false;
272} 274}
@@ -277,17 +279,19 @@ void symsrc__destroy(struct symsrc *ss)
277 close(ss->fd); 279 close(ss->fd);
278} 280}
279 281
280int dso__synthesize_plt_symbols(struct dso *dso __used, 282int dso__synthesize_plt_symbols(struct dso *dso __maybe_unused,
281 struct symsrc *ss __used, 283 struct symsrc *ss __maybe_unused,
282 struct map *map __used, 284 struct map *map __maybe_unused,
283 symbol_filter_t filter __used) 285 symbol_filter_t filter __maybe_unused)
284{ 286{
285 return 0; 287 return 0;
286} 288}
287 289
288int dso__load_sym(struct dso *dso, struct map *map __used, struct symsrc *ss, 290int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
289 struct symsrc *runtime_ss __used, 291 struct symsrc *ss,
290 symbol_filter_t filter __used, int kmodule __used) 292 struct symsrc *runtime_ss __maybe_unused,
293 symbol_filter_t filter __maybe_unused,
294 int kmodule __maybe_unused)
291{ 295{
292 unsigned char *build_id[BUILD_ID_SIZE]; 296 unsigned char *build_id[BUILD_ID_SIZE];
293 297
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index bbb24e951656..e2e8c697cffe 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1755,7 +1755,7 @@ struct process_args {
1755}; 1755};
1756 1756
1757static int symbol__in_kernel(void *arg, const char *name, 1757static int symbol__in_kernel(void *arg, const char *name,
1758 char type __used, u64 start) 1758 char type __maybe_unused, u64 start)
1759{ 1759{
1760 struct process_args *args = arg; 1760 struct process_args *args = arg;
1761 1761
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index dde8a26f7be3..4ff45e30c726 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -21,14 +21,15 @@
21#ifdef HAVE_CPLUS_DEMANGLE 21#ifdef HAVE_CPLUS_DEMANGLE
22extern char *cplus_demangle(const char *, int); 22extern char *cplus_demangle(const char *, int);
23 23
24static inline char *bfd_demangle(void __used *v, const char *c, int i) 24static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
25{ 25{
26 return cplus_demangle(c, i); 26 return cplus_demangle(c, i);
27} 27}
28#else 28#else
29#ifdef NO_DEMANGLE 29#ifdef NO_DEMANGLE
30static inline char *bfd_demangle(void __used *v, const char __used *c, 30static inline char *bfd_demangle(void __maybe_unused *v,
31 int __used i) 31 const char __maybe_unused *c,
32 int __maybe_unused i)
32{ 33{
33 return NULL; 34 return NULL;
34} 35}
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index a5a554efeb50..aa4c860a21d1 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -221,7 +221,7 @@ void print_event(struct pevent *pevent, int cpu, void *data, int size,
221} 221}
222 222
223void parse_proc_kallsyms(struct pevent *pevent, 223void parse_proc_kallsyms(struct pevent *pevent,
224 char *file, unsigned int size __unused) 224 char *file, unsigned int size __maybe_unused)
225{ 225{
226 unsigned long long addr; 226 unsigned long long addr;
227 char *func; 227 char *func;
@@ -253,7 +253,7 @@ void parse_proc_kallsyms(struct pevent *pevent,
253} 253}
254 254
255void parse_ftrace_printk(struct pevent *pevent, 255void parse_ftrace_printk(struct pevent *pevent,
256 char *file, unsigned int size __unused) 256 char *file, unsigned int size __maybe_unused)
257{ 257{
258 unsigned long long addr; 258 unsigned long long addr;
259 char *printk; 259 char *printk;
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 302ff262494c..8715a1006d00 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -35,11 +35,11 @@ static int stop_script_unsupported(void)
35 return 0; 35 return 0;
36} 36}
37 37
38static void process_event_unsupported(union perf_event *event __unused, 38static void process_event_unsupported(union perf_event *event __maybe_unused,
39 struct perf_sample *sample __unused, 39 struct perf_sample *sample __maybe_unused,
40 struct perf_evsel *evsel __unused, 40 struct perf_evsel *evsel __maybe_unused,
41 struct machine *machine __unused, 41 struct machine *machine __maybe_unused,
42 struct addr_location *al __unused) 42 struct addr_location *al __maybe_unused)
43{ 43{
44} 44}
45 45
@@ -52,17 +52,19 @@ static void print_python_unsupported_msg(void)
52 "\n etc.\n"); 52 "\n etc.\n");
53} 53}
54 54
55static int python_start_script_unsupported(const char *script __unused, 55static int python_start_script_unsupported(const char *script __maybe_unused,
56 int argc __unused, 56 int argc __maybe_unused,
57 const char **argv __unused) 57 const char **argv __maybe_unused)
58{ 58{
59 print_python_unsupported_msg(); 59 print_python_unsupported_msg();
60 60
61 return -1; 61 return -1;
62} 62}
63 63
64static int python_generate_script_unsupported(struct pevent *pevent __unused, 64static int python_generate_script_unsupported(struct pevent *pevent
65 const char *outfile __unused) 65 __maybe_unused,
66 const char *outfile
67 __maybe_unused)
66{ 68{
67 print_python_unsupported_msg(); 69 print_python_unsupported_msg();
68 70
@@ -114,17 +116,18 @@ static void print_perl_unsupported_msg(void)
114 "\n etc.\n"); 116 "\n etc.\n");
115} 117}
116 118
117static int perl_start_script_unsupported(const char *script __unused, 119static int perl_start_script_unsupported(const char *script __maybe_unused,
118 int argc __unused, 120 int argc __maybe_unused,
119 const char **argv __unused) 121 const char **argv __maybe_unused)
120{ 122{
121 print_perl_unsupported_msg(); 123 print_perl_unsupported_msg();
122 124
123 return -1; 125 return -1;
124} 126}
125 127
126static int perl_generate_script_unsupported(struct pevent *pevent __unused, 128static int perl_generate_script_unsupported(struct pevent *pevent
127 const char *outfile __unused) 129 __maybe_unused,
130 const char *outfile __maybe_unused)
128{ 131{
129 print_perl_unsupported_msg(); 132 print_perl_unsupported_msg();
130 133
diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
index 00a42aa8d5c1..958723ba3d2e 100644
--- a/tools/perf/util/unwind.c
+++ b/tools/perf/util/unwind.c
@@ -307,32 +307,36 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
307 need_unwind_info, arg); 307 need_unwind_info, arg);
308} 308}
309 309
310static int access_fpreg(unw_addr_space_t __used as, unw_regnum_t __used num, 310static int access_fpreg(unw_addr_space_t __maybe_unused as,
311 unw_fpreg_t __used *val, int __used __write, 311 unw_regnum_t __maybe_unused num,
312 void __used *arg) 312 unw_fpreg_t __maybe_unused *val,
313 int __maybe_unused __write,
314 void __maybe_unused *arg)
313{ 315{
314 pr_err("unwind: access_fpreg unsupported\n"); 316 pr_err("unwind: access_fpreg unsupported\n");
315 return -UNW_EINVAL; 317 return -UNW_EINVAL;
316} 318}
317 319
318static int get_dyn_info_list_addr(unw_addr_space_t __used as, 320static int get_dyn_info_list_addr(unw_addr_space_t __maybe_unused as,
319 unw_word_t __used *dil_addr, 321 unw_word_t __maybe_unused *dil_addr,
320 void __used *arg) 322 void __maybe_unused *arg)
321{ 323{
322 return -UNW_ENOINFO; 324 return -UNW_ENOINFO;
323} 325}
324 326
325static int resume(unw_addr_space_t __used as, unw_cursor_t __used *cu, 327static int resume(unw_addr_space_t __maybe_unused as,
326 void __used *arg) 328 unw_cursor_t __maybe_unused *cu,
329 void __maybe_unused *arg)
327{ 330{
328 pr_err("unwind: resume unsupported\n"); 331 pr_err("unwind: resume unsupported\n");
329 return -UNW_EINVAL; 332 return -UNW_EINVAL;
330} 333}
331 334
332static int 335static int
333get_proc_name(unw_addr_space_t __used as, unw_word_t __used addr, 336get_proc_name(unw_addr_space_t __maybe_unused as,
334 char __used *bufp, size_t __used buf_len, 337 unw_word_t __maybe_unused addr,
335 unw_word_t __used *offp, void __used *arg) 338 char __maybe_unused *bufp, size_t __maybe_unused buf_len,
339 unw_word_t __maybe_unused *offp, void __maybe_unused *arg)
336{ 340{
337 pr_err("unwind: get_proc_name unsupported\n"); 341 pr_err("unwind: get_proc_name unsupported\n");
338 return -UNW_EINVAL; 342 return -UNW_EINVAL;
@@ -377,7 +381,7 @@ static int reg_value(unw_word_t *valp, struct regs_dump *regs, int id,
377 return 0; 381 return 0;
378} 382}
379 383
380static int access_mem(unw_addr_space_t __used as, 384static int access_mem(unw_addr_space_t __maybe_unused as,
381 unw_word_t addr, unw_word_t *valp, 385 unw_word_t addr, unw_word_t *valp,
382 int __write, void *arg) 386 int __write, void *arg)
383{ 387{
@@ -422,7 +426,7 @@ static int access_mem(unw_addr_space_t __used as,
422 return 0; 426 return 0;
423} 427}
424 428
425static int access_reg(unw_addr_space_t __used as, 429static int access_reg(unw_addr_space_t __maybe_unused as,
426 unw_regnum_t regnum, unw_word_t *valp, 430 unw_regnum_t regnum, unw_word_t *valp,
427 int __write, void *arg) 431 int __write, void *arg)
428{ 432{
@@ -454,9 +458,9 @@ static int access_reg(unw_addr_space_t __used as,
454 return 0; 458 return 0;
455} 459}
456 460
457static void put_unwind_info(unw_addr_space_t __used as, 461static void put_unwind_info(unw_addr_space_t __maybe_unused as,
458 unw_proc_info_t *pi __used, 462 unw_proc_info_t *pi __maybe_unused,
459 void *arg __used) 463 void *arg __maybe_unused)
460{ 464{
461 pr_debug("unwind: put_unwind_info called\n"); 465 pr_debug("unwind: put_unwind_info called\n");
462} 466}
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index 919bd6ad8501..a78c8b303bb5 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -22,11 +22,12 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
22int unwind__arch_reg_id(int regnum); 22int unwind__arch_reg_id(int regnum);
23#else 23#else
24static inline int 24static inline int
25unwind__get_entries(unwind_entry_cb_t cb __used, void *arg __used, 25unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
26 struct machine *machine __used, 26 void *arg __maybe_unused,
27 struct thread *thread __used, 27 struct machine *machine __maybe_unused,
28 u64 sample_uregs __used, 28 struct thread *thread __maybe_unused,
29 struct perf_sample *data __used) 29 u64 sample_uregs __maybe_unused,
30 struct perf_sample *data __maybe_unused)
30{ 31{
31 return 0; 32 return 0;
32} 33}
diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c
index 73e900edb5a2..19f15b650703 100644
--- a/tools/perf/util/wrapper.c
+++ b/tools/perf/util/wrapper.c
@@ -7,7 +7,8 @@
7 * There's no pack memory to release - but stay close to the Git 7 * There's no pack memory to release - but stay close to the Git
8 * version so wrap this away: 8 * version so wrap this away:
9 */ 9 */
10static inline void release_pack_memory(size_t size __used, int flag __used) 10static inline void release_pack_memory(size_t size __maybe_unused,
11 int flag __maybe_unused)
11{ 12{
12} 13}
13 14