Messages in this thread Patch in this message | | | From | Arnaldo Carvalho de Melo <> | Subject | [PATCH] perf top: Use a macro instead of a constant variable | Date | Mon, 22 Feb 2010 16:14:22 -0300 |
| |
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To overcome a silly gcc warning:
cc1: warnings being treated as errors builtin-top.c: In function ‘lookup_sym_source’: builtin-top.c:291: warning: not protecting local variables: variable length buffer make: *** [builtin-top.o] Error 1 make: *** Waiting for unfinished jobs....
That is emitted for this:
const size_t pattern_len = BITS_PER_LONG / 4 + 2; char pattern[pattern_len + 1];
Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/builtin-top.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a457bbb..1a197f4 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -291,7 +291,7 @@ static void lookup_sym_source(struct sym_entry *syme) { struct symbol *symbol = sym_entry__symbol(syme); struct source_line *line; - const size_t pattern_len = BITS_PER_LONG / 4 + 2; +#define pattern_len (BITS_PER_LONG / 4 + 2) char pattern[pattern_len + 1]; sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4, @@ -305,6 +305,7 @@ static void lookup_sym_source(struct sym_entry *syme) } } pthread_mutex_unlock(&syme->src->lock); +#undef pattern_len } static void show_lines(struct source_line *queue, int count, int total) -- 1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |