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/ui | |
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/ui')
-rw-r--r-- | tools/perf/ui/browser.c | 7 | ||||
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 6 | ||||
-rw-r--r-- | tools/perf/ui/gtk/browser.c | 5 | ||||
-rw-r--r-- | tools/perf/ui/gtk/setup.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/gtk/util.c | 4 | ||||
-rw-r--r-- | tools/perf/ui/helpline.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/helpline.h | 8 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 21 | ||||
-rw-r--r-- | tools/perf/ui/tui/setup.c | 4 |
9 files changed, 32 insertions, 27 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 1818a531f1d..4aeb7d5df93 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 | ||
272 | void ui_browser__hide(struct ui_browser *browser __used) | 272 | void 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 | ||
520 | static int ui_browser__color_config(const char *var, const char *value, | 520 | static 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 | ||
605 | void ui_browser__write_graph(struct ui_browser *browser __used, int graph) | 605 | void 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 67a2703e666..8f8cd2d73b3 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 | ||
57 | static bool disasm_line__filter(struct ui_browser *browser __used, void *entry) | 57 | static 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 | ||
931 | static int annotate__config(const char *var, const char *value, void *data __used) | 932 | static 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 3c16ab50e0f..55acba6e0df 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 | ||
238 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | 238 | int 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 26429437e19..3c4c6ef7828 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 | ||
15 | void perf_gtk__exit(bool wait_for_ok __used) | 15 | void 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 b8efb966f94..8aada5b3c04 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 |
120 | void ui_progress__update(u64 curr __used, u64 total __used, | 120 | void 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 78ba28ac7a2..a49bcf3c190 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 | ||
15 | static void nop_helpline__push(const char *msg __used) | 15 | static 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 a2487f93aa4..2b667ee454c 100644 --- a/tools/perf/ui/helpline.h +++ b/tools/perf/ui/helpline.h | |||
@@ -24,8 +24,8 @@ void ui_helpline__puts(const char *msg); | |||
24 | extern char ui_helpline__current[512]; | 24 | extern char ui_helpline__current[512]; |
25 | 25 | ||
26 | #ifdef NO_NEWT_SUPPORT | 26 | #ifdef NO_NEWT_SUPPORT |
27 | static inline int ui_helpline__show_help(const char *format __used, | 27 | static 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 |
38 | static inline int perf_gtk__show_helpline(const char *format __used, | 38 | static 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 031b349a3f8..407e855cccb 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 | ||
16 | static int hpp__width_overhead(struct perf_hpp *hpp __used) | 16 | static 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 | ||
65 | static int hpp__width_overhead_sys(struct perf_hpp *hpp __used) | 65 | static 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 | ||
91 | static int hpp__width_overhead_us(struct perf_hpp *hpp __used) | 91 | static 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 | ||
115 | static int hpp__width_overhead_guest_sys(struct perf_hpp *hpp __used) | 115 | static 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 | ||
141 | static int hpp__width_overhead_guest_us(struct perf_hpp *hpp __used) | 141 | static 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 | ||
169 | static int hpp__width_samples(struct perf_hpp *hpp __used) | 169 | static 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 | ||
188 | static int hpp__width_period(struct perf_hpp *hpp __used) | 188 | static 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 | ||
207 | static int hpp__width_delta(struct perf_hpp *hpp __used) | 207 | static 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 | ||
241 | static int hpp__width_displ(struct perf_hpp *hpp __used) | 241 | static int hpp__width_displ(struct perf_hpp *hpp __maybe_unused) |
242 | { | 242 | { |
243 | return 6; | 243 | return 6; |
244 | } | 244 | } |
245 | 245 | ||
246 | static int hpp__entry_displ(struct perf_hpp *hpp, struct hist_entry *he __used) | 246 | static 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 4dc0887c04f..60debb81537 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 | ||
31 | static void ui__sigwinch(int sig __used) | 31 | static 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 | ||
91 | static void newt_suspend(void *d __used) | 91 | static void newt_suspend(void *d __maybe_unused) |
92 | { | 92 | { |
93 | newtSuspend(); | 93 | newtSuspend(); |
94 | raise(SIGTSTP); | 94 | raise(SIGTSTP); |