aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorIrina Tirdea <irina.tirdea@gmail.com>2012-09-10 18:15:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-09-11 11:19:15 -0400
commit1d037ca1648b775277fc96401ec2aa233724906c (patch)
tree266722dc6c9e00c67c66f5f8d06f30d0c2dd3979 /tools/perf/builtin-probe.c
parent7dbf4dcfe2987c35c2c4675cd7ae1b6006979176 (diff)
perf tools: Use __maybe_used for unused variables
perf defines both __used and __unused variables to use for marking unused variables. The variable __used is defined to __attribute__((__unused__)), which contradicts the kernel definition to __attribute__((__used__)) for new gcc versions. On Android, __used is also defined in system headers and this leads to warnings like: warning: '__used__' attribute ignored __unused is not defined in the kernel and is not a standard definition. If __unused is included everywhere instead of __used, this leads to conflicts with glibc headers, since glibc has a variables with this name in its headers. The best approach is to use __maybe_unused, the definition used in the kernel for __attribute__((unused)). In this way there is only one definition in perf sources (instead of 2 definitions that point to the same thing: __used and __unused) and it works on both Linux and Android. This patch simply replaces all instances of __used and __unused with __maybe_unused. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Acked-by: Pekka Enberg <penberg@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1347315303-29906-7-git-send-email-irina.tirdea@intel.com [ committer note: fixed up conflict with a116e05 in builtin-sched.c ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r--tools/perf/builtin-probe.c24
1 files changed, 12 insertions, 12 deletions
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