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/util/trace-event-scripting.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/util/trace-event-scripting.c')
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 33 |
1 files changed, 18 insertions, 15 deletions
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 | ||
38 | static void process_event_unsupported(union perf_event *event __unused, | 38 | static 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 | ||
55 | static int python_start_script_unsupported(const char *script __unused, | 55 | static 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 | ||
64 | static int python_generate_script_unsupported(struct pevent *pevent __unused, | 64 | static 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 | ||
117 | static int perl_start_script_unsupported(const char *script __unused, | 119 | static 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 | ||
126 | static int perl_generate_script_unsupported(struct pevent *pevent __unused, | 128 | static 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 | ||