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/bench | |
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/bench')
-rw-r--r-- | tools/perf/bench/bench.h | 3 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy.c | 2 | ||||
-rw-r--r-- | tools/perf/bench/mem-memset.c | 2 | ||||
-rw-r--r-- | tools/perf/bench/sched-messaging.c | 2 | ||||
-rw-r--r-- | tools/perf/bench/sched-pipe.c | 6 |
5 files changed, 8 insertions, 7 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 | ||
4 | extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); | 4 | extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); |
5 | extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); | 5 | extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); |
6 | extern int bench_mem_memcpy(int argc, const char **argv, const char *prefix __used); | 6 | extern int bench_mem_memcpy(int argc, const char **argv, |
7 | const char *prefix __maybe_unused); | ||
7 | extern int bench_mem_memset(int argc, const char **argv, const char *prefix); | 8 | extern 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 | ||
179 | int bench_mem_memcpy(int argc, const char **argv, | 179 | int 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 | ||
173 | int bench_mem_memset(int argc, const char **argv, | 173 | int 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 | ||
269 | int bench_sched_messaging(int argc, const char **argv, | 269 | int 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 | ||
45 | int bench_sched_pipe(int argc, const char **argv, | 45 | int 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); |