aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
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
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')
-rw-r--r--tools/perf/bench/bench.h3
-rw-r--r--tools/perf/bench/mem-memcpy.c2
-rw-r--r--tools/perf/bench/mem-memset.c2
-rw-r--r--tools/perf/bench/sched-messaging.c2
-rw-r--r--tools/perf/bench/sched-pipe.c6
-rw-r--r--tools/perf/builtin-annotate.c2
-rw-r--r--tools/perf/builtin-bench.c2
-rw-r--r--tools/perf/builtin-buildid-cache.c7
-rw-r--r--tools/perf/builtin-buildid-list.c3
-rw-r--r--tools/perf/builtin-diff.c4
-rw-r--r--tools/perf/builtin-evlist.c2
-rw-r--r--tools/perf/builtin-help.c2
-rw-r--r--tools/perf/builtin-inject.c24
-rw-r--r--tools/perf/builtin-kmem.c22
-rw-r--r--tools/perf/builtin-kvm.c2
-rw-r--r--tools/perf/builtin-list.c2
-rw-r--r--tools/perf/builtin-lock.c4
-rw-r--r--tools/perf/builtin-probe.c24
-rw-r--r--tools/perf/builtin-record.c10
-rw-r--r--tools/perf/builtin-report.c11
-rw-r--r--tools/perf/builtin-sched.c102
-rw-r--r--tools/perf/builtin-script.c29
-rw-r--r--tools/perf/builtin-stat.c40
-rw-r--r--tools/perf/builtin-test.c9
-rw-r--r--tools/perf/builtin-timechart.c30
-rw-r--r--tools/perf/builtin-top.c7
-rw-r--r--tools/perf/ui/browser.c7
-rw-r--r--tools/perf/ui/browsers/annotate.c6
-rw-r--r--tools/perf/ui/gtk/browser.c5
-rw-r--r--tools/perf/ui/gtk/setup.c2
-rw-r--r--tools/perf/ui/gtk/util.c4
-rw-r--r--tools/perf/ui/helpline.c2
-rw-r--r--tools/perf/ui/helpline.h8
-rw-r--r--tools/perf/ui/hist.c21
-rw-r--r--tools/perf/ui/tui/setup.c4
-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
74 files changed, 491 insertions, 413 deletions
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
index a09bece6dad2..8f89998eeaf4 100644
--- a/tools/perf/bench/bench.h
+++ b/tools/perf/bench/bench.h
@@ -3,7 +3,8 @@
3 3
4extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); 4extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
5extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); 5extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);
6extern int bench_mem_memcpy(int argc, const char **argv, const char *prefix __used); 6extern int bench_mem_memcpy(int argc, const char **argv,
7 const char *prefix __maybe_unused);
7extern int bench_mem_memset(int argc, const char **argv, const char *prefix); 8extern int bench_mem_memset(int argc, const char **argv, const char *prefix);
8 9
9#define BENCH_FORMAT_DEFAULT_STR "default" 10#define BENCH_FORMAT_DEFAULT_STR "default"
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index 02dad5d3359b..93c83e3cb4a7 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -177,7 +177,7 @@ static double do_memcpy_gettimeofday(memcpy_t fn, size_t len, bool prefault)
177 } while (0) 177 } while (0)
178 178
179int bench_mem_memcpy(int argc, const char **argv, 179int bench_mem_memcpy(int argc, const char **argv,
180 const char *prefix __used) 180 const char *prefix __maybe_unused)
181{ 181{
182 int i; 182 int i;
183 size_t len; 183 size_t len;
diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c
index 350cc9557265..c6e4bc523492 100644
--- a/tools/perf/bench/mem-memset.c
+++ b/tools/perf/bench/mem-memset.c
@@ -171,7 +171,7 @@ static double do_memset_gettimeofday(memset_t fn, size_t len, bool prefault)
171 } while (0) 171 } while (0)
172 172
173int bench_mem_memset(int argc, const char **argv, 173int bench_mem_memset(int argc, const char **argv,
174 const char *prefix __used) 174 const char *prefix __maybe_unused)
175{ 175{
176 int i; 176 int i;
177 size_t len; 177 size_t len;
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index d1d1b30f99c1..cc1190a0849b 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -267,7 +267,7 @@ static const char * const bench_sched_message_usage[] = {
267}; 267};
268 268
269int bench_sched_messaging(int argc, const char **argv, 269int bench_sched_messaging(int argc, const char **argv,
270 const char *prefix __used) 270 const char *prefix __maybe_unused)
271{ 271{
272 unsigned int i, total_children; 272 unsigned int i, total_children;
273 struct timeval start, stop, diff; 273 struct timeval start, stop, diff;
diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 15911e9c587a..69cfba8d4c6c 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -43,7 +43,7 @@ static const char * const bench_sched_pipe_usage[] = {
43}; 43};
44 44
45int bench_sched_pipe(int argc, const char **argv, 45int bench_sched_pipe(int argc, const char **argv,
46 const char *prefix __used) 46 const char *prefix __maybe_unused)
47{ 47{
48 int pipe_1[2], pipe_2[2]; 48 int pipe_1[2], pipe_2[2];
49 int m = 0, i; 49 int m = 0, i;
@@ -55,8 +55,8 @@ int bench_sched_pipe(int argc, const char **argv,
55 * discarding returned value of read(), write() 55 * discarding returned value of read(), write()
56 * causes error in building environment for perf 56 * causes error in building environment for perf
57 */ 57 */
58 int __used ret, wait_stat; 58 int __maybe_unused ret, wait_stat;
59 pid_t pid, retpid __used; 59 pid_t pid, retpid __maybe_unused;
60 60
61 argc = parse_options(argc, argv, options, 61 argc = parse_options(argc, argv, options,
62 bench_sched_pipe_usage, 0); 62 bench_sched_pipe_usage, 0);
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 2f3f0029c0f7..9ea38540b873 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -239,7 +239,7 @@ static const char * const annotate_usage[] = {
239 NULL 239 NULL
240}; 240};
241 241
242int cmd_annotate(int argc, const char **argv, const char *prefix __used) 242int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
243{ 243{
244 struct perf_annotate annotate = { 244 struct perf_annotate annotate = {
245 .tool = { 245 .tool = {
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index 1f3100216448..cae9a5fd2ecf 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -173,7 +173,7 @@ static void all_subsystem(void)
173 all_suite(&subsystems[i]); 173 all_suite(&subsystems[i]);
174} 174}
175 175
176int cmd_bench(int argc, const char **argv, const char *prefix __used) 176int cmd_bench(int argc, const char **argv, const char *prefix __maybe_unused)
177{ 177{
178 int i, j, status = 0; 178 int i, j, status = 0;
179 179
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index 995368e84e42..83654557e108 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -51,8 +51,8 @@ static int build_id_cache__add_file(const char *filename, const char *debugdir)
51 return err; 51 return err;
52} 52}
53 53
54static int build_id_cache__remove_file(const char *filename __used, 54static int build_id_cache__remove_file(const char *filename __maybe_unused,
55 const char *debugdir __used) 55 const char *debugdir __maybe_unused)
56{ 56{
57 u8 build_id[BUILD_ID_SIZE]; 57 u8 build_id[BUILD_ID_SIZE];
58 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 58 char sbuild_id[BUILD_ID_SIZE * 2 + 1];
@@ -120,7 +120,8 @@ static int __cmd_buildid_cache(void)
120 return 0; 120 return 0;
121} 121}
122 122
123int cmd_buildid_cache(int argc, const char **argv, const char *prefix __used) 123int cmd_buildid_cache(int argc, const char **argv,
124 const char *prefix __maybe_unused)
124{ 125{
125 argc = parse_options(argc, argv, buildid_cache_options, 126 argc = parse_options(argc, argv, buildid_cache_options,
126 buildid_cache_usage, 0); 127 buildid_cache_usage, 0);
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 7d6842826a0c..1159feeebb19 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -103,7 +103,8 @@ static int __cmd_buildid_list(void)
103 return perf_session__list_build_ids(); 103 return perf_session__list_build_ids();
104} 104}
105 105
106int cmd_buildid_list(int argc, const char **argv, const char *prefix __used) 106int cmd_buildid_list(int argc, const char **argv,
107 const char *prefix __maybe_unused)
107{ 108{
108 argc = parse_options(argc, argv, options, buildid_list_usage, 0); 109 argc = parse_options(argc, argv, options, buildid_list_usage, 0);
109 setup_pager(); 110 setup_pager();
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index c4c6d76b70ea..761f4197a9e2 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -33,7 +33,7 @@ static int hists__add_entry(struct hists *self,
33 return -ENOMEM; 33 return -ENOMEM;
34} 34}
35 35
36static int diff__process_sample_event(struct perf_tool *tool __used, 36static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
37 union perf_event *event, 37 union perf_event *event,
38 struct perf_sample *sample, 38 struct perf_sample *sample,
39 struct perf_evsel *evsel, 39 struct perf_evsel *evsel,
@@ -242,7 +242,7 @@ static const struct option options[] = {
242 OPT_END() 242 OPT_END()
243}; 243};
244 244
245int cmd_diff(int argc, const char **argv, const char *prefix __used) 245int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
246{ 246{
247 sort_order = diff__default_sort_order; 247 sort_order = diff__default_sort_order;
248 argc = parse_options(argc, argv, options, diff_usage, 0); 248 argc = parse_options(argc, argv, options, diff_usage, 0);
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
index 0dd5a058f766..1fb164164fd0 100644
--- a/tools/perf/builtin-evlist.c
+++ b/tools/perf/builtin-evlist.c
@@ -113,7 +113,7 @@ static const char * const evlist_usage[] = {
113 NULL 113 NULL
114}; 114};
115 115
116int cmd_evlist(int argc, const char **argv, const char *prefix __used) 116int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
117{ 117{
118 struct perf_attr_details details = { .verbose = false, }; 118 struct perf_attr_details details = { .verbose = false, };
119 const char *input_name = NULL; 119 const char *input_name = NULL;
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index f9daae5ac47a..25c8b942ff85 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -426,7 +426,7 @@ static int show_html_page(const char *perf_cmd)
426 return 0; 426 return 0;
427} 427}
428 428
429int cmd_help(int argc, const char **argv, const char *prefix __used) 429int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
430{ 430{
431 const char *alias; 431 const char *alias;
432 int rc = 0; 432 int rc = 0;
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 64d8ba2fb7bc..1eaa6617c814 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -17,9 +17,9 @@
17static char const *input_name = "-"; 17static char const *input_name = "-";
18static bool inject_build_ids; 18static bool inject_build_ids;
19 19
20static int perf_event__repipe_synth(struct perf_tool *tool __used, 20static int perf_event__repipe_synth(struct perf_tool *tool __maybe_unused,
21 union perf_event *event, 21 union perf_event *event,
22 struct machine *machine __used) 22 struct machine *machine __maybe_unused)
23{ 23{
24 uint32_t size; 24 uint32_t size;
25 void *buf = event; 25 void *buf = event;
@@ -40,7 +40,8 @@ static int perf_event__repipe_synth(struct perf_tool *tool __used,
40 40
41static int perf_event__repipe_op2_synth(struct perf_tool *tool, 41static int perf_event__repipe_op2_synth(struct perf_tool *tool,
42 union perf_event *event, 42 union perf_event *event,
43 struct perf_session *session __used) 43 struct perf_session *session
44 __maybe_unused)
44{ 45{
45 return perf_event__repipe_synth(tool, event, NULL); 46 return perf_event__repipe_synth(tool, event, NULL);
46} 47}
@@ -52,13 +53,14 @@ static int perf_event__repipe_event_type_synth(struct perf_tool *tool,
52} 53}
53 54
54static int perf_event__repipe_tracing_data_synth(union perf_event *event, 55static int perf_event__repipe_tracing_data_synth(union perf_event *event,
55 struct perf_session *session __used) 56 struct perf_session *session
57 __maybe_unused)
56{ 58{
57 return perf_event__repipe_synth(NULL, event, NULL); 59 return perf_event__repipe_synth(NULL, event, NULL);
58} 60}
59 61
60static int perf_event__repipe_attr(union perf_event *event, 62static int perf_event__repipe_attr(union perf_event *event,
61 struct perf_evlist **pevlist __used) 63 struct perf_evlist **pevlist __maybe_unused)
62{ 64{
63 int ret; 65 int ret;
64 ret = perf_event__process_attr(event, pevlist); 66 ret = perf_event__process_attr(event, pevlist);
@@ -70,7 +72,7 @@ static int perf_event__repipe_attr(union perf_event *event,
70 72
71static int perf_event__repipe(struct perf_tool *tool, 73static int perf_event__repipe(struct perf_tool *tool,
72 union perf_event *event, 74 union perf_event *event,
73 struct perf_sample *sample __used, 75 struct perf_sample *sample __maybe_unused,
74 struct machine *machine) 76 struct machine *machine)
75{ 77{
76 return perf_event__repipe_synth(tool, event, machine); 78 return perf_event__repipe_synth(tool, event, machine);
@@ -78,8 +80,8 @@ static int perf_event__repipe(struct perf_tool *tool,
78 80
79static int perf_event__repipe_sample(struct perf_tool *tool, 81static int perf_event__repipe_sample(struct perf_tool *tool,
80 union perf_event *event, 82 union perf_event *event,
81 struct perf_sample *sample __used, 83 struct perf_sample *sample __maybe_unused,
82 struct perf_evsel *evsel __used, 84 struct perf_evsel *evsel __maybe_unused,
83 struct machine *machine) 85 struct machine *machine)
84{ 86{
85 return perf_event__repipe_synth(tool, event, machine); 87 return perf_event__repipe_synth(tool, event, machine);
@@ -163,7 +165,7 @@ static int dso__inject_build_id(struct dso *self, struct perf_tool *tool,
163static int perf_event__inject_buildid(struct perf_tool *tool, 165static int perf_event__inject_buildid(struct perf_tool *tool,
164 union perf_event *event, 166 union perf_event *event,
165 struct perf_sample *sample, 167 struct perf_sample *sample,
166 struct perf_evsel *evsel __used, 168 struct perf_evsel *evsel __maybe_unused,
167 struct machine *machine) 169 struct machine *machine)
168{ 170{
169 struct addr_location al; 171 struct addr_location al;
@@ -224,7 +226,7 @@ struct perf_tool perf_inject = {
224 226
225extern volatile int session_done; 227extern volatile int session_done;
226 228
227static void sig_handler(int sig __attribute__((__unused__))) 229static void sig_handler(int sig __maybe_unused)
228{ 230{
229 session_done = 1; 231 session_done = 1;
230} 232}
@@ -267,7 +269,7 @@ static const struct option options[] = {
267 OPT_END() 269 OPT_END()
268}; 270};
269 271
270int cmd_inject(int argc, const char **argv, const char *prefix __used) 272int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
271{ 273{
272 argc = parse_options(argc, argv, options, report_usage, 0); 274 argc = parse_options(argc, argv, options, report_usage, 0);
273 275
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index ad9f52097388..f5f8a6b745a3 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -320,7 +320,7 @@ static int perf_evsel__process_kmem_event(struct perf_evsel *evsel,
320 return 0; 320 return 0;
321} 321}
322 322
323static int process_sample_event(struct perf_tool *tool __used, 323static int process_sample_event(struct perf_tool *tool __maybe_unused,
324 union perf_event *event, 324 union perf_event *event,
325 struct perf_sample *sample, 325 struct perf_sample *sample,
326 struct perf_evsel *evsel, 326 struct perf_evsel *evsel,
@@ -672,8 +672,8 @@ static int setup_sorting(struct list_head *sort_list, const char *arg)
672 return 0; 672 return 0;
673} 673}
674 674
675static int parse_sort_opt(const struct option *opt __used, 675static int parse_sort_opt(const struct option *opt __maybe_unused,
676 const char *arg, int unset __used) 676 const char *arg, int unset __maybe_unused)
677{ 677{
678 if (!arg) 678 if (!arg)
679 return -1; 679 return -1;
@@ -686,22 +686,24 @@ static int parse_sort_opt(const struct option *opt __used,
686 return 0; 686 return 0;
687} 687}
688 688
689static int parse_caller_opt(const struct option *opt __used, 689static int parse_caller_opt(const struct option *opt __maybe_unused,
690 const char *arg __used, int unset __used) 690 const char *arg __maybe_unused,
691 int unset __maybe_unused)
691{ 692{
692 caller_flag = (alloc_flag + 1); 693 caller_flag = (alloc_flag + 1);
693 return 0; 694 return 0;
694} 695}
695 696
696static int parse_alloc_opt(const struct option *opt __used, 697static int parse_alloc_opt(const struct option *opt __maybe_unused,
697 const char *arg __used, int unset __used) 698 const char *arg __maybe_unused,
699 int unset __maybe_unused)
698{ 700{
699 alloc_flag = (caller_flag + 1); 701 alloc_flag = (caller_flag + 1);
700 return 0; 702 return 0;
701} 703}
702 704
703static int parse_line_opt(const struct option *opt __used, 705static int parse_line_opt(const struct option *opt __maybe_unused,
704 const char *arg, int unset __used) 706 const char *arg, int unset __maybe_unused)
705{ 707{
706 int lines; 708 int lines;
707 709
@@ -771,7 +773,7 @@ static int __cmd_record(int argc, const char **argv)
771 return cmd_record(i, rec_argv, NULL); 773 return cmd_record(i, rec_argv, NULL);
772} 774}
773 775
774int cmd_kmem(int argc, const char **argv, const char *prefix __used) 776int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
775{ 777{
776 argc = parse_options(argc, argv, kmem_options, kmem_usage, 0); 778 argc = parse_options(argc, argv, kmem_options, kmem_usage, 0);
777 779
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 9fc6e0fa3dce..4d2aa2cbeca8 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -102,7 +102,7 @@ static int __cmd_buildid_list(int argc, const char **argv)
102 return cmd_buildid_list(i, rec_argv, NULL); 102 return cmd_buildid_list(i, rec_argv, NULL);
103} 103}
104 104
105int cmd_kvm(int argc, const char **argv, const char *prefix __used) 105int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
106{ 106{
107 perf_host = 0; 107 perf_host = 0;
108 perf_guest = 1; 108 perf_guest = 1;
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index bdcff81b532a..1948eceb517a 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -14,7 +14,7 @@
14#include "util/parse-events.h" 14#include "util/parse-events.h"
15#include "util/cache.h" 15#include "util/cache.h"
16 16
17int cmd_list(int argc, const char **argv, const char *prefix __used) 17int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
18{ 18{
19 setup_pager(); 19 setup_pager();
20 20
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 75153c87e650..a8035207a3dd 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -870,7 +870,7 @@ static int dump_info(void)
870 return rc; 870 return rc;
871} 871}
872 872
873static int process_sample_event(struct perf_tool *tool __used, 873static int process_sample_event(struct perf_tool *tool __maybe_unused,
874 union perf_event *event, 874 union perf_event *event,
875 struct perf_sample *sample, 875 struct perf_sample *sample,
876 struct perf_evsel *evsel, 876 struct perf_evsel *evsel,
@@ -1020,7 +1020,7 @@ static int __cmd_record(int argc, const char **argv)
1020 return cmd_record(i, rec_argv, NULL); 1020 return cmd_record(i, rec_argv, NULL);
1021} 1021}
1022 1022
1023int cmd_lock(int argc, const char **argv, const char *prefix __used) 1023int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
1024{ 1024{
1025 unsigned int i; 1025 unsigned int i;
1026 int rc = 0; 1026 int rc = 0;
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index e215ae61b2ae..118aa8946573 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -143,8 +143,8 @@ static int parse_probe_event_argv(int argc, const char **argv)
143 return ret; 143 return ret;
144} 144}
145 145
146static int opt_add_probe_event(const struct option *opt __used, 146static int opt_add_probe_event(const struct option *opt __maybe_unused,
147 const char *str, int unset __used) 147 const char *str, int unset __maybe_unused)
148{ 148{
149 if (str) { 149 if (str) {
150 params.mod_events = true; 150 params.mod_events = true;
@@ -153,8 +153,8 @@ static int opt_add_probe_event(const struct option *opt __used,
153 return 0; 153 return 0;
154} 154}
155 155
156static int opt_del_probe_event(const struct option *opt __used, 156static int opt_del_probe_event(const struct option *opt __maybe_unused,
157 const char *str, int unset __used) 157 const char *str, int unset __maybe_unused)
158{ 158{
159 if (str) { 159 if (str) {
160 params.mod_events = true; 160 params.mod_events = true;
@@ -166,7 +166,7 @@ static int opt_del_probe_event(const struct option *opt __used,
166} 166}
167 167
168static int opt_set_target(const struct option *opt, const char *str, 168static int opt_set_target(const struct option *opt, const char *str,
169 int unset __used) 169 int unset __maybe_unused)
170{ 170{
171 int ret = -ENOENT; 171 int ret = -ENOENT;
172 172
@@ -188,8 +188,8 @@ static int opt_set_target(const struct option *opt, const char *str,
188} 188}
189 189
190#ifdef DWARF_SUPPORT 190#ifdef DWARF_SUPPORT
191static int opt_show_lines(const struct option *opt __used, 191static int opt_show_lines(const struct option *opt __maybe_unused,
192 const char *str, int unset __used) 192 const char *str, int unset __maybe_unused)
193{ 193{
194 int ret = 0; 194 int ret = 0;
195 195
@@ -209,8 +209,8 @@ static int opt_show_lines(const struct option *opt __used,
209 return ret; 209 return ret;
210} 210}
211 211
212static int opt_show_vars(const struct option *opt __used, 212static int opt_show_vars(const struct option *opt __maybe_unused,
213 const char *str, int unset __used) 213 const char *str, int unset __maybe_unused)
214{ 214{
215 struct perf_probe_event *pev = &params.events[params.nevents]; 215 struct perf_probe_event *pev = &params.events[params.nevents];
216 int ret; 216 int ret;
@@ -229,8 +229,8 @@ static int opt_show_vars(const struct option *opt __used,
229} 229}
230#endif 230#endif
231 231
232static int opt_set_filter(const struct option *opt __used, 232static int opt_set_filter(const struct option *opt __maybe_unused,
233 const char *str, int unset __used) 233 const char *str, int unset __maybe_unused)
234{ 234{
235 const char *err; 235 const char *err;
236 236
@@ -327,7 +327,7 @@ static const struct option options[] = {
327 OPT_END() 327 OPT_END()
328}; 328};
329 329
330int cmd_probe(int argc, const char **argv, const char *prefix __used) 330int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
331{ 331{
332 int ret; 332 int ret;
333 333
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 7b8b891d4d56..c643ed669ef9 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -92,8 +92,8 @@ static int write_output(struct perf_record *rec, void *buf, size_t size)
92 92
93static int process_synthesized_event(struct perf_tool *tool, 93static int process_synthesized_event(struct perf_tool *tool,
94 union perf_event *event, 94 union perf_event *event,
95 struct perf_sample *sample __used, 95 struct perf_sample *sample __maybe_unused,
96 struct machine *machine __used) 96 struct machine *machine __maybe_unused)
97{ 97{
98 struct perf_record *rec = container_of(tool, struct perf_record, tool); 98 struct perf_record *rec = container_of(tool, struct perf_record, tool);
99 if (write_output(rec, event, event->header.size) < 0) 99 if (write_output(rec, event, event->header.size) < 0)
@@ -159,7 +159,7 @@ static void sig_handler(int sig)
159 signr = sig; 159 signr = sig;
160} 160}
161 161
162static void perf_record__sig_exit(int exit_status __used, void *arg) 162static void perf_record__sig_exit(int exit_status __maybe_unused, void *arg)
163{ 163{
164 struct perf_record *rec = arg; 164 struct perf_record *rec = arg;
165 int status; 165 int status;
@@ -827,7 +827,7 @@ static int get_stack_size(char *str, unsigned long *_size)
827#endif /* !NO_LIBUNWIND_SUPPORT */ 827#endif /* !NO_LIBUNWIND_SUPPORT */
828 828
829static int 829static int
830parse_callchain_opt(const struct option *opt __used, const char *arg, 830parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
831 int unset) 831 int unset)
832{ 832{
833 struct perf_record *rec = (struct perf_record *)opt->value; 833 struct perf_record *rec = (struct perf_record *)opt->value;
@@ -1003,7 +1003,7 @@ const struct option record_options[] = {
1003 OPT_END() 1003 OPT_END()
1004}; 1004};
1005 1005
1006int cmd_record(int argc, const char **argv, const char *prefix __used) 1006int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
1007{ 1007{
1008 int err = -ENOMEM; 1008 int err = -ENOMEM;
1009 struct perf_evsel *pos; 1009 struct perf_evsel *pos;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1f8d11b4f7ff..97b2e6300f4c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -223,9 +223,9 @@ static int process_sample_event(struct perf_tool *tool,
223 223
224static int process_read_event(struct perf_tool *tool, 224static int process_read_event(struct perf_tool *tool,
225 union perf_event *event, 225 union perf_event *event,
226 struct perf_sample *sample __used, 226 struct perf_sample *sample __maybe_unused,
227 struct perf_evsel *evsel, 227 struct perf_evsel *evsel,
228 struct machine *machine __used) 228 struct machine *machine __maybe_unused)
229{ 229{
230 struct perf_report *rep = container_of(tool, struct perf_report, tool); 230 struct perf_report *rep = container_of(tool, struct perf_report, tool);
231 231
@@ -287,7 +287,7 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
287 287
288extern volatile int session_done; 288extern volatile int session_done;
289 289
290static void sig_handler(int sig __used) 290static void sig_handler(int sig __maybe_unused)
291{ 291{
292 session_done = 1; 292 session_done = 1;
293} 293}
@@ -533,13 +533,14 @@ setup:
533} 533}
534 534
535static int 535static int
536parse_branch_mode(const struct option *opt __used, const char *str __used, int unset) 536parse_branch_mode(const struct option *opt __maybe_unused,
537 const char *str __maybe_unused, int unset)
537{ 538{
538 sort__branch_mode = !unset; 539 sort__branch_mode = !unset;
539 return 0; 540 return 0;
540} 541}
541 542
542int cmd_report(int argc, const char **argv, const char *prefix __used) 543int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
543{ 544{
544 struct perf_session *session; 545 struct perf_session *session;
545 struct stat st; 546 struct stat st;
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 782f66d3610e..82e8ec2c43b7 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -299,7 +299,7 @@ add_sched_event_wakeup(struct task_desc *task, u64 timestamp,
299 299
300static void 300static void
301add_sched_event_sleep(struct task_desc *task, u64 timestamp, 301add_sched_event_sleep(struct task_desc *task, u64 timestamp,
302 u64 task_state __used) 302 u64 task_state __maybe_unused)
303{ 303{
304 struct sched_atom *event = get_new_event(task, timestamp); 304 struct sched_atom *event = get_new_event(task, timestamp);
305 305
@@ -369,8 +369,8 @@ static void add_cross_task_wakeups(void)
369 } 369 }
370} 370}
371 371
372static void 372static void process_sched_event(struct task_desc *this_task __maybe_unused,
373process_sched_event(struct task_desc *this_task __used, struct sched_atom *atom) 373 struct sched_atom *atom)
374{ 374{
375 int ret = 0; 375 int ret = 0;
376 376
@@ -752,7 +752,7 @@ struct trace_sched_handler {
752 752
753static int 753static int
754replay_wakeup_event(struct trace_wakeup_event *wakeup_event, 754replay_wakeup_event(struct trace_wakeup_event *wakeup_event,
755 struct machine *machine __used, 755 struct machine *machine __maybe_unused,
756 struct event_format *event, struct perf_sample *sample) 756 struct event_format *event, struct perf_sample *sample)
757{ 757{
758 struct task_desc *waker, *wakee; 758 struct task_desc *waker, *wakee;
@@ -777,11 +777,11 @@ static u64 cpu_last_switched[MAX_CPUS];
777 777
778static int 778static int
779replay_switch_event(struct trace_switch_event *switch_event, 779replay_switch_event(struct trace_switch_event *switch_event,
780 struct machine *machine __used, 780 struct machine *machine __maybe_unused,
781 struct event_format *event, 781 struct event_format *event,
782 struct perf_sample *sample) 782 struct perf_sample *sample)
783{ 783{
784 struct task_desc *prev, __used *next; 784 struct task_desc *prev, __maybe_unused *next;
785 u64 timestamp0, timestamp = sample->time; 785 u64 timestamp0, timestamp = sample->time;
786 int cpu = sample->cpu; 786 int cpu = sample->cpu;
787 s64 delta; 787 s64 delta;
@@ -932,15 +932,13 @@ static int thread_atoms_insert(struct thread *thread)
932 return 0; 932 return 0;
933} 933}
934 934
935static int 935static int latency_fork_event(struct trace_fork_event *fork_event __maybe_unused,
936latency_fork_event(struct trace_fork_event *fork_event __used, 936 struct event_format *event __maybe_unused)
937 struct event_format *event __used)
938{ 937{
939 /* should insert the newcomer */ 938 /* should insert the newcomer */
940 return 0; 939 return 0;
941} 940}
942 941
943__used
944static char sched_out_state(struct trace_switch_event *switch_event) 942static char sched_out_state(struct trace_switch_event *switch_event)
945{ 943{
946 const char *str = TASK_STATE_TO_CHAR_STR; 944 const char *str = TASK_STATE_TO_CHAR_STR;
@@ -971,7 +969,8 @@ add_sched_out_event(struct work_atoms *atoms,
971} 969}
972 970
973static void 971static void
974add_runtime_event(struct work_atoms *atoms, u64 delta, u64 timestamp __used) 972add_runtime_event(struct work_atoms *atoms, u64 delta,
973 u64 timestamp __maybe_unused)
975{ 974{
976 struct work_atom *atom; 975 struct work_atom *atom;
977 976
@@ -1017,7 +1016,7 @@ add_sched_in_event(struct work_atoms *atoms, u64 timestamp)
1017static int 1016static int
1018latency_switch_event(struct trace_switch_event *switch_event, 1017latency_switch_event(struct trace_switch_event *switch_event,
1019 struct machine *machine, 1018 struct machine *machine,
1020 struct event_format *event __used, 1019 struct event_format *event __maybe_unused,
1021 struct perf_sample *sample) 1020 struct perf_sample *sample)
1022{ 1021{
1023 struct work_atoms *out_events, *in_events; 1022 struct work_atoms *out_events, *in_events;
@@ -1105,7 +1104,8 @@ latency_runtime_event(struct trace_runtime_event *runtime_event,
1105 1104
1106static int 1105static int
1107latency_wakeup_event(struct trace_wakeup_event *wakeup_event, 1106latency_wakeup_event(struct trace_wakeup_event *wakeup_event,
1108 struct machine *machine, struct event_format *event __used, 1107 struct machine *machine,
1108 struct event_format *event __maybe_unused,
1109 struct perf_sample *sample) 1109 struct perf_sample *sample)
1110{ 1110{
1111 struct work_atoms *atoms; 1111 struct work_atoms *atoms;
@@ -1369,12 +1369,11 @@ static void sort_lat(void)
1369 1369
1370static struct trace_sched_handler *trace_handler; 1370static struct trace_sched_handler *trace_handler;
1371 1371
1372static int 1372static int process_sched_wakeup_event(struct perf_tool *tool __maybe_unused,
1373process_sched_wakeup_event(struct perf_tool *tool __used, 1373 struct event_format *event,
1374 struct event_format *event, 1374 struct perf_sample *sample,
1375 struct perf_sample *sample, 1375 struct machine *machine,
1376 struct machine *machine, 1376 struct thread *thread __maybe_unused)
1377 struct thread *thread __used)
1378{ 1377{
1379 void *data = sample->raw_data; 1378 void *data = sample->raw_data;
1380 struct trace_wakeup_event wakeup_event; 1379 struct trace_wakeup_event wakeup_event;
@@ -1410,10 +1409,10 @@ static char next_shortname2 = '0';
1410static int 1409static int
1411map_switch_event(struct trace_switch_event *switch_event, 1410map_switch_event(struct trace_switch_event *switch_event,
1412 struct machine *machine, 1411 struct machine *machine,
1413 struct event_format *event __used, 1412 struct event_format *event __maybe_unused,
1414 struct perf_sample *sample) 1413 struct perf_sample *sample)
1415{ 1414{
1416 struct thread *sched_out __used, *sched_in; 1415 struct thread *sched_out __maybe_unused, *sched_in;
1417 int new_shortname; 1416 int new_shortname;
1418 u64 timestamp0, timestamp = sample->time; 1417 u64 timestamp0, timestamp = sample->time;
1419 s64 delta; 1418 s64 delta;
@@ -1487,12 +1486,11 @@ map_switch_event(struct trace_switch_event *switch_event,
1487 return 0; 1486 return 0;
1488} 1487}
1489 1488
1490static int 1489static int process_sched_switch_event(struct perf_tool *tool __maybe_unused,
1491process_sched_switch_event(struct perf_tool *tool __used, 1490 struct event_format *event,
1492 struct event_format *event, 1491 struct perf_sample *sample,
1493 struct perf_sample *sample, 1492 struct machine *machine,
1494 struct machine *machine, 1493 struct thread *thread __maybe_unused)
1495 struct thread *thread __used)
1496{ 1494{
1497 int this_cpu = sample->cpu, err = 0; 1495 int this_cpu = sample->cpu, err = 0;
1498 void *data = sample->raw_data; 1496 void *data = sample->raw_data;
@@ -1523,12 +1521,11 @@ process_sched_switch_event(struct perf_tool *tool __used,
1523 return err; 1521 return err;
1524} 1522}
1525 1523
1526static int 1524static int process_sched_runtime_event(struct perf_tool *tool __maybe_unused,
1527process_sched_runtime_event(struct perf_tool *tool __used, 1525 struct event_format *event,
1528 struct event_format *event, 1526 struct perf_sample *sample,
1529 struct perf_sample *sample, 1527 struct machine *machine,
1530 struct machine *machine, 1528 struct thread *thread __maybe_unused)
1531 struct thread *thread __used)
1532{ 1529{
1533 void *data = sample->raw_data; 1530 void *data = sample->raw_data;
1534 struct trace_runtime_event runtime_event; 1531 struct trace_runtime_event runtime_event;
@@ -1545,12 +1542,11 @@ process_sched_runtime_event(struct perf_tool *tool __used,
1545 return err; 1542 return err;
1546} 1543}
1547 1544
1548static int 1545static int process_sched_fork_event(struct perf_tool *tool __maybe_unused,
1549process_sched_fork_event(struct perf_tool *tool __used, 1546 struct event_format *event,
1550 struct event_format *event, 1547 struct perf_sample *sample,
1551 struct perf_sample *sample, 1548 struct machine *machine __maybe_unused,
1552 struct machine *machine __used, 1549 struct thread *thread __maybe_unused)
1553 struct thread *thread __used)
1554{ 1550{
1555 void *data = sample->raw_data; 1551 void *data = sample->raw_data;
1556 struct trace_fork_event fork_event; 1552 struct trace_fork_event fork_event;
@@ -1569,12 +1565,11 @@ process_sched_fork_event(struct perf_tool *tool __used,
1569 return err; 1565 return err;
1570} 1566}
1571 1567
1572static int 1568static int process_sched_exit_event(struct perf_tool *tool __maybe_unused,
1573process_sched_exit_event(struct perf_tool *tool __used, 1569 struct event_format *event,
1574 struct event_format *event, 1570 struct perf_sample *sample __maybe_unused,
1575 struct perf_sample *sample __used, 1571 struct machine *machine __maybe_unused,
1576 struct machine *machine __used, 1572 struct thread *thread __maybe_unused)
1577 struct thread *thread __used)
1578{ 1573{
1579 if (verbose) 1574 if (verbose)
1580 printf("sched_exit event %p\n", event); 1575 printf("sched_exit event %p\n", event);
@@ -1582,12 +1577,11 @@ process_sched_exit_event(struct perf_tool *tool __used,
1582 return 0; 1577 return 0;
1583} 1578}
1584 1579
1585static int 1580static int process_sched_migrate_task_event(struct perf_tool *tool __maybe_unused,
1586process_sched_migrate_task_event(struct perf_tool *tool __used, 1581 struct event_format *event,
1587 struct event_format *event, 1582 struct perf_sample *sample,
1588 struct perf_sample *sample, 1583 struct machine *machine,
1589 struct machine *machine, 1584 struct thread *thread __maybe_unused)
1590 struct thread *thread __used)
1591{ 1585{
1592 void *data = sample->raw_data; 1586 void *data = sample->raw_data;
1593 struct trace_migrate_task_event migrate_task_event; 1587 struct trace_migrate_task_event migrate_task_event;
@@ -1612,8 +1606,8 @@ typedef int (*tracepoint_handler)(struct perf_tool *tool,
1612 struct machine *machine, 1606 struct machine *machine,
1613 struct thread *thread); 1607 struct thread *thread);
1614 1608
1615static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __used, 1609static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_unused,
1616 union perf_event *event __used, 1610 union perf_event *event __maybe_unused,
1617 struct perf_sample *sample, 1611 struct perf_sample *sample,
1618 struct perf_evsel *evsel, 1612 struct perf_evsel *evsel,
1619 struct machine *machine) 1613 struct machine *machine)
@@ -1918,7 +1912,7 @@ static int __cmd_record(int argc, const char **argv)
1918 return cmd_record(i, rec_argv, NULL); 1912 return cmd_record(i, rec_argv, NULL);
1919} 1913}
1920 1914
1921int cmd_sched(int argc, const char **argv, const char *prefix __used) 1915int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
1922{ 1916{
1923 argc = parse_options(argc, argv, sched_options, sched_usage, 1917 argc = parse_options(argc, argv, sched_options, sched_usage,
1924 PARSE_OPT_STOP_AT_NON_OPTION); 1918 PARSE_OPT_STOP_AT_NON_OPTION);
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c350cfee3157..6d98a83d5a60 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -430,9 +430,9 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
430 printf("\n"); 430 printf("\n");
431} 431}
432 432
433static int default_start_script(const char *script __unused, 433static int default_start_script(const char *script __maybe_unused,
434 int argc __unused, 434 int argc __maybe_unused,
435 const char **argv __unused) 435 const char **argv __maybe_unused)
436{ 436{
437 return 0; 437 return 0;
438} 438}
@@ -442,8 +442,8 @@ static int default_stop_script(void)
442 return 0; 442 return 0;
443} 443}
444 444
445static int default_generate_script(struct pevent *pevent __unused, 445static int default_generate_script(struct pevent *pevent __maybe_unused,
446 const char *outfile __unused) 446 const char *outfile __maybe_unused)
447{ 447{
448 return 0; 448 return 0;
449} 449}
@@ -474,7 +474,7 @@ static int cleanup_scripting(void)
474 474
475static const char *input_name; 475static const char *input_name;
476 476
477static int process_sample_event(struct perf_tool *tool __used, 477static int process_sample_event(struct perf_tool *tool __maybe_unused,
478 union perf_event *event, 478 union perf_event *event,
479 struct perf_sample *sample, 479 struct perf_sample *sample,
480 struct perf_evsel *evsel, 480 struct perf_evsel *evsel,
@@ -534,7 +534,7 @@ static struct perf_tool perf_script = {
534 534
535extern volatile int session_done; 535extern volatile int session_done;
536 536
537static void sig_handler(int sig __unused) 537static void sig_handler(int sig __maybe_unused)
538{ 538{
539 session_done = 1; 539 session_done = 1;
540} 540}
@@ -644,8 +644,8 @@ static void list_available_languages(void)
644 fprintf(stderr, "\n"); 644 fprintf(stderr, "\n");
645} 645}
646 646
647static int parse_scriptname(const struct option *opt __used, 647static int parse_scriptname(const struct option *opt __maybe_unused,
648 const char *str, int unset __used) 648 const char *str, int unset __maybe_unused)
649{ 649{
650 char spec[PATH_MAX]; 650 char spec[PATH_MAX];
651 const char *script, *ext; 651 const char *script, *ext;
@@ -690,8 +690,8 @@ static int parse_scriptname(const struct option *opt __used,
690 return 0; 690 return 0;
691} 691}
692 692
693static int parse_output_fields(const struct option *opt __used, 693static int parse_output_fields(const struct option *opt __maybe_unused,
694 const char *arg, int unset __used) 694 const char *arg, int unset __maybe_unused)
695{ 695{
696 char *tok; 696 char *tok;
697 int i, imax = sizeof(all_output_options) / sizeof(struct output_option); 697 int i, imax = sizeof(all_output_options) / sizeof(struct output_option);
@@ -982,8 +982,9 @@ static char *get_script_root(struct dirent *script_dirent, const char *suffix)
982 return script_root; 982 return script_root;
983} 983}
984 984
985static int list_available_scripts(const struct option *opt __used, 985static int list_available_scripts(const struct option *opt __maybe_unused,
986 const char *s __used, int unset __used) 986 const char *s __maybe_unused,
987 int unset __maybe_unused)
987{ 988{
988 struct dirent *script_next, *lang_next, script_dirent, lang_dirent; 989 struct dirent *script_next, *lang_next, script_dirent, lang_dirent;
989 char scripts_path[MAXPATHLEN]; 990 char scripts_path[MAXPATHLEN];
@@ -1172,7 +1173,7 @@ static int have_cmd(int argc, const char **argv)
1172 return 0; 1173 return 0;
1173} 1174}
1174 1175
1175int cmd_script(int argc, const char **argv, const char *prefix __used) 1176int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
1176{ 1177{
1177 char *rec_script_path = NULL; 1178 char *rec_script_path = NULL;
1178 char *rep_script_path = NULL; 1179 char *rep_script_path = NULL;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 02f49eba677f..dab347d7b010 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -417,7 +417,7 @@ static int read_counter(struct perf_evsel *counter)
417 return 0; 417 return 0;
418} 418}
419 419
420static int run_perf_stat(int argc __used, const char **argv) 420static int run_perf_stat(int argc __maybe_unused, const char **argv)
421{ 421{
422 unsigned long long t0, t1; 422 unsigned long long t0, t1;
423 struct perf_evsel *counter, *first; 423 struct perf_evsel *counter, *first;
@@ -634,7 +634,9 @@ static const char *get_ratio_color(enum grc_type type, double ratio)
634 return color; 634 return color;
635} 635}
636 636
637static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __used, double avg) 637static void print_stalled_cycles_frontend(int cpu,
638 struct perf_evsel *evsel
639 __maybe_unused, double avg)
638{ 640{
639 double total, ratio = 0.0; 641 double total, ratio = 0.0;
640 const char *color; 642 const char *color;
@@ -651,7 +653,9 @@ static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __us
651 fprintf(output, " frontend cycles idle "); 653 fprintf(output, " frontend cycles idle ");
652} 654}
653 655
654static void print_stalled_cycles_backend(int cpu, struct perf_evsel *evsel __used, double avg) 656static void print_stalled_cycles_backend(int cpu,
657 struct perf_evsel *evsel
658 __maybe_unused, double avg)
655{ 659{
656 double total, ratio = 0.0; 660 double total, ratio = 0.0;
657 const char *color; 661 const char *color;
@@ -668,7 +672,9 @@ static void print_stalled_cycles_backend(int cpu, struct perf_evsel *evsel __use
668 fprintf(output, " backend cycles idle "); 672 fprintf(output, " backend cycles idle ");
669} 673}
670 674
671static void print_branch_misses(int cpu, struct perf_evsel *evsel __used, double avg) 675static void print_branch_misses(int cpu,
676 struct perf_evsel *evsel __maybe_unused,
677 double avg)
672{ 678{
673 double total, ratio = 0.0; 679 double total, ratio = 0.0;
674 const char *color; 680 const char *color;
@@ -685,7 +691,9 @@ static void print_branch_misses(int cpu, struct perf_evsel *evsel __used, double
685 fprintf(output, " of all branches "); 691 fprintf(output, " of all branches ");
686} 692}
687 693
688static void print_l1_dcache_misses(int cpu, struct perf_evsel *evsel __used, double avg) 694static void print_l1_dcache_misses(int cpu,
695 struct perf_evsel *evsel __maybe_unused,
696 double avg)
689{ 697{
690 double total, ratio = 0.0; 698 double total, ratio = 0.0;
691 const char *color; 699 const char *color;
@@ -702,7 +710,9 @@ static void print_l1_dcache_misses(int cpu, struct perf_evsel *evsel __used, dou
702 fprintf(output, " of all L1-dcache hits "); 710 fprintf(output, " of all L1-dcache hits ");
703} 711}
704 712
705static void print_l1_icache_misses(int cpu, struct perf_evsel *evsel __used, double avg) 713static void print_l1_icache_misses(int cpu,
714 struct perf_evsel *evsel __maybe_unused,
715 double avg)
706{ 716{
707 double total, ratio = 0.0; 717 double total, ratio = 0.0;
708 const char *color; 718 const char *color;
@@ -719,7 +729,9 @@ static void print_l1_icache_misses(int cpu, struct perf_evsel *evsel __used, dou
719 fprintf(output, " of all L1-icache hits "); 729 fprintf(output, " of all L1-icache hits ");
720} 730}
721 731
722static void print_dtlb_cache_misses(int cpu, struct perf_evsel *evsel __used, double avg) 732static void print_dtlb_cache_misses(int cpu,
733 struct perf_evsel *evsel __maybe_unused,
734 double avg)
723{ 735{
724 double total, ratio = 0.0; 736 double total, ratio = 0.0;
725 const char *color; 737 const char *color;
@@ -736,7 +748,9 @@ static void print_dtlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do
736 fprintf(output, " of all dTLB cache hits "); 748 fprintf(output, " of all dTLB cache hits ");
737} 749}
738 750
739static void print_itlb_cache_misses(int cpu, struct perf_evsel *evsel __used, double avg) 751static void print_itlb_cache_misses(int cpu,
752 struct perf_evsel *evsel __maybe_unused,
753 double avg)
740{ 754{
741 double total, ratio = 0.0; 755 double total, ratio = 0.0;
742 const char *color; 756 const char *color;
@@ -753,7 +767,9 @@ static void print_itlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do
753 fprintf(output, " of all iTLB cache hits "); 767 fprintf(output, " of all iTLB cache hits ");
754} 768}
755 769
756static void print_ll_cache_misses(int cpu, struct perf_evsel *evsel __used, double avg) 770static void print_ll_cache_misses(int cpu,
771 struct perf_evsel *evsel __maybe_unused,
772 double avg)
757{ 773{
758 double total, ratio = 0.0; 774 double total, ratio = 0.0;
759 const char *color; 775 const char *color;
@@ -1059,8 +1075,8 @@ static const char * const stat_usage[] = {
1059 NULL 1075 NULL
1060}; 1076};
1061 1077
1062static int stat__set_big_num(const struct option *opt __used, 1078static int stat__set_big_num(const struct option *opt __maybe_unused,
1063 const char *s __used, int unset) 1079 const char *s __maybe_unused, int unset)
1064{ 1080{
1065 big_num_opt = unset ? 0 : 1; 1081 big_num_opt = unset ? 0 : 1;
1066 return 0; 1082 return 0;
@@ -1154,7 +1170,7 @@ static int add_default_attributes(void)
1154 return perf_evlist__add_default_attrs(evsel_list, very_very_detailed_attrs); 1170 return perf_evlist__add_default_attrs(evsel_list, very_very_detailed_attrs);
1155} 1171}
1156 1172
1157int cmd_stat(int argc, const char **argv, const char *prefix __used) 1173int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
1158{ 1174{
1159 struct perf_evsel *pos; 1175 struct perf_evsel *pos;
1160 int status = -ENOMEM; 1176 int status = -ENOMEM;
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 6ae102eba5fa..d33143efefce 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -18,7 +18,8 @@
18 18
19#include <sys/mman.h> 19#include <sys/mman.h>
20 20
21static int vmlinux_matches_kallsyms_filter(struct map *map __used, struct symbol *sym) 21static int vmlinux_matches_kallsyms_filter(struct map *map __maybe_unused,
22 struct symbol *sym)
22{ 23{
23 bool *visited = symbol__priv(sym); 24 bool *visited = symbol__priv(sym);
24 *visited = true; 25 *visited = true;
@@ -996,7 +997,9 @@ static u64 mmap_read_self(void *addr)
996/* 997/*
997 * If the RDPMC instruction faults then signal this back to the test parent task: 998 * If the RDPMC instruction faults then signal this back to the test parent task:
998 */ 999 */
999static void segfault_handler(int sig __used, siginfo_t *info __used, void *uc __used) 1000static void segfault_handler(int sig __maybe_unused,
1001 siginfo_t *info __maybe_unused,
1002 void *uc __maybe_unused)
1000{ 1003{
1001 exit(-1); 1004 exit(-1);
1002} 1005}
@@ -1315,7 +1318,7 @@ static int perf_test__list(int argc, const char **argv)
1315 return 0; 1318 return 0;
1316} 1319}
1317 1320
1318int cmd_test(int argc, const char **argv, const char *prefix __used) 1321int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
1319{ 1322{
1320 const char * const test_usage[] = { 1323 const char * const test_usage[] = {
1321 "perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]", 1324 "perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 3b75b2e21ea5..55a3a6c6b9e7 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -275,28 +275,28 @@ static int cpus_cstate_state[MAX_CPUS];
275static u64 cpus_pstate_start_times[MAX_CPUS]; 275static u64 cpus_pstate_start_times[MAX_CPUS];
276static u64 cpus_pstate_state[MAX_CPUS]; 276static u64 cpus_pstate_state[MAX_CPUS];
277 277
278static int process_comm_event(struct perf_tool *tool __used, 278static int process_comm_event(struct perf_tool *tool __maybe_unused,
279 union perf_event *event, 279 union perf_event *event,
280 struct perf_sample *sample __used, 280 struct perf_sample *sample __maybe_unused,
281 struct machine *machine __used) 281 struct machine *machine __maybe_unused)
282{ 282{
283 pid_set_comm(event->comm.tid, event->comm.comm); 283 pid_set_comm(event->comm.tid, event->comm.comm);
284 return 0; 284 return 0;
285} 285}
286 286
287static int process_fork_event(struct perf_tool *tool __used, 287static int process_fork_event(struct perf_tool *tool __maybe_unused,
288 union perf_event *event, 288 union perf_event *event,
289 struct perf_sample *sample __used, 289 struct perf_sample *sample __maybe_unused,
290 struct machine *machine __used) 290 struct machine *machine __maybe_unused)
291{ 291{
292 pid_fork(event->fork.pid, event->fork.ppid, event->fork.time); 292 pid_fork(event->fork.pid, event->fork.ppid, event->fork.time);
293 return 0; 293 return 0;
294} 294}
295 295
296static int process_exit_event(struct perf_tool *tool __used, 296static int process_exit_event(struct perf_tool *tool __maybe_unused,
297 union perf_event *event, 297 union perf_event *event,
298 struct perf_sample *sample __used, 298 struct perf_sample *sample __maybe_unused,
299 struct machine *machine __used) 299 struct machine *machine __maybe_unused)
300{ 300{
301 pid_exit(event->fork.pid, event->fork.time); 301 pid_exit(event->fork.pid, event->fork.time);
302 return 0; 302 return 0;
@@ -491,11 +491,11 @@ static void sched_switch(int cpu, u64 timestamp, struct trace_entry *te)
491} 491}
492 492
493 493
494static int process_sample_event(struct perf_tool *tool __used, 494static int process_sample_event(struct perf_tool *tool __maybe_unused,
495 union perf_event *event __used, 495 union perf_event *event __maybe_unused,
496 struct perf_sample *sample, 496 struct perf_sample *sample,
497 struct perf_evsel *evsel, 497 struct perf_evsel *evsel,
498 struct machine *machine __used) 498 struct machine *machine __maybe_unused)
499{ 499{
500 struct trace_entry *te; 500 struct trace_entry *te;
501 501
@@ -1081,7 +1081,8 @@ static int __cmd_record(int argc, const char **argv)
1081} 1081}
1082 1082
1083static int 1083static int
1084parse_process(const struct option *opt __used, const char *arg, int __used unset) 1084parse_process(const struct option *opt __maybe_unused, const char *arg,
1085 int __maybe_unused unset)
1085{ 1086{
1086 if (arg) 1087 if (arg)
1087 add_process_filter(arg); 1088 add_process_filter(arg);
@@ -1106,7 +1107,8 @@ static const struct option options[] = {
1106}; 1107};
1107 1108
1108 1109
1109int cmd_timechart(int argc, const char **argv, const char *prefix __used) 1110int cmd_timechart(int argc, const char **argv,
1111 const char *prefix __maybe_unused)
1110{ 1112{
1111 argc = parse_options(argc, argv, options, timechart_usage, 1113 argc = parse_options(argc, argv, options, timechart_usage,
1112 PARSE_OPT_STOP_AT_NON_OPTION); 1114 PARSE_OPT_STOP_AT_NON_OPTION);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0513aaa659f9..5550754c05f2 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -95,7 +95,8 @@ static void perf_top__update_print_entries(struct perf_top *top)
95 top->print_entries -= 9; 95 top->print_entries -= 9;
96} 96}
97 97
98static void perf_top__sig_winch(int sig __used, siginfo_t *info __used, void *arg) 98static void perf_top__sig_winch(int sig __maybe_unused,
99 siginfo_t *info __maybe_unused, void *arg)
99{ 100{
100 struct perf_top *top = arg; 101 struct perf_top *top = arg;
101 102
@@ -663,7 +664,7 @@ static const char *skip_symbols[] = {
663 NULL 664 NULL
664}; 665};
665 666
666static int symbol_filter(struct map *map __used, struct symbol *sym) 667static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym)
667{ 668{
668 const char *name = sym->name; 669 const char *name = sym->name;
669 int i; 670 int i;
@@ -1163,7 +1164,7 @@ static const char * const top_usage[] = {
1163 NULL 1164 NULL
1164}; 1165};
1165 1166
1166int cmd_top(int argc, const char **argv, const char *prefix __used) 1167int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1167{ 1168{
1168 struct perf_evsel *pos; 1169 struct perf_evsel *pos;
1169 int status; 1170 int status;
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index 1818a531f1d3..4aeb7d5df939 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -269,7 +269,7 @@ int ui_browser__show(struct ui_browser *browser, const char *title,
269 return err ? 0 : -1; 269 return err ? 0 : -1;
270} 270}
271 271
272void ui_browser__hide(struct ui_browser *browser __used) 272void ui_browser__hide(struct ui_browser *browser __maybe_unused)
273{ 273{
274 pthread_mutex_lock(&ui__lock); 274 pthread_mutex_lock(&ui__lock);
275 ui_helpline__pop(); 275 ui_helpline__pop();
@@ -518,7 +518,7 @@ static struct ui_browser__colorset {
518 518
519 519
520static int ui_browser__color_config(const char *var, const char *value, 520static int ui_browser__color_config(const char *var, const char *value,
521 void *data __used) 521 void *data __maybe_unused)
522{ 522{
523 char *fg = NULL, *bg; 523 char *fg = NULL, *bg;
524 int i; 524 int i;
@@ -602,7 +602,8 @@ void __ui_browser__vline(struct ui_browser *browser, unsigned int column,
602 SLsmg_set_char_set(0); 602 SLsmg_set_char_set(0);
603} 603}
604 604
605void ui_browser__write_graph(struct ui_browser *browser __used, int graph) 605void ui_browser__write_graph(struct ui_browser *browser __maybe_unused,
606 int graph)
606{ 607{
607 SLsmg_set_char_set(1); 608 SLsmg_set_char_set(1);
608 SLsmg_write_char(graph); 609 SLsmg_write_char(graph);
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 67a2703e666a..8f8cd2d73b3b 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -54,7 +54,8 @@ static inline struct browser_disasm_line *disasm_line__browser(struct disasm_lin
54 return (struct browser_disasm_line *)(dl + 1); 54 return (struct browser_disasm_line *)(dl + 1);
55} 55}
56 56
57static bool disasm_line__filter(struct ui_browser *browser __used, void *entry) 57static bool disasm_line__filter(struct ui_browser *browser __maybe_unused,
58 void *entry)
58{ 59{
59 if (annotate_browser__opts.hide_src_code) { 60 if (annotate_browser__opts.hide_src_code) {
60 struct disasm_line *dl = list_entry(entry, struct disasm_line, node); 61 struct disasm_line *dl = list_entry(entry, struct disasm_line, node);
@@ -928,7 +929,8 @@ static int annotate_config__cmp(const void *name, const void *cfgp)
928 return strcmp(name, cfg->name); 929 return strcmp(name, cfg->name);
929} 930}
930 931
931static int annotate__config(const char *var, const char *value, void *data __used) 932static int annotate__config(const char *var, const char *value,
933 void *data __maybe_unused)
932{ 934{
933 struct annotate__config *cfg; 935 struct annotate__config *cfg;
934 const char *name; 936 const char *name;
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index 3c16ab50e0f8..55acba6e0df4 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -237,8 +237,9 @@ static GtkWidget *perf_gtk__setup_statusbar(void)
237 237
238int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, 238int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
239 const char *help, 239 const char *help,
240 void (*timer) (void *arg)__used, 240 void (*timer) (void *arg)__maybe_unused,
241 void *arg __used, int delay_secs __used) 241 void *arg __maybe_unused,
242 int delay_secs __maybe_unused)
242{ 243{
243 struct perf_evsel *pos; 244 struct perf_evsel *pos;
244 GtkWidget *vbox; 245 GtkWidget *vbox;
diff --git a/tools/perf/ui/gtk/setup.c b/tools/perf/ui/gtk/setup.c
index 26429437e19e..3c4c6ef78283 100644
--- a/tools/perf/ui/gtk/setup.c
+++ b/tools/perf/ui/gtk/setup.c
@@ -12,7 +12,7 @@ int perf_gtk__init(void)
12 return gtk_init_check(NULL, NULL) ? 0 : -1; 12 return gtk_init_check(NULL, NULL) ? 0 : -1;
13} 13}
14 14
15void perf_gtk__exit(bool wait_for_ok __used) 15void perf_gtk__exit(bool wait_for_ok __maybe_unused)
16{ 16{
17 if (!perf_gtk__is_active_context(pgctx)) 17 if (!perf_gtk__is_active_context(pgctx))
18 return; 18 return;
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index b8efb966f94c..8aada5b3c04c 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -117,8 +117,8 @@ struct perf_error_ops perf_gtk_eops = {
117 * For now, just add stubs for NO_NEWT=1 build. 117 * For now, just add stubs for NO_NEWT=1 build.
118 */ 118 */
119#ifdef NO_NEWT_SUPPORT 119#ifdef NO_NEWT_SUPPORT
120void ui_progress__update(u64 curr __used, u64 total __used, 120void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused,
121 const char *title __used) 121 const char *title __maybe_unused)
122{ 122{
123} 123}
124#endif 124#endif
diff --git a/tools/perf/ui/helpline.c b/tools/perf/ui/helpline.c
index 78ba28ac7a2c..a49bcf3c190b 100644
--- a/tools/perf/ui/helpline.c
+++ b/tools/perf/ui/helpline.c
@@ -12,7 +12,7 @@ static void nop_helpline__pop(void)
12{ 12{
13} 13}
14 14
15static void nop_helpline__push(const char *msg __used) 15static void nop_helpline__push(const char *msg __maybe_unused)
16{ 16{
17} 17}
18 18
diff --git a/tools/perf/ui/helpline.h b/tools/perf/ui/helpline.h
index a2487f93aa48..2b667ee454c3 100644
--- a/tools/perf/ui/helpline.h
+++ b/tools/perf/ui/helpline.h
@@ -24,8 +24,8 @@ void ui_helpline__puts(const char *msg);
24extern char ui_helpline__current[512]; 24extern char ui_helpline__current[512];
25 25
26#ifdef NO_NEWT_SUPPORT 26#ifdef NO_NEWT_SUPPORT
27static inline int ui_helpline__show_help(const char *format __used, 27static inline int ui_helpline__show_help(const char *format __maybe_unused,
28 va_list ap __used) 28 va_list ap __maybe_unused)
29{ 29{
30 return 0; 30 return 0;
31} 31}
@@ -35,8 +35,8 @@ int ui_helpline__show_help(const char *format, va_list ap);
35#endif /* NO_NEWT_SUPPORT */ 35#endif /* NO_NEWT_SUPPORT */
36 36
37#ifdef NO_GTK2_SUPPORT 37#ifdef NO_GTK2_SUPPORT
38static inline int perf_gtk__show_helpline(const char *format __used, 38static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
39 va_list ap __used) 39 va_list ap __maybe_unused)
40{ 40{
41 return 0; 41 return 0;
42} 42}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 031b349a3f84..407e855cccb8 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -13,7 +13,7 @@ static int hpp__header_overhead(struct perf_hpp *hpp)
13 return scnprintf(hpp->buf, hpp->size, fmt); 13 return scnprintf(hpp->buf, hpp->size, fmt);
14} 14}
15 15
16static int hpp__width_overhead(struct perf_hpp *hpp __used) 16static int hpp__width_overhead(struct perf_hpp *hpp __maybe_unused)
17{ 17{
18 return 8; 18 return 8;
19} 19}
@@ -62,7 +62,7 @@ static int hpp__header_overhead_sys(struct perf_hpp *hpp)
62 return scnprintf(hpp->buf, hpp->size, fmt, "sys"); 62 return scnprintf(hpp->buf, hpp->size, fmt, "sys");
63} 63}
64 64
65static int hpp__width_overhead_sys(struct perf_hpp *hpp __used) 65static int hpp__width_overhead_sys(struct perf_hpp *hpp __maybe_unused)
66{ 66{
67 return 6; 67 return 6;
68} 68}
@@ -88,7 +88,7 @@ static int hpp__header_overhead_us(struct perf_hpp *hpp)
88 return scnprintf(hpp->buf, hpp->size, fmt, "user"); 88 return scnprintf(hpp->buf, hpp->size, fmt, "user");
89} 89}
90 90
91static int hpp__width_overhead_us(struct perf_hpp *hpp __used) 91static int hpp__width_overhead_us(struct perf_hpp *hpp __maybe_unused)
92{ 92{
93 return 6; 93 return 6;
94} 94}
@@ -112,7 +112,7 @@ static int hpp__header_overhead_guest_sys(struct perf_hpp *hpp)
112 return scnprintf(hpp->buf, hpp->size, "guest sys"); 112 return scnprintf(hpp->buf, hpp->size, "guest sys");
113} 113}
114 114
115static int hpp__width_overhead_guest_sys(struct perf_hpp *hpp __used) 115static int hpp__width_overhead_guest_sys(struct perf_hpp *hpp __maybe_unused)
116{ 116{
117 return 9; 117 return 9;
118} 118}
@@ -138,7 +138,7 @@ static int hpp__header_overhead_guest_us(struct perf_hpp *hpp)
138 return scnprintf(hpp->buf, hpp->size, "guest usr"); 138 return scnprintf(hpp->buf, hpp->size, "guest usr");
139} 139}
140 140
141static int hpp__width_overhead_guest_us(struct perf_hpp *hpp __used) 141static int hpp__width_overhead_guest_us(struct perf_hpp *hpp __maybe_unused)
142{ 142{
143 return 9; 143 return 9;
144} 144}
@@ -166,7 +166,7 @@ static int hpp__header_samples(struct perf_hpp *hpp)
166 return scnprintf(hpp->buf, hpp->size, fmt, "Samples"); 166 return scnprintf(hpp->buf, hpp->size, fmt, "Samples");
167} 167}
168 168
169static int hpp__width_samples(struct perf_hpp *hpp __used) 169static int hpp__width_samples(struct perf_hpp *hpp __maybe_unused)
170{ 170{
171 return 11; 171 return 11;
172} 172}
@@ -185,7 +185,7 @@ static int hpp__header_period(struct perf_hpp *hpp)
185 return scnprintf(hpp->buf, hpp->size, fmt, "Period"); 185 return scnprintf(hpp->buf, hpp->size, fmt, "Period");
186} 186}
187 187
188static int hpp__width_period(struct perf_hpp *hpp __used) 188static int hpp__width_period(struct perf_hpp *hpp __maybe_unused)
189{ 189{
190 return 12; 190 return 12;
191} 191}
@@ -204,7 +204,7 @@ static int hpp__header_delta(struct perf_hpp *hpp)
204 return scnprintf(hpp->buf, hpp->size, fmt, "Delta"); 204 return scnprintf(hpp->buf, hpp->size, fmt, "Delta");
205} 205}
206 206
207static int hpp__width_delta(struct perf_hpp *hpp __used) 207static int hpp__width_delta(struct perf_hpp *hpp __maybe_unused)
208{ 208{
209 return 7; 209 return 7;
210} 210}
@@ -238,12 +238,13 @@ static int hpp__header_displ(struct perf_hpp *hpp)
238 return scnprintf(hpp->buf, hpp->size, "Displ."); 238 return scnprintf(hpp->buf, hpp->size, "Displ.");
239} 239}
240 240
241static int hpp__width_displ(struct perf_hpp *hpp __used) 241static int hpp__width_displ(struct perf_hpp *hpp __maybe_unused)
242{ 242{
243 return 6; 243 return 6;
244} 244}
245 245
246static int hpp__entry_displ(struct perf_hpp *hpp, struct hist_entry *he __used) 246static int hpp__entry_displ(struct perf_hpp *hpp,
247 struct hist_entry *he __maybe_unused)
247{ 248{
248 const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s"; 249 const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s";
249 char buf[32] = " "; 250 char buf[32] = " ";
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c
index 4dc0887c04f1..60debb81537a 100644
--- a/tools/perf/ui/tui/setup.c
+++ b/tools/perf/ui/tui/setup.c
@@ -28,7 +28,7 @@ void ui__refresh_dimensions(bool force)
28 } 28 }
29} 29}
30 30
31static void ui__sigwinch(int sig __used) 31static void ui__sigwinch(int sig __maybe_unused)
32{ 32{
33 ui__need_resize = 1; 33 ui__need_resize = 1;
34} 34}
@@ -88,7 +88,7 @@ int ui__getch(int delay_secs)
88 return SLkp_getkey(); 88 return SLkp_getkey();
89} 89}
90 90
91static void newt_suspend(void *d __used) 91static void newt_suspend(void *d __maybe_unused)
92{ 92{
93 newtSuspend(); 93 newtSuspend();
94 raise(SIGTSTP); 94 raise(SIGTSTP);
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