diff options
author | Irina Tirdea <irina.tirdea@gmail.com> | 2012-09-10 18:15:03 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-11 11:19:15 -0400 |
commit | 1d037ca1648b775277fc96401ec2aa233724906c (patch) | |
tree | 266722dc6c9e00c67c66f5f8d06f30d0c2dd3979 /tools/perf/builtin-inject.c | |
parent | 7dbf4dcfe2987c35c2c4675cd7ae1b6006979176 (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/builtin-inject.c')
-rw-r--r-- | tools/perf/builtin-inject.c | 24 |
1 files changed, 13 insertions, 11 deletions
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 @@ | |||
17 | static char const *input_name = "-"; | 17 | static char const *input_name = "-"; |
18 | static bool inject_build_ids; | 18 | static bool inject_build_ids; |
19 | 19 | ||
20 | static int perf_event__repipe_synth(struct perf_tool *tool __used, | 20 | static 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 | ||
41 | static int perf_event__repipe_op2_synth(struct perf_tool *tool, | 41 | static 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 | ||
54 | static int perf_event__repipe_tracing_data_synth(union perf_event *event, | 55 | static 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 | ||
60 | static int perf_event__repipe_attr(union perf_event *event, | 62 | static 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 | ||
71 | static int perf_event__repipe(struct perf_tool *tool, | 73 | static 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 | ||
79 | static int perf_event__repipe_sample(struct perf_tool *tool, | 81 | static 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, | |||
163 | static int perf_event__inject_buildid(struct perf_tool *tool, | 165 | static 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 | ||
225 | extern volatile int session_done; | 227 | extern volatile int session_done; |
226 | 228 | ||
227 | static void sig_handler(int sig __attribute__((__unused__))) | 229 | static 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 | ||
270 | int cmd_inject(int argc, const char **argv, const char *prefix __used) | 272 | int 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 | ||